Class TimestampMap<T>

    • Constructor Detail

      • TimestampMap

        public TimestampMap()
        Default constructor.

        The map is empty with zero capacity.

      • TimestampMap

        public TimestampMap​(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
    • Method Detail

      • put

        public boolean put​(Double timestamp,
                           T value)
        Description copied from interface: TimeMap
        Put the value at the given key.
        Specified by:
        put in interface TimeMap<Double,​T>
        Parameters:
        timestamp - key
        value - value
        Returns:
        true if key is a new key, false otherwise
      • remove

        public boolean remove​(Double timestamp)
        Description copied from interface: TimeMap
        Remove the value at the given key.
        Specified by:
        remove in interface TimeMap<Double,​T>
        Parameters:
        timestamp - key
        Returns:
        true if the key existed, false otherwise
      • get

        public T get​(Double timestamp,
                     T defaultValue)
        Description copied from interface: TimeMap
        Get the value for the given key.

        Return defaultValue if the value is not found.

        Specified by:
        get in interface TimeMap<Double,​T>
        Parameters:
        timestamp - key
        defaultValue - default value
        Returns:
        found value or the default value if not found
      • get

        public Object get​(Interval interval,
                          Estimator estimator)
        Description copied from interface: TimeMap
        Get the estimated value for the given interval.

        The estimator is used to determine the way multiple interval values are merged together (e.g average, first, median).

        Specified by:
        get in interface TimeMap<Double,​T>
        Parameters:
        interval - interval query
        estimator - estimator used
        Returns:
        estimated value
      • toValuesArray

        public T[] toValuesArray()
        Description copied from interface: TimeMap
        Returns all the values as an array.
        Specified by:
        toValuesArray in interface TimeMap<Double,​T>
        Returns:
        values array
      • getTypeClass

        public abstract Class<T> getTypeClass()
        Description copied from interface: TimeMap
        Returns the value type class.
        Specified by:
        getTypeClass in interface TimeMap<Double,​T>
        Returns:
        type class
      • isSupported

        public abstract boolean isSupported​(Estimator estimator)
        Description copied from interface: TimeMap
        Returns whether estimator is supported.
        Specified by:
        isSupported in interface TimeMap<Double,​T>
        Parameters:
        estimator - estimator
        Returns:
        true if this map supports estimator
      • size

        public int size()
        Description copied from interface: TimeMap
        Returns the size.
        Specified by:
        size in interface TimeMap<Double,​T>
        Returns:
        the number of elements in this map
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: TimeMap
        Returns true if this map is empty.
        Specified by:
        isEmpty in interface TimeMap<Double,​T>
        Returns:
        true if empty, false otherwise
      • contains

        public boolean contains​(Double timestamp)
        Description copied from interface: TimeMap
        Returns true if this map contains the given key.
        Specified by:
        contains in interface TimeMap<Double,​T>
        Parameters:
        timestamp - key
        Returns:
        true if contains, false otherwise
      • getTimestamps

        public double[] getTimestamps()
        Returns an array of all timestamps 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 timestamps
      • toKeysArray

        public Double[] toKeysArray()
        Description copied from interface: TimeMap
        Returns all the keys as an array.
        Specified by:
        toKeysArray in interface TimeMap<Double,​T>
        Returns:
        keys array
      • clear

        public void clear()
        Description copied from interface: TimeMap
        Empties this map.
        Specified by:
        clear in interface TimeMap<Double,​T>
      • hashCode

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

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

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