public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case -879772901: // amounts this.amounts = (MultiCurrencyAmountArray)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
/// <summary> /// Obtains an instance using a function to create the entries. /// <para> /// The function is passed the scenario index and returns the value for that index. /// /// </para> /// </summary> /// <param name="size"> the number of elements </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 MultiCurrencyScenarioArray of(int size, System.Func <int, MultiCurrencyAmount> amountFunction) { return(new MultiCurrencyScenarioArray(MultiCurrencyAmountArray.of(size, amountFunction))); }
/// <summary> /// Returns an instance containing the values from the list of amounts. /// </summary> /// <param name="amounts"> the amounts, one for each scenario </param> /// <returns> an instance containing the values from the list of amounts </returns> public static MultiCurrencyScenarioArray of(IList <MultiCurrencyAmount> amounts) { return(new MultiCurrencyScenarioArray(MultiCurrencyAmountArray.of(amounts))); }
//------------------------------------------------------------------------- /// <summary> /// Obtains an instance from the specified currency and array of values. /// </summary> /// <param name="amounts"> the amounts, one for each scenario </param> /// <returns> an instance with the specified currency and values </returns> public static MultiCurrencyScenarioArray of(MultiCurrencyAmountArray amounts) { return(new MultiCurrencyScenarioArray(amounts)); }
private MultiCurrencyScenarioArray(MultiCurrencyAmountArray amounts) { JodaBeanUtils.notNull(amounts, "amounts"); this.amounts = amounts; }
/// <summary> /// Returns an instance containing the values from a map of amounts with the same number of elements in each array. /// </summary> /// <param name="values"> map of currencies to values </param> /// <returns> an instance containing the values from the map </returns> public static MultiCurrencyScenarioArray of(IDictionary <Currency, DoubleArray> values) { return(new MultiCurrencyScenarioArray(MultiCurrencyAmountArray.of(values))); }