Class PerturbationMapping<T>
- java.lang.Object
-
- com.opengamma.strata.calc.marketdata.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PerturbationMapping.Builder<T>
The bean-builder forPerturbationMapping
.static class
PerturbationMapping.Meta<T>
The meta-bean forPerturbationMapping
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MarketDataBox<T>
applyPerturbation(MarketDataBox<T> marketData, ReferenceData refData)
Applies the perturbations in this mapping to an item of market data and returns the results.static <T> PerturbationMapping.Builder<T>
builder()
Returns a builder used to create an instance of the bean.boolean
equals(Object obj)
MarketDataFilter<? extends T,?>
getFilter()
Gets the filter that decides whether the perturbation should be applied to a piece of market data.Class<T>
getMarketDataType()
Gets the type of market data handled by this mapping.ScenarioPerturbation<T>
getPerturbation()
Gets perturbation that should be applied to market data as part of a scenario.int
getScenarioCount()
Returns the number of scenarios for which this mapping can generate data.int
hashCode()
boolean
matches(MarketDataId<?> marketDataId, MarketDataBox<?> marketData, ReferenceData refData)
Returns true if the filter matches the market data ID and value.static PerturbationMapping.Meta
meta()
The meta-bean forPerturbationMapping
.PerturbationMapping.Meta<T>
metaBean()
static <R> PerturbationMapping.Meta<R>
metaPerturbationMapping(Class<R> cls)
The meta-bean forPerturbationMapping
.static <T> PerturbationMapping<T>
of(MarketDataFilter<? extends T,?> filter, ScenarioPerturbation<T> perturbation)
Returns a mapping containing a single perturbation.PerturbationMapping.Builder<T>
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
-
-
-
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 dataperturbation
- 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 datamarketData
- the market data valuerefData
- 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 oftrue
.- Parameters:
marketData
- the market data valuerefData
- 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 forPerturbationMapping
.- Returns:
- the meta-bean, not null
-
metaPerturbationMapping
public static <R> PerturbationMapping.Meta<R> metaPerturbationMapping(Class<R> cls)
The meta-bean forPerturbationMapping
.- 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
-
metaBean
public PerturbationMapping.Meta<T> metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
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
-
-