java.lang.Object
dev.nm.stat.timeseries.datastructure.univariate.realtime.inttime.SimpleTimeSeries
All Implemented Interfaces:
TimeSeries<Integer,Double,IntTimeTimeSeries.Entry>, IntTimeTimeSeries, UnivariateTimeSeries<Integer,IntTimeTimeSeries.Entry>, Iterable<IntTimeTimeSeries.Entry>
Direct Known Subclasses:
AdditiveModel, MultiplicativeModel

public class SimpleTimeSeries extends Object implements IntTimeTimeSeries
This simple univariate time series simply wraps a double[] to form a time series.
  • Constructor Details

    • SimpleTimeSeries

      public SimpleTimeSeries(double[] values)
      Constructs an instance of SimpleTimeSeries.
      Parameters:
      values - an array of values
  • Method Details

    • size

      public int size()
      Description copied from interface: TimeSeries
      Get the length of the time series.
      Specified by:
      size in interface TimeSeries<Integer,Double,IntTimeTimeSeries.Entry>
      Returns:
      the time series length
    • iterator

      public Iterator<IntTimeTimeSeries.Entry> iterator()
      Specified by:
      iterator in interface Iterable<IntTimeTimeSeries.Entry>
    • toArray

      public double[] toArray()
      Description copied from interface: UnivariateTimeSeries
      Convert this time series into an array, discarding the timestamps.
      Specified by:
      toArray in interface UnivariateTimeSeries<Integer,IntTimeTimeSeries.Entry>
      Returns:
      the array representation of the time series
    • get

      public double get(int t)
      Description copied from interface: IntTimeTimeSeries
      Get the value at time t.
      Specified by:
      get in interface IntTimeTimeSeries
      Parameters:
      t - a time index, counting from 1
      Returns:
      the value at time t
    • drop

      public SimpleTimeSeries drop(int nItems)
      Constructs an instance of SimpleTimeSeries by dropping the leading nItems entries.
      Parameters:
      nItems - the number of leading entries to be dropped
      Returns:
      a SimpleTimeSeries
    • diff

      public SimpleTimeSeries diff(int d)
      Constructs an instance of SimpleTimeSeries by taking the first difference d times.
      Parameters:
      d - the number of differences
      Returns:
      diff(x, lag = 1, differences = d) as in DoubleUtils
    • lag

      public SimpleTimeSeries lag(int nLags, int length)
      Constructs an instance of SimpleTimeSeries by lagging the time series. This operation makes sense only for equi-distant data points.
      Parameters:
      nLags - the number of lags
      length - the length of the lagged time series
      Returns:
      a lagged time series
    • lag

      public SimpleTimeSeries lag(int nLags)
      Constructs an instance of SimpleTimeSeries by lagging the time series. This operation makes sense only for equi-distant data points.
      Parameters:
      nLags - the number of lags
      Returns:
      a lagged time series
    • toString

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

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object