@Override public T getValue(int scenarioIndex) { ArgChecker.notNegative(scenarioIndex, "scenarioIndex"); return value; }
/** * 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")); }
private MoneynessStrike( double value) { ArgChecker.notNegative(value, "value"); this.value = value; }
/** * Sets the price that was traded, in decimal form. * <p> * This is the price agreed when the trade occurred. * @param price the new value * @return this, for chaining, not null */ public Builder price(double price) { ArgChecker.notNegative(price, "price"); this.price = price; return this; }
/** * Sets penalty intensity parameter for expiry dimension. * @param lambdaExpiry the new value * @return this, for chaining, not null */ public Builder lambdaExpiry(double lambdaExpiry) { ArgChecker.notNegative(lambdaExpiry, "lambdaExpiry"); this.lambdaExpiry = lambdaExpiry; return this; }
/** * Sets the price that was traded, in decimal form. * <p> * This is the price agreed when the trade occurred. * @param price the new value * @return this, for chaining, not null */ public Builder price(double price) { ArgChecker.notNegative(price, "price"); this.price = price; return this; }
/** * Sets the fixed coupon rate. * <p> * This must be represented in decimal form. * @param fixedRate the new value * @return this, for chaining, not null */ public Builder fixedRate(double fixedRate) { ArgChecker.notNegative(fixedRate, "fixedRate"); this.fixedRate = fixedRate; return this; }
/** * Sets the fixed coupon rate. * <p> * This must be represented in decimal form. * @param fixedRate the new value * @return this, for chaining, not null */ public Builder fixedRate(double fixedRate) { ArgChecker.notNegative(fixedRate, "fixedRate"); this.fixedRate = fixedRate; return this; }
@ImmutableValidator private void validate() { if (rateCutOffDays != null) { ArgChecker.notNegative(rateCutOffDays.intValue(), "rateCutOffDays"); } }
@Override public double[] getVector(int size) { ArgChecker.notNegative(size, "size"); double[] result = new double[size]; for (int i = 0; i < size; i++) { result[i] = normal.nextRandom(); } return result; }
@Override public Double apply(Double x) { ArgChecker.notNull(x, "x"); ArgChecker.notNegative(x, "x"); return _calc.apply(0.5 + 0.5 * x); }
@Override public LocalDateDoubleTimeSeries headSeries(int numPoints) { ArgChecker.notNegative(numPoints, "numPoints"); if (numPoints == 0) { return EMPTY; } else if (numPoints >= size()) { return this; } LocalDate[] datesArray = Arrays.copyOfRange(dates, 0, numPoints); double[] valuesArray = Arrays.copyOfRange(values, 0, numPoints); return createUnsafe(datesArray, valuesArray); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*'name'.*negative.*") public void test_notNegative_double_negative() { ArgChecker.notNegative(-1.0d, "name"); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*'name'.*negative.*") public void test_notNegative_int_negative() { ArgChecker.notNegative(-1, "name"); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*'name'.*negative.*") public void test_notNegative_long_negative() { ArgChecker.notNegative(-1L, "name"); }
public StudentTOneTailedCriticalValueCalculator(double nu, RandomEngine engine) { ArgChecker.notNegative(nu, "nu"); ArgChecker.notNull(engine, "engine"); _dist = new StudentTDistribution(nu, engine); }
@Override public Double apply(Double x) { ArgChecker.notNull(x, "x"); ArgChecker.notNegative(x, "x"); if (DoubleMath.fuzzyEquals(x, 0.5, 1e-14)) { return 0.5; } return _dist.getInverseCDF(x); }
@Override public LocalDateDoubleTimeSeries headSeries(int numPoints) { ArgChecker.notNegative(numPoints, "numPoints"); if (numPoints == 0) { return LocalDateDoubleTimeSeries.empty(); } else if (numPoints > size()) { return this; } int endPosition = findHeadPoints(numPoints); return new DenseLocalDateDoubleTimeSeries(startDate, Arrays.copyOf(points, endPosition), dateCalculation); }
private EuropeanVanillaOption( double strike, double timeToExpiry, PutCall putCall) { ArgChecker.notNegative(timeToExpiry, "timeToExpiry"); JodaBeanUtils.notNull(putCall, "putCall"); this.strike = strike; this.timeToExpiry = timeToExpiry; this.putCall = putCall; }
@Override public LocalDateDoubleTimeSeries tailSeries(int numPoints) { ArgChecker.notNegative(numPoints, "numPoints"); if (numPoints == 0) { return EMPTY; } else if (numPoints >= size()) { return this; } LocalDate[] datesArray = Arrays.copyOfRange(dates, size() - numPoints, size()); double[] valuesArray = Arrays.copyOfRange(values, size() - numPoints, size()); return createUnsafe(datesArray, valuesArray); }