コード例 #1
0
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ReportingCurrency other = (ReportingCurrency)obj;
         return(JodaBeanUtils.equal(type, other.type) && JodaBeanUtils.equal(currency, other.currency));
     }
     return(false);
 }
コード例 #2
0
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case -140572773:         // functions
                    this.functions = (CalculationFunctions)newValue;
                    break;

                case -1287844769:         // reportingCurrency
                    this.reportingCurrency = (ReportingCurrency)newValue;
                    break;

                case 458736106:         // parameters
                    this.parameters = (CalculationParameters)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
コード例 #3
0
 /// <summary>
 /// Sets the reporting currency, used to control currency conversion, optional.
 /// <para>
 /// This is used to specify the currency that the result should be reporting in.
 /// If the result is not associated with a currency, such as for "par rate", then the
 /// reporting currency will effectively be ignored.
 /// </para>
 /// <para>
 /// If empty, the reporting currency from <seealso cref="CalculationRules"/> will be used.
 /// </para>
 /// </summary>
 /// <param name="reportingCurrency">  the new value </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder reportingCurrency(ReportingCurrency reportingCurrency)
 {
     this.reportingCurrency_Renamed = reportingCurrency;
     return(this);
 }
コード例 #4
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Combines the parameters with another reporting currency and set of parameters.
        /// </summary>
        /// <param name="reportingCurrency">  the default reporting currency </param>
        /// <param name="defaultParameters">  the default parameters </param>
        /// <returns> the combined column </returns>
        public Column combineWithDefaults(ReportingCurrency reportingCurrency, CalculationParameters defaultParameters)
        {
            CalculationParameters combinedParams = parameters.combinedWith(defaultParameters);

            return(new Column(name, measure, ReportingCurrency.orElse(reportingCurrency), combinedParams));
        }
コード例 #5
0
        /// <summary>
        /// Obtains an instance that will calculate the specified measure, converting to the specified currency,
        /// defining the column name and parameters.
        /// <para>
        /// The specified calculation parameters take precedence over those in <seealso cref="CalculationRules"/>,
        /// with the combined set being used for the column.
        ///
        /// </para>
        /// </summary>
        /// <param name="measure">  the measure to be calculated </param>
        /// <param name="columnName">  the column name </param>
        /// <param name="currency">  the currency to convert to </param>
        /// <param name="parameters">  the parameters that control the calculation, may be empty </param>
        /// <returns> a column with the specified measure, column name and reporting currency </returns>
        public static Column of(Measure measure, string columnName, Currency currency, params CalculationParameter[] parameters)
        {
            ColumnName name = ColumnName.of(columnName);

            return(new Column(name, measure, ReportingCurrency.of(currency), CalculationParameters.of(parameters)));
        }
コード例 #6
0
        /// <summary>
        /// Obtains an instance that will calculate the specified measure, converting to the specified currency.
        /// <para>
        /// The column name will be the same as the name of the measure.
        ///
        /// </para>
        /// </summary>
        /// <param name="measure">  the measure to be calculated </param>
        /// <param name="currency">  the currency to convert to </param>
        /// <returns> a column with the specified measure </returns>
        public static Column of(Measure measure, Currency currency)
        {
            ColumnName name = ColumnName.of(measure);

            return(new Column(name, measure, ReportingCurrency.of(currency), CalculationParameters.empty()));
        }
コード例 #7
0
 public virtual void test_serialization()
 {
     assertSerialization(ReportingCurrency.NATURAL);
     assertSerialization(ReportingCurrency.of(USD));
 }
コード例 #8
0
 /// <summary>
 /// Obtains an instance specifying the functions, reporting currency and additional parameters.
 /// <para>
 /// Most functions require a parameter to control their behavior, such as {@code RatesMarketDataLookup}.
 ///
 /// </para>
 /// </summary>
 /// <param name="functions">  the calculation functions </param>
 /// <param name="reportingCurrency">  the reporting currency </param>
 /// <param name="parameters">  the parameters that control the calculation, may be empty </param>
 /// <returns> the rules </returns>
 public static CalculationRules of(CalculationFunctions functions, ReportingCurrency reportingCurrency, CalculationParameters parameters)
 {
     return(new CalculationRules(functions, reportingCurrency, parameters));
 }
コード例 #9
0
        /// <summary>
        /// Obtains an instance specifying the functions, reporting currency and additional parameters.
        /// <para>
        /// Most functions require a parameter to control their behavior, such as {@code RatesMarketDataLookup}.
        ///
        /// </para>
        /// </summary>
        /// <param name="functions">  the calculation functions </param>
        /// <param name="reportingCurrency">  the reporting currency </param>
        /// <param name="parameters">  the parameters that control the calculation, may be empty </param>
        /// <returns> the rules </returns>
        public static CalculationRules of(CalculationFunctions functions, Currency reportingCurrency, params CalculationParameter[] parameters)
        {
            CalculationParameters @params = CalculationParameters.of(parameters);

            return(new CalculationRules(functions, ReportingCurrency.of(reportingCurrency), @params));
        }