Class TimedData<T>

  • Type Parameters:
    T - The data value.
    All Implemented Interfaces:
    Supplier<T>, tech.uom.lib.common.function.Nameable
    Direct Known Subclasses:
    TimedQuantityData

    public class TimedData<T>
    extends Object
    implements tech.uom.lib.common.function.Nameable, Supplier<T>
    TimedData is a container for a data value that keeps track of its age. This class keeps track of the birth time of a bit of data, i.e. time the object is instantiated.
    The TimedData MUST be immutable.
    Since:
    1.0
    Version:
    0.7
    Author:
    Werner Keil
    See Also:
    Wikipedia: Time Series
    • Constructor Detail

      • TimedData

        protected TimedData​(T value,
                            long time)
        Construct an instance of TimedData with a value and timestamp.
        Parameters:
        data - The value of the TimedData.
        time - The timestamp of the TimedData.
      • TimedData

        protected TimedData​(T value,
                            long time,
                            String name)
        Construct an instance of TimedData with a value, a timestamp and a name.
        Parameters:
        data - The value of the TimedData.
        time - The timestamp of the TimedData.
        name - The name of the TimedData.
    • Method Detail

      • of

        public static <T> TimedData<T> of​(T val,
                                          long time)
        Returns a TimedData with the specified values.
        Type Parameters:
        T - the class of the value
        Parameters:
        val - The value for the timed data.
        time - The timestamp.
        Returns:
        an TimedData with the given values
      • of

        public static <T> TimedData<T> of​(T val,
                                          long time,
                                          String name)
        Returns a TimedData with the specified values.
        Type Parameters:
        T - the class of the value
        Parameters:
        val - The value for the timed data.
        time - The timestamp.
        name - The name.
        Returns:
        an TimedData with the given values
      • getTimestamp

        public long getTimestamp()
        Returns the time with which this TimedData was created.
        Returns:
        the time of creation
      • getName

        public String getName()
        Specified by:
        getName in interface tech.uom.lib.common.function.Nameable