Class CalculationRules

  • All Implemented Interfaces:
    org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class CalculationRules
    extends Object
    implements org.joda.beans.ImmutableBean
    A set of rules that define how the calculation runner should perform calculations.

    CalculationRunner provides the ability to perform calculations on many targets, such as trades and positions. It returns a grid of results, with the targets as rows. Each individual calculation is controlled by three things:

    • The function, selected by the target type
    • The measure, the high-level output to be calculated
    • The parameters, adjust how the measure is to be calculated
    CalculationRules operates in association with Column. The column is used to define the measure. It can also be used to specify column-specific parameters. The rules contain the complete set of functions and the default set of parameters.
    • Method Detail

      • of

        public static CalculationRules of​(CalculationFunctions functions,
                                          CalculationParameter... parameters)
        Obtains an instance specifying the functions to use and some additional parameters.

        The output will uses the "natural" reporting currency. Most functions require a parameter to control their behavior, such as RatesMarketDataLookup.

        Parameters:
        functions - the calculation functions
        parameters - the parameters that control the calculation, may be empty
        Returns:
        the rules
      • of

        public static CalculationRules of​(CalculationFunctions functions,
                                          CalculationParameters parameters)
        Obtains an instance specifying the functions to use and some additional parameters.

        The output will uses the "natural" reporting currency. Most functions require a parameter to control their behavior, such as RatesMarketDataLookup.

        Parameters:
        functions - the calculation functions
        parameters - the parameters that control the calculation, may be empty
        Returns:
        the rules
      • of

        public static CalculationRules of​(CalculationFunctions functions,
                                          Currency reportingCurrency,
                                          CalculationParameter... parameters)
        Obtains an instance specifying the functions, reporting currency and additional parameters.

        Most functions require a parameter to control their behavior, such as RatesMarketDataLookup.

        Parameters:
        functions - the calculation functions
        reportingCurrency - the reporting currency
        parameters - the parameters that control the calculation, may be empty
        Returns:
        the rules
      • of

        public static CalculationRules of​(CalculationFunctions functions,
                                          ReportingCurrency reportingCurrency,
                                          CalculationParameters parameters)
        Obtains an instance specifying the functions, reporting currency and additional parameters.

        Most functions require a parameter to control their behavior, such as RatesMarketDataLookup.

        Parameters:
        functions - the calculation functions
        reportingCurrency - the reporting currency
        parameters - the parameters that control the calculation, may be empty
        Returns:
        the rules
      • meta

        public static CalculationRules.Meta meta()
        The meta-bean for CalculationRules.
        Returns:
        the meta-bean, not null
      • metaBean

        public CalculationRules.Meta metaBean()
        Specified by:
        metaBean in interface org.joda.beans.Bean
      • getFunctions

        public CalculationFunctions getFunctions()
        Gets the calculation functions.

        Functions provide the logic of the calculation. Each type of target must have an associated function in order for calculations to be performed.

        Returns:
        the value of the property, not null
      • getReportingCurrency

        public ReportingCurrency getReportingCurrency()
        Gets the reporting currency, used to control currency conversion.

        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.

        Returns:
        the value of the property, not null
      • getParameters

        public CalculationParameters getParameters()
        Gets the calculation parameters, used to control the how the calculation is performed.

        Parameters are used to parameterize the Measure to be calculated. They may be specified in two places - here and in the Column. The parameters specified here are the defaults that apply to all columns.

        If a parameter is defined here and in the column with the same query type, then the column parameter takes precedence.

        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object