Class QuoteScenarioArray

  • All Implemented Interfaces:
    ScenarioArray<java.lang.Double>, java.io.Serializable, Bean, ImmutableBean

    public final class QuoteScenarioArray
    extends java.lang.Object
    implements ScenarioArray<java.lang.Double>, ImmutableBean, java.io.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
      • getScenarioCount

        public int getScenarioCount()
        Description copied from interface: ScenarioArray
        Gets the number of scenarios.
        Specified by:
        getScenarioCount in interface ScenarioArray<java.lang.Double>
        Returns:
        the number of scenarios
      • get

        public java.lang.Double get​(int scenarioIndex)
        Description copied from interface: ScenarioArray
        Gets the value at the specified scenario index.
        Specified by:
        get in interface ScenarioArray<java.lang.Double>
        Parameters:
        scenarioIndex - the zero-based index of the scenario
        Returns:
        the value at the specified index
      • stream

        public java.util.stream.Stream<java.lang.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<java.lang.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
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object