@Override public DoubleScenarioArray build() { return new DoubleScenarioArray( values); }
/** * Obtains an instance from the specified array of values. * * @param values the values, one value for each scenario * @return an instance with the specified values */ public static DoubleScenarioArray of(DoubleArray values) { return new DoubleScenarioArray(values); }
/** * Obtains an instance from the specified list of values. * * @param values the values, one value for each scenario * @return an instance with the specified values */ public static DoubleScenarioArray of(List<Double> values) { return new DoubleScenarioArray(DoubleArray.copyOf(values)); }
/** * Obtains an instance using a function to create the entries. * <p> * The function is passed the scenario index and returns the value for that index. * * @param size the number of elements * @param valueFunction the function used to obtain each value * @return an instance initialized using the function * @throws IllegalArgumentException is size is zero or less */ public static DoubleScenarioArray of(int size, IntToDoubleFunction valueFunction) { ArgChecker.notNegativeOrZero(size, "size"); return new DoubleScenarioArray(DoubleArray.of(size, valueFunction)); }