Class TimestampSet

    • Constructor Detail

      • TimestampSet

        public TimestampSet()
        Default constructor.

        The set is empty with zero capacity.

      • TimestampSet

        public TimestampSet​(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
      • TimestampSet

        public TimestampSet​(double[] arr)
        Constructor with an initial timestamp set.

        The given array must be sorted and contain no duplicates.

        Parameters:
        arr - initial set content
    • Method Detail

      • add

        public boolean add​(Double timestamp)
        Description copied from interface: TimeSet
        Adds key to this set.
        Specified by:
        add in interface TimeSet<Double>
        Parameters:
        timestamp - key
        Returns:
        true if added, false otherwise
      • remove

        public boolean remove​(Double timestamp)
        Description copied from interface: TimeSet
        Removes key from this set.
        Specified by:
        remove in interface TimeSet<Double>
        Parameters:
        timestamp - key
        Returns:
        true if removed, false otherwise
      • size

        public int size()
        Description copied from interface: TimeSet
        Returns the size of this set.
        Specified by:
        size in interface TimeSet<Double>
        Returns:
        the number of elements in this set
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: TimeSet
        Returns true if this set is empty.
        Specified by:
        isEmpty in interface TimeSet<Double>
        Returns:
        true if empty, false otherwise
      • getMax

        public Double getMax()
        Description copied from interface: TimeSet
        Returns the maximum key in the set
        Specified by:
        getMax in interface TimeSet<Double>
        Returns:
        maximum key, or null if the set is empty.
      • getMin

        public Double getMin()
        Description copied from interface: TimeSet
        Returns the minimum key in the set
        Specified by:
        getMin in interface TimeSet<Double>
        Returns:
        minimum key, or null if the set is empty.
      • getMaxDouble

        public Double getMaxDouble()
        Description copied from interface: TimeSet
        Returns the maximum timestamp in the set
        Specified by:
        getMaxDouble in interface TimeSet<Double>
        Returns:
        maximum timestamp, or null if the set is empty.
      • getMinDouble

        public Double getMinDouble()
        Description copied from interface: TimeSet
        Returns the minimum timestamp in the set
        Specified by:
        getMinDouble in interface TimeSet<Double>
        Returns:
        minimum timestamp, or null if the set is empty.
      • contains

        public boolean contains​(Double timestamp)
        Description copied from interface: TimeSet
        Returns true if this set contains key.
        Specified by:
        contains in interface TimeSet<Double>
        Parameters:
        timestamp - key
        Returns:
        true if contains, false otherwise
      • toArray

        public Double[] toArray()
        Description copied from interface: TimeSet
        Returns an array of all keys in this set.

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

        Specified by:
        toArray in interface TimeSet<Double>
        Returns:
        array of all keys
      • toPrimitiveArray

        public double[] toPrimitiveArray()
        Description copied from interface: TimeSet
        Returns the same result as TimeSet.toArray() but in a primitive array if the underlying storage is in a primitive form.
        Specified by:
        toPrimitiveArray in interface TimeSet<Double>
        Returns:
        array of all keys
      • clear

        public void clear()
        Description copied from interface: TimeSet
        Empties this set.
        Specified by:
        clear in interface TimeSet<Double>
      • hashCode

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

        public String toString​(TimeFormat timeFormat,
                               org.joda.time.DateTimeZone timeZone)
        Description copied from interface: TimeSet
        Returns this set as a string.
        Specified by:
        toString in interface TimeSet<Double>
        Parameters:
        timeFormat - time format
        timeZone - time zone
        Returns:
        set as string
      • toString

        public String toString​(TimeFormat timeFormat)
        Description copied from interface: TimeSet
        Returns this set as a string.
        Specified by:
        toString in interface TimeSet<Double>
        Parameters:
        timeFormat - time format
        Returns:
        set as string