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.ofScenarioValues
orScenarioValuesList
.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
quotes
property. Functions should use aQuoteScenarioArrayId
to request aQuotesArray
from 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 class
QuoteScenarioArray.Meta
The meta-bean forQuoteScenarioArray
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Double
get(int scenarioIndex)
Gets the value at the specified scenario index.DoubleArray
getQuotes()
Gets the values of the quotes.int
getScenarioCount()
Gets the number of scenarios.int
hashCode()
static QuoteScenarioArray.Meta
meta()
The meta-bean forQuoteScenarioArray
.QuoteScenarioArray.Meta
metaBean()
static QuoteScenarioArray
of(DoubleArray quotes)
Obtains an instance wrapping a set of quotes.Stream<Double>
stream()
Returns a stream of the values.String
toString()
-
-
-
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:ScenarioArray
Gets the number of scenarios.- Specified by:
getScenarioCount
in interfaceScenarioArray<Double>
- Returns:
- the number of scenarios
-
get
public Double get(int scenarioIndex)
Description copied from interface:ScenarioArray
Gets the value at the specified scenario index.- Specified by:
get
in 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:ScenarioArray
Returns a stream of the values.The stream will return the value for each scenario.
- Specified by:
stream
in 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:
metaBean
in interfaceorg.joda.beans.Bean
-
getQuotes
public DoubleArray getQuotes()
Gets the values of the quotes.- Returns:
- the value of the property, not null
-
-