Class PerturbationMapping<T>

  • Type Parameters:
    T - the type of the market data handled by the mapping
    All Implemented Interfaces:
    org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class PerturbationMapping<T>
    extends Object
    implements org.joda.beans.ImmutableBean
    Contains a market data perturbation and a filter that decides what market data it applies to.

    The mapping links the perturbation to be applied to the filter that decides whether it applies. The generic types of the filter can be for a subtype of the type that the perturbation applies to.

    • Method Detail

      • of

        public static <T> PerturbationMapping<T> of​(MarketDataFilter<? extends T,​?> filter,
                                                    ScenarioPerturbation<T> perturbation)
        Returns a mapping containing a single perturbation.

        This uses the type from ScenarioPerturbation as the type of the mapping.

        Type Parameters:
        T - the type of the market data handled by the mapping
        Parameters:
        filter - the filter used to choose the market data
        perturbation - the perturbation applied to any market data matching the filter
        Returns:
        a mapping containing a single perturbation
      • matches

        public boolean matches​(MarketDataId<?> marketDataId,
                               MarketDataBox<?> marketData,
                               ReferenceData refData)
        Returns true if the filter matches the market data ID and value.
        Parameters:
        marketDataId - the ID of a piece of market data
        marketData - the market data value
        refData - the reference data
        Returns:
        true if the filter matches
      • applyPerturbation

        public MarketDataBox<T> applyPerturbation​(MarketDataBox<T> marketData,
                                                  ReferenceData refData)
        Applies the perturbations in this mapping to an item of market data and returns the results.

        This method should only be called after calling #matches and receiving a result of true.

        Parameters:
        marketData - the market data value
        refData - the reference data
        Returns:
        a list of market data values derived from the input value by applying the perturbations
      • getScenarioCount

        public int getScenarioCount()
        Returns the number of scenarios for which this mapping can generate data.
        Returns:
        the number of scenarios for which this mapping can generate data
      • meta

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

        public static <R> PerturbationMapping.Meta<R> metaPerturbationMapping​(Class<R> cls)
        The meta-bean for PerturbationMapping.
        Type Parameters:
        R - the bean's generic type
        Parameters:
        cls - the bean's generic type
        Returns:
        the meta-bean, not null
      • builder

        public static <T> PerturbationMapping.Builder<T> builder()
        Returns a builder used to create an instance of the bean.
        Type Parameters:
        T - the type
        Returns:
        the builder, not null
      • getMarketDataType

        public Class<T> getMarketDataType()
        Gets the type of market data handled by this mapping.
        Returns:
        the value of the property, not null
      • getFilter

        public MarketDataFilter<? extends T,​?> getFilter()
        Gets the filter that decides whether the perturbation should be applied to a piece of market data.
        Returns:
        the value of the property, not null
      • getPerturbation

        public ScenarioPerturbation<T> getPerturbation()
        Gets perturbation that should be applied to market data as part of a scenario.
        Returns:
        the value of the property, not null
      • toBuilder

        public PerturbationMapping.Builder<T> toBuilder()
        Returns a builder that allows this bean to be mutated.
        Returns:
        the mutable builder, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object