Package com.opengamma.strata.market
Class GenericDoubleShifts
- java.lang.Object
-
- com.opengamma.strata.market.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
QuoteIdandDouble.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGenericDoubleShifts.MetaThe meta-bean forGenericDoubleShifts.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MarketDataBox<Double>applyTo(MarketDataBox<Double> marketData, ReferenceData refData)Applies this perturbation to the market data in a box, returning a box containing new, modified data.booleanequals(Object obj)Class<Double>getMarketDataType()Returns the market data type that the perturbation changes.intgetScenarioCount()Returns the number of scenarios for which this perturbation generates data.DoubleArraygetShiftAmount()Gets the shifts to apply to aDoublevalue.ShiftTypegetShiftType()Gets the type of shift applied to aDoublevalue.doublegetSpread()Gets the constant spread.inthashCode()static GenericDoubleShifts.Metameta()The meta-bean forGenericDoubleShifts.GenericDoubleShifts.MetametaBean()static GenericDoubleShiftsof(ShiftType shiftType, DoubleArray shiftAmount)Creates an instance with zero spread.static GenericDoubleShiftsof(ShiftType shiftType, DoubleArray shiftAmount, double spread)Creates an instance with spread.StringtoString()
-
-
-
Method Detail
-
of
public static GenericDoubleShifts of(ShiftType shiftType, DoubleArray shiftAmount)
Creates an instance with zero spread.- Parameters:
shiftType- the shift typeshiftAmount- 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 typeshiftAmount- the shift amountspread- the spread- Returns:
- the instance
-
applyTo
public MarketDataBox<Double> applyTo(MarketDataBox<Double> marketData, ReferenceData refData)
Description copied from interface:ScenarioPerturbationApplies 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:
applyToin interfaceScenarioPerturbation<Double>- Parameters:
marketData- the market data to perturbrefData- the reference data- Returns:
- new market data derived by applying the perturbation to the input data
-
getScenarioCount
public int getScenarioCount()
Description copied from interface:ScenarioPerturbationReturns the number of scenarios for which this perturbation generates data.- Specified by:
getScenarioCountin interfaceScenarioPerturbation<Double>- Returns:
- the number of scenarios for which this perturbation generates data
-
getMarketDataType
public Class<Double> getMarketDataType()
Description copied from interface:ScenarioPerturbationReturns the market data type that the perturbation changes.- Specified by:
getMarketDataTypein interfaceScenarioPerturbation<Double>- Returns:
- the data type
-
meta
public static GenericDoubleShifts.Meta meta()
The meta-bean forGenericDoubleShifts.- Returns:
- the meta-bean, not null
-
metaBean
public GenericDoubleShifts.Meta metaBean()
- Specified by:
metaBeanin interfaceorg.joda.beans.Bean
-
getShiftType
public ShiftType getShiftType()
Gets the type of shift applied to aDoublevalue.- Returns:
- the value of the property, not null
-
getShiftAmount
public DoubleArray getShiftAmount()
Gets the shifts to apply to aDoublevalue.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
-
-