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
QuoteId
andDouble
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GenericDoubleShifts.Meta
The 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.boolean
equals(Object obj)
Class<Double>
getMarketDataType()
Returns the market data type that the perturbation changes.int
getScenarioCount()
Returns the number of scenarios for which this perturbation generates data.DoubleArray
getShiftAmount()
Gets the shifts to apply to aDouble
value.ShiftType
getShiftType()
Gets the type of shift applied to aDouble
value.double
getSpread()
Gets the constant spread.int
hashCode()
static GenericDoubleShifts.Meta
meta()
The meta-bean forGenericDoubleShifts
.GenericDoubleShifts.Meta
metaBean()
static GenericDoubleShifts
of(ShiftType shiftType, DoubleArray shiftAmount)
Creates an instance with zero spread.static GenericDoubleShifts
of(ShiftType shiftType, DoubleArray shiftAmount, double spread)
Creates an instance with spread.String
toString()
-
-
-
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: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 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:ScenarioPerturbation
Returns the number of scenarios for which this perturbation generates data.- Specified by:
getScenarioCount
in interfaceScenarioPerturbation<Double>
- Returns:
- the number of scenarios for which this perturbation generates data
-
getMarketDataType
public Class<Double> getMarketDataType()
Description copied from interface:ScenarioPerturbation
Returns the market data type that the perturbation changes.- Specified by:
getMarketDataType
in 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:
metaBean
in interfaceorg.joda.beans.Bean
-
getShiftType
public ShiftType getShiftType()
Gets the type of shift applied to aDouble
value.- Returns:
- the value of the property, not null
-
getShiftAmount
public DoubleArray getShiftAmount()
Gets the shifts to apply to aDouble
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
-
-