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 Summary
Constructors
Make Timed Moving Average with time span
-
Method Summary
double
Get next value in Filter based on the next value given
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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