Class QuoteScenarioArray
- java.lang.Object
-
- com.opengamma.strata.market.observable.QuoteScenarioArray
-
- All Implemented Interfaces:
ScenarioArray<Double>,Serializable,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class QuoteScenarioArray extends Object implements ScenarioArray<Double>, org.joda.beans.ImmutableBean, Serializable
Container for values for an item of quoted market data in multiple scenarios.This class is a more efficient alternative to storing quotes using
MarketDataBox.ofScenarioValuesorScenarioValuesList.It stores the quote values in a primitive double array which reduces memory footprint and avoids the overhead of boxing.
For maximum performance functions can access the array of quotes without boxing or copying via the
quotesproperty. Functions should use aQuoteScenarioArrayIdto request aQuotesArrayfrom the market data container if they need direct access to the array of quotes.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQuoteScenarioArray.MetaThe meta-bean forQuoteScenarioArray.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Doubleget(int scenarioIndex)Gets the value at the specified scenario index.DoubleArraygetQuotes()Gets the values of the quotes.intgetScenarioCount()Gets the number of scenarios.inthashCode()static QuoteScenarioArray.Metameta()The meta-bean forQuoteScenarioArray.QuoteScenarioArray.MetametaBean()static QuoteScenarioArrayof(DoubleArray quotes)Obtains an instance wrapping a set of quotes.Stream<Double>stream()Returns a stream of the values.StringtoString()
-
-
-
Method Detail
-
of
public static QuoteScenarioArray of(DoubleArray quotes)
Obtains an instance wrapping a set of quotes.- Parameters:
quotes- the quotes- Returns:
- an instance wrapping a set of quotes
-
getScenarioCount
public int getScenarioCount()
Description copied from interface:ScenarioArrayGets the number of scenarios.- Specified by:
getScenarioCountin interfaceScenarioArray<Double>- Returns:
- the number of scenarios
-
get
public Double get(int scenarioIndex)
Description copied from interface:ScenarioArrayGets the value at the specified scenario index.- Specified by:
getin interfaceScenarioArray<Double>- Parameters:
scenarioIndex- the zero-based index of the scenario- Returns:
- the value at the specified index
-
stream
public Stream<Double> stream()
Description copied from interface:ScenarioArrayReturns a stream of the values.The stream will return the value for each scenario.
- Specified by:
streamin interfaceScenarioArray<Double>- Returns:
- a stream of the values
-
meta
public static QuoteScenarioArray.Meta meta()
The meta-bean forQuoteScenarioArray.- Returns:
- the meta-bean, not null
-
metaBean
public QuoteScenarioArray.Meta metaBean()
- Specified by:
metaBeanin interfaceorg.joda.beans.Bean
-
getQuotes
public DoubleArray getQuotes()
Gets the values of the quotes.- Returns:
- the value of the property, not null
-
-