public final class ImmutableScenarioMarketData extends Object implements ScenarioMarketData, org.joda.beans.ImmutableBean, Serializable
This is the standard immutable implementation of ScenarioMarketData
.
Modifier and Type | Class and Description |
---|---|
static class |
ImmutableScenarioMarketData.Meta
The meta-bean for
ImmutableScenarioMarketData . |
Modifier and Type | Method and Description |
---|---|
static ImmutableScenarioMarketDataBuilder |
builder(LocalDate valuationDate)
Creates a mutable builder that can be used to create an instance of the market data.
|
static ImmutableScenarioMarketDataBuilder |
builder(MarketDataBox<LocalDate> valuationDate)
Creates a mutable builder that can be used to create an instance of the market data.
|
ImmutableScenarioMarketData |
combinedWith(ImmutableScenarioMarketData other)
Returns set of market data which combines the data from this set of data with another set.
|
ScenarioMarketData |
combinedWith(ScenarioMarketData other)
Returns set of market data which combines the data from this set of data with another set.
|
boolean |
containsValue(MarketDataId<?> id)
Checks if this market data contains a value for the specified identifier.
|
static ImmutableScenarioMarketData |
empty()
Obtains a market data instance that contains no data and has no scenarios.
|
boolean |
equals(Object obj) |
<T> Set<MarketDataId<T>> |
findIds(MarketDataName<T> name)
Finds the market data identifiers associated with the specified name.
|
<T> Optional<MarketDataBox<T>> |
findValue(MarketDataId<T> id)
Finds the market data value associated with the specified identifier.
|
Set<MarketDataId<?>> |
getIds()
Gets the market data identifiers.
|
int |
getScenarioCount()
Gets the number of scenarios.
|
ImmutableMap<ObservableId,LocalDateDoubleTimeSeries> |
getTimeSeries()
Gets the time-series of market data values.
|
LocalDateDoubleTimeSeries |
getTimeSeries(ObservableId id)
Gets the time-series associated with the specified identifier, empty if not found.
|
Set<ObservableId> |
getTimeSeriesIds()
Gets the time-series identifiers.
|
MarketDataBox<LocalDate> |
getValuationDate()
Gets the valuation date associated with each scenario.
|
<T> MarketDataBox<T> |
getValue(MarketDataId<T> id)
Gets the market data value associated with the specified identifier.
|
ImmutableMap<MarketDataId<?>,MarketDataBox<?>> |
getValues()
Gets the individual items of market data.
|
int |
hashCode() |
static ImmutableScenarioMarketData.Meta |
meta()
The meta-bean for
ImmutableScenarioMarketData . |
ImmutableScenarioMarketData.Meta |
metaBean() |
static ImmutableScenarioMarketData |
of(int scenarioCount,
LocalDate valuationDate,
Map<? extends MarketDataId<?>,MarketDataBox<?>> values,
Map<? extends ObservableId,LocalDateDoubleTimeSeries> timeSeries)
Obtains an instance from a valuation date, map of values and time-series.
|
static ImmutableScenarioMarketData |
of(int scenarioCount,
MarketDataBox<LocalDate> valuationDate,
Map<? extends MarketDataId<?>,MarketDataBox<?>> values,
Map<? extends ObservableId,LocalDateDoubleTimeSeries> timeSeries)
Obtains an instance from a valuation date, map of values and time-series.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getScenarioValue, of, scenario, scenarios, withPerturbation, withValue
public static ImmutableScenarioMarketData of(int scenarioCount, LocalDate valuationDate, Map<? extends MarketDataId<?>,MarketDataBox<?>> values, Map<? extends ObservableId,LocalDateDoubleTimeSeries> timeSeries)
The valuation date and map of values must have the same number of scenarios.
of
in interface ScenarioMarketData
scenarioCount
- the number of scenariosvaluationDate
- the valuation dates associated with all scenariosvalues
- the market data values, one for each scenariotimeSeries
- the time-seriespublic static ImmutableScenarioMarketData of(int scenarioCount, MarketDataBox<LocalDate> valuationDate, Map<? extends MarketDataId<?>,MarketDataBox<?>> values, Map<? extends ObservableId,LocalDateDoubleTimeSeries> timeSeries)
The valuation date and map of values must have the same number of scenarios.
of
in interface ScenarioMarketData
scenarioCount
- the number of scenariosvaluationDate
- the valuation dates associated with the market data, one for each scenariovalues
- the market data values, one for each scenariotimeSeries
- the time-seriespublic static ImmutableScenarioMarketData empty()
empty
in interface ScenarioMarketData
public static ImmutableScenarioMarketDataBuilder builder(LocalDate valuationDate)
valuationDate
- the valuation date associated with the market datapublic static ImmutableScenarioMarketDataBuilder builder(MarketDataBox<LocalDate> valuationDate)
valuationDate
- the valuation dates associated with the market data, one for each scenariopublic boolean containsValue(MarketDataId<?> id)
ScenarioMarketData
containsValue
in interface ScenarioMarketData
id
- the identifier to findpublic <T> MarketDataBox<T> getValue(MarketDataId<T> id)
ScenarioMarketData
The result is a box that provides data for all scenarios. If this market data instance contains the identifier, the value will be returned. Otherwise, an exception will be thrown.
getValue
in interface ScenarioMarketData
T
- the type of the market data valueid
- the identifier to findpublic <T> Optional<MarketDataBox<T>> findValue(MarketDataId<T> id)
ScenarioMarketData
The result is a box that provides data for all scenarios. If this market data instance contains the identifier, the value will be returned. Otherwise, an empty optional will be returned.
findValue
in interface ScenarioMarketData
T
- the type of the market data valueid
- the identifier to findpublic Set<MarketDataId<?>> getIds()
ScenarioMarketData
getIds
in interface ScenarioMarketData
public <T> Set<MarketDataId<T>> findIds(MarketDataName<T> name)
ScenarioMarketData
This returns the unique identifiers that refer to the specified name. There may be more than one identifier associated with a name as the name is not unique.
findIds
in interface ScenarioMarketData
T
- the type of the market data valuename
- the name to findpublic Set<ObservableId> getTimeSeriesIds()
ScenarioMarketData
Time series are not affected by scenarios, therefore there is a single time-series for each identifier which is shared between all scenarios.
getTimeSeriesIds
in interface ScenarioMarketData
public LocalDateDoubleTimeSeries getTimeSeries(ObservableId id)
ScenarioMarketData
Time series are not affected by scenarios, therefore there is a single time-series for each identifier which is shared between all scenarios.
getTimeSeries
in interface ScenarioMarketData
id
- the identifier to findpublic ImmutableScenarioMarketData combinedWith(ImmutableScenarioMarketData other)
If the same item of data is available in both sets, it will be taken from this set.
Both sets of data must contain the same number of scenarios, or one of them must have one scenario. If one of the sets of data has one scenario, the combined set will have the scenario count of the other set.
The valuation dates are taken from this set of data.
other
- another set of market datapublic ScenarioMarketData combinedWith(ScenarioMarketData other)
ScenarioMarketData
If the same item of data is available in both sets, it will be taken from this set.
Both sets of data must contain the same number of scenarios, or one of them must have one scenario. If one of the sets of data has one scenario, the combined set will have the scenario count of the other set.
combinedWith
in interface ScenarioMarketData
other
- another set of market datapublic static ImmutableScenarioMarketData.Meta meta()
ImmutableScenarioMarketData
.public ImmutableScenarioMarketData.Meta metaBean()
metaBean
in interface org.joda.beans.Bean
public int getScenarioCount()
getScenarioCount
in interface ScenarioMarketData
public MarketDataBox<LocalDate> getValuationDate()
getValuationDate
in interface ScenarioMarketData
public ImmutableMap<MarketDataId<?>,MarketDataBox<?>> getValues()
public ImmutableMap<ObservableId,LocalDateDoubleTimeSeries> getTimeSeries()
If a request is made for a time-series that is not in the map, an empty series will be returned.
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.