Class DoubleScenarioArray
- java.lang.Object
-
- com.opengamma.strata.data.scenario.DoubleScenarioArray
-
- All Implemented Interfaces:
ScenarioArray<Double>
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class DoubleScenarioArray extends Object implements ScenarioArray<Double>, org.joda.beans.ImmutableBean, Serializable
A scenario array holding onedouble
value for each scenario.This contains a list of values, one value for each scenario. The calculation runner will not attempt to convert the currency of the values.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DoubleScenarioArray.Meta
The meta-bean forDoubleScenarioArray
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Double
get(int index)
Gets the value at the specified scenario index.int
getScenarioCount()
Gets the number of scenarios.DoubleArray
getValues()
Gets the calculated values, one per scenario.int
hashCode()
static DoubleScenarioArray.Meta
meta()
The meta-bean forDoubleScenarioArray
.DoubleScenarioArray.Meta
metaBean()
static DoubleScenarioArray
of(int size, IntToDoubleFunction valueFunction)
Obtains an instance using a function to create the entries.static DoubleScenarioArray
of(DoubleArray values)
Obtains an instance from the specified array of values.static DoubleScenarioArray
of(List<Double> values)
Obtains an instance from the specified list of values.Stream<Double>
stream()
Returns a stream of the values.String
toString()
-
-
-
Method Detail
-
of
public static DoubleScenarioArray of(DoubleArray values)
Obtains an instance from the specified array of values.- Parameters:
values
- the values, one value for each scenario- Returns:
- an instance with the specified values
-
of
public static DoubleScenarioArray of(List<Double> values)
Obtains an instance from the specified list of values.- Parameters:
values
- the values, one value for each scenario- Returns:
- an instance with the specified values
-
of
public static DoubleScenarioArray of(int size, IntToDoubleFunction valueFunction)
Obtains an instance using a function to create the entries.The function is passed the scenario index and returns the value for that index.
- Parameters:
size
- the number of elementsvalueFunction
- the function used to obtain each value- Returns:
- an instance initialized using the function
- Throws:
IllegalArgumentException
- is size is zero or less
-
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 index)
Description copied from interface:ScenarioArray
Gets the value at the specified scenario index.- Specified by:
get
in interfaceScenarioArray<Double>
- Parameters:
index
- 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 DoubleScenarioArray.Meta meta()
The meta-bean forDoubleScenarioArray
.- Returns:
- the meta-bean, not null
-
metaBean
public DoubleScenarioArray.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getValues
public DoubleArray getValues()
Gets the calculated values, one per scenario.- Returns:
- the value of the property, not null
-
-