/** * Sets the notional of the futures. * <p> * This is also called face value or contract value. * @param notional the new value * @return this, for chaining, not null */ public Builder notional(double notional) { ArgChecker.notNegativeOrZero(notional, "notional"); this.notional = notional; return this; }
/** * Creates an instance. * * @param a the value */ public IncompleteGammaFunction(double a) { ArgChecker.notNegativeOrZero(a, "a"); _maxIter = 100000; _eps = 1e-12; _a = a; }
/** * Sets the notional. * <p> * This is also called face value or contract value. * @param notional the new value * @return this, for chaining, not null */ public Builder notional(double notional) { ArgChecker.notNegativeOrZero(notional, "notional"); this.notional = notional; return this; }
/** * Sets the notional of the futures. * <p> * This is also called face value or contract value. * @param notional the new value * @return this, for chaining, not null */ public Builder notional(double notional) { ArgChecker.notNegativeOrZero(notional, "notional"); this.notional = notional; return this; }
@Override public double volatility(double expiry, LocalDate fixingDate, double strikePrice, double futurePrice) { ArgChecker.notNegativeOrZero(strikePrice, "strikePrice"); ArgChecker.notNegativeOrZero(futurePrice, "futurePrice"); double logMoneyness = Math.log(strikePrice / futurePrice); return surface.zValue(expiry, logMoneyness); }
/** * Creates an instance. * * @param mean the mean * @param sigma the sigma */ public NormalRandomNumberGenerator(double mean, double sigma) { ArgChecker.notNegativeOrZero(sigma, "standard deviation"); this.normal = new NormalDistribution(mean, sigma); }
private InflationEndMonthRateComputation( double startIndexValue, PriceIndexObservation endObservation) { ArgChecker.notNegativeOrZero(startIndexValue, "startIndexValue"); JodaBeanUtils.notNull(endObservation, "endObservation"); this.startIndexValue = startIndexValue; this.endObservation = endObservation; }
private CurveParameterSize( CurveName name, int parameterCount) { JodaBeanUtils.notNull(name, "name"); ArgChecker.notNegativeOrZero(parameterCount, "parameterCount"); this.name = name; this.parameterCount = parameterCount; }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*'name'.*negative.*zero.*") public void test_notNegativeOrZero_int_zero() { ArgChecker.notNegativeOrZero(0, "name"); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*'name'.*negative.*zero.*") public void test_notNegativeOrZero_long_zero() { ArgChecker.notNegativeOrZero(0L, "name"); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*'name'.*negative.*zero.*") public void test_notNegativeOrZero_long_negative() { ArgChecker.notNegativeOrZero(-1L, "name"); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*'name'.*negative.*zero.*") public void test_notNegativeOrZero_double_negative() { ArgChecker.notNegativeOrZero(-1.0d, "name"); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*'name'.*negative.*zero.*") public void test_notNegativeOrZero_int_negative() { ArgChecker.notNegativeOrZero(-1, "name"); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*'name'.*greater.*zero.*") public void test_notNegativeOrZero_double_eps_negative() { ArgChecker.notNegativeOrZero(-1.0d, 0.0001d, "name"); }
/** * Obtains an instance of {@code Moneyness} from the strike and forward. * <p> * The moneyness is defined as {@code strike/forward}. * * @param strike the strike, not negative * @param forward the forward, not negative * @return the instance */ public static MoneynessStrike ofStrikeAndForward(double strike, double forward) { return of(ArgChecker.notNegativeOrZero(strike, "strike") / ArgChecker.notNegative(forward, "forward")); }
@Override public LocalDate nth(LocalDate date, int sequenceNumber) { ArgChecker.notNegativeOrZero(sequenceNumber, "sequenceNumber"); LocalDate base = date.with(THIRD_WEDNESDAY); if (!base.isAfter(date)) { base = base.plusMonths(1); } return shift(base, sequenceNumber); }
@Override public LocalDate nth(LocalDate date, int sequenceNumber) { ArgChecker.notNegativeOrZero(sequenceNumber, "sequenceNumber"); LocalDate base = date.withDayOfMonth(10); if (!base.isAfter(date)) { base = base.plusMonths(1); } return shift(base, sequenceNumber); }
@Override public LocalDate nthOrSame(LocalDate date, int sequenceNumber) { ArgChecker.notNegativeOrZero(sequenceNumber, "sequenceNumber"); LocalDate base = date.withDayOfMonth(10); if (base.isBefore(date)) { base = base.plusMonths(1); } return shift(base, sequenceNumber); }
@Override public LocalDate nthOrSame(LocalDate date, int sequenceNumber) { ArgChecker.notNegativeOrZero(sequenceNumber, "sequenceNumber"); LocalDate base = date.with(THIRD_WEDNESDAY); if (base.isBefore(date)) { return base.plusMonths(sequenceNumber).with(THIRD_WEDNESDAY); } return base.plusMonths(sequenceNumber - 1).with(THIRD_WEDNESDAY); }
@Override public LocalDate nth(LocalDate date, int sequenceNumber) { ArgChecker.notNegativeOrZero(sequenceNumber, "sequenceNumber"); LocalDate base = date.with(THIRD_WEDNESDAY); if (!base.isAfter(date)) { return base.plusMonths(sequenceNumber).with(THIRD_WEDNESDAY); } return base.plusMonths(sequenceNumber - 1).with(THIRD_WEDNESDAY); }