Exemple #1
0
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case -879772901:         // amounts
                    this.amounts = (CurrencyAmountArray)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
Exemple #2
0
 /// <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)));
 }
Exemple #3
0
 /// <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)));
 }
Exemple #4
0
 //-------------------------------------------------------------------------
 /// <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 CurrencyScenarioArray of(CurrencyAmountArray amounts)
 {
     return(new CurrencyScenarioArray(amounts));
 }
Exemple #5
0
 private CurrencyScenarioArray(CurrencyAmountArray amounts)
 {
     JodaBeanUtils.notNull(amounts, "amounts");
     this.amounts = amounts;
 }
Exemple #6
0
 /// <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)));
 }