/// <summary> /// Obtains an instance from the specified currency and array of values. /// </summary> /// <param name="currency"> the currency of the values </param> /// <param name="values"> the values, one for each scenario </param> /// <returns> an instance with the specified currency and values </returns> public static CurrencyScenarioArray of(Currency currency, DoubleArray values) { return(new CurrencyScenarioArray(CurrencyAmountArray.of(currency, values))); }
/// <summary> /// Obtains an instance from the specified list of amounts. /// <para> /// All amounts must have the same currency. /// /// </para> /// </summary> /// <param name="amounts"> the amounts, one for each scenario </param> /// <returns> an instance with the specified amounts </returns> /// <exception cref="IllegalArgumentException"> if multiple currencies are found </exception> public static CurrencyScenarioArray of(IList <CurrencyAmount> amounts) { return(new CurrencyScenarioArray(CurrencyAmountArray.of(amounts))); }
/// <summary> /// Obtains an instance using a function to create the entries. /// <para> /// The function is passed the scenario index and returns the {@code CurrencyAmount} for that index. /// </para> /// <para> /// In some cases it may be possible to specify the currency with a function providing a {@code double}. /// To do this, use <seealso cref="DoubleArray#of(int, java.util.function.IntToDoubleFunction)"/> and /// then call <seealso cref="#of(Currency, DoubleArray)"/>. /// /// </para> /// </summary> /// <param name="size"> the number of elements, at least size one </param> /// <param name="amountFunction"> the function used to obtain each amount </param> /// <returns> an instance initialized using the function </returns> /// <exception cref="IllegalArgumentException"> is size is zero or less </exception> public static CurrencyScenarioArray of(int size, System.Func <int, CurrencyAmount> amountFunction) { return(new CurrencyScenarioArray(CurrencyAmountArray.of(size, amountFunction))); }