Class 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 or ScenarioValuesList.

    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 a QuoteScenarioArrayId to request a QuotesArray from the market data container if they need direct access to the array of quotes.

    See Also:
    Serialized Form
    • 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
      • get

        public Double get​(int scenarioIndex)
        Description copied from interface: ScenarioArray
        Gets the value at the specified scenario index.
        Specified by:
        get in interface ScenarioArray<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 interface ScenarioArray<Double>
        Returns:
        a stream of the values
      • meta

        public static QuoteScenarioArray.Meta meta()
        The meta-bean for QuoteScenarioArray.
        Returns:
        the meta-bean, not null
      • getQuotes

        public DoubleArray getQuotes()
        Gets the values of the quotes.
        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object