Class GenericDoubleShifts

  • All Implemented Interfaces:
    ScenarioPerturbation<Double>, Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class GenericDoubleShifts
    extends Object
    implements ScenarioPerturbation<Double>, org.joda.beans.ImmutableBean, Serializable
    A perturbation that applies different shifts to a double value.

    This class contains shifts, each of which is associated with a scenario and applied to a value based on the shift type. A constant spread can be added for all of the scenarios.

    A typical application of this is to generate scenario perturbation to market quotes, where the market quote is represented in terms of QuoteId and Double.

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static GenericDoubleShifts of​(ShiftType shiftType,
                                             DoubleArray shiftAmount)
        Creates an instance with zero spread.
        Parameters:
        shiftType - the shift type
        shiftAmount - the shift amount
        Returns:
        the instance
      • of

        public static GenericDoubleShifts of​(ShiftType shiftType,
                                             DoubleArray shiftAmount,
                                             double spread)
        Creates an instance with spread.
        Parameters:
        shiftType - the shift type
        shiftAmount - the shift amount
        spread - the spread
        Returns:
        the instance
      • applyTo

        public MarketDataBox<Double> applyTo​(MarketDataBox<Double> marketData,
                                             ReferenceData refData)
        Description copied from interface: ScenarioPerturbation
        Applies this perturbation to the market data in a box, returning a box containing new, modified data.

        The original market data must not be altered. Instead a perturbed copy must be returned.

        Specified by:
        applyTo in interface ScenarioPerturbation<Double>
        Parameters:
        marketData - the market data to perturb
        refData - the reference data
        Returns:
        new market data derived by applying the perturbation to the input data
      • getScenarioCount

        public int getScenarioCount()
        Description copied from interface: ScenarioPerturbation
        Returns the number of scenarios for which this perturbation generates data.
        Specified by:
        getScenarioCount in interface ScenarioPerturbation<Double>
        Returns:
        the number of scenarios for which this perturbation generates data
      • meta

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

        public ShiftType getShiftType()
        Gets the type of shift applied to a Double value.
        Returns:
        the value of the property, not null
      • getShiftAmount

        public DoubleArray getShiftAmount()
        Gets the shifts to apply to a Double value.

        Each element in the array corresponds to each scenario.

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

        public double getSpread()
        Gets the constant spread.
        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object