Class TimedMovingAverage

java.lang.Object
com.stuypulse.stuylib.streams.numbers.filters.TimedMovingAverage
All Implemented Interfaces:
IFilter

public class TimedMovingAverage extends Object implements IFilter
A Simple Moving Average where instead of averaging the past x values, you average all the values given in the last x seconds.
  • Constructor Details

    • TimedMovingAverage

      public TimedMovingAverage(Number time)
      Make Timed Moving Average with time span
      Parameters:
      time - time span for which to average
  • Method Details

    • get

      public double get(double next)
      Description copied from interface: IFilter
      Get next value in Filter based on the next value given
      Specified by:
      get in interface IFilter
      Parameters:
      next - next input value in the stream
      Returns:
      the output value of the filter