public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 100346066:         // index
                    this.index_Renamed = (PriceIndex)newValue;
                    break;

                case 106898:         // lag
                    this.lag_Renamed = (Period)newValue;
                    break;

                case -1409010088:         // indexCalculationMethod
                    this.indexCalculationMethod_Renamed = (PriceIndexCalculationMethod)newValue;
                    break;

                case 922631823:         // firstIndexValue
                    this.firstIndexValue_Renamed = (double?)newValue;
                    break;

                case -91774989:         // gearing
                    this.gearing_Renamed = (ValueSchedule)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(InflationRateCalculation beanToCopy)
 {
     this.index_Renamed = beanToCopy.Index;
     this.lag_Renamed   = beanToCopy.Lag;
     this.indexCalculationMethod_Renamed = beanToCopy.IndexCalculationMethod;
     this.firstIndexValue_Renamed        = beanToCopy.firstIndexValue;
     this.gearing_Renamed = beanToCopy.gearing;
 }
 private InflationRateCalculation(PriceIndex index, Period lag, PriceIndexCalculationMethod indexCalculationMethod, double?firstIndexValue, ValueSchedule gearing)
 {
     JodaBeanUtils.notNull(index, "index");
     JodaBeanUtils.notNull(lag, "lag");
     JodaBeanUtils.notNull(indexCalculationMethod, "indexCalculationMethod");
     this.index = index;
     this.lag   = lag;
     this.indexCalculationMethod = indexCalculationMethod;
     this.firstIndexValue        = firstIndexValue;
     this.gearing = gearing;
     validate();
 }
 /// <summary>
 /// Sets reference price index calculation method.
 /// <para>
 /// This specifies how the reference index calculation occurs.
 /// </para>
 /// </summary>
 /// <param name="indexCalculationMethod">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder indexCalculationMethod(PriceIndexCalculationMethod indexCalculationMethod)
 {
     JodaBeanUtils.notNull(indexCalculationMethod, "indexCalculationMethod");
     this.indexCalculationMethod_Renamed = indexCalculationMethod;
     return(this);
 }
 /// <summary>
 /// Obtains a rate calculation for the specified price index with known start index value.
 /// <para>
 /// The calculation will use the specified month lag.
 /// The first index value will be set to the specified value
 /// All other optional fields will be set to their default values.
 /// Thus, fixing will be in advance, with no gearing.
 /// If this method provides insufficient control, use the <seealso cref="#builder() builder"/>.
 ///
 /// </para>
 /// </summary>
 /// <param name="index">  the price index </param>
 /// <param name="monthLag">  the month lag </param>
 /// <param name="indexCalculationMethod">  the reference price index calculation method </param>
 /// <param name="firstIndexValue">  the first index value </param>
 /// <returns> the inflation rate calculation </returns>
 public static InflationRateCalculation of(PriceIndex index, int monthLag, PriceIndexCalculationMethod indexCalculationMethod, double firstIndexValue)
 {
     return(InflationRateCalculation.builder().index(index).lag(Period.ofMonths(monthLag)).indexCalculationMethod(indexCalculationMethod).firstIndexValue(firstIndexValue).build());
 }
Example #6
0
 public virtual void test_of_lookup_null()
 {
     assertThrows(() => PriceIndexCalculationMethod.of(null), typeof(System.ArgumentException));
 }
Example #7
0
 public virtual void test_of_lookup_notFound()
 {
     assertThrows(() => PriceIndexCalculationMethod.of("Rubbish"), typeof(System.ArgumentException));
 }
Example #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "name") public void test_of_lookup(PriceIndexCalculationMethod convention, String name)
        public virtual void test_of_lookup(PriceIndexCalculationMethod convention, string name)
        {
            assertEquals(PriceIndexCalculationMethod.of(name), convention);
        }
Example #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "name") public void test_toString(PriceIndexCalculationMethod convention, String name)
        public virtual void test_toString(PriceIndexCalculationMethod convention, string name)
        {
            assertEquals(convention.ToString(), name);
        }