Class Sample<V>


  • public final class Sample<V>
    extends Object
    An immutable object representing a constant value over a given time interval.
    Author:
    Andrea Leofreddi
    • Constructor Detail

      • Sample

        public Sample()
    • Method Detail

      • of

        public static <T> Sample<T> of​(Interval interval,
                                       T value)
        Static factory method to instance a new Sample.
        Type Parameters:
        T - Value Java type
        Parameters:
        interval - Sample interval
        value - Sample value
        Returns:
        The new sample object
      • copyWithInterval

        public Sample<V> copyWithInterval​(Interval newInterval)
        Clone the current Sample into a new one with the same value but different interval.
        Parameters:
        newInterval - The interval of the new sample
        Returns:
        The new sample
      • copyWithValue

        public <T> Sample<T> copyWithValue​(T newValue)
        Clone the current Sample into a new one with the same interval but different value.
        Type Parameters:
        T - Target value Java type
        Parameters:
        newValue - The value of the new sample
        Returns:
        The new sample