Class TimestampBooleanMap

  • All Implemented Interfaces:
    TimeMap<Double,​Boolean>

    public final class TimestampBooleanMap
    extends TimestampMap<Boolean>
    Sorted map where keys are timestamp indices and values boolean values.
    • Constructor Detail

      • TimestampBooleanMap

        public TimestampBooleanMap()
        Default constructor.

        The map is empty with zero capacity.

      • TimestampBooleanMap

        public TimestampBooleanMap​(int capacity)
        Constructor with capacity.

        Using this constructor can improve performances if the number of timestamps is known in advance as it minimizes array resizes.

        Parameters:
        capacity - timestamp capacity
      • TimestampBooleanMap

        public TimestampBooleanMap​(double[] keys,
                                   boolean[] vals)
        Constructor with an initial timestamp map.

        The keys array must be sorted and contain no duplicates.

        Parameters:
        keys - initial keys content
        vals - initial values content
    • Method Detail

      • getBoolean

        public boolean getBoolean​(double timestamp)
        Get the value for the given timestamp.
        Parameters:
        timestamp - timestamp
        Returns:
        found value or the default value if not found
        Throws:
        IllegalArgumentException - if the element doesn't exist
      • getBoolean

        public boolean getBoolean​(double timestamp,
                                  boolean defaultValue)
        Get the value for the given timestamp.

        Return defaultValue if the value is not found.

        Parameters:
        timestamp - timestamp
        defaultValue - default value
        Returns:
        found value or the default value if not found
      • toBooleanArray

        public boolean[] toBooleanArray()
        Returns an array of all values in this map.

        This method may return a reference to the underlying array so clients should make a copy if the array is written to.

        Returns:
        array of all values