Class ExponentiallyDecayedSum
java.lang.Object
com.illumon.numerics.movingaverages.ExponentiallyDecayedSum
- All Implemented Interfaces:
Serializable
public class ExponentiallyDecayedSum extends Object implements Serializable
A sum where the values are decayed at an exponential rate to zero.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description ExponentiallyDecayedSum(double decayRate, boolean enableTimestepOutOfOrderException)
Creates a new exponentially decayed sum. -
Method Summary
Modifier and Type Method Description long
getLastTimestamp()
double
getValue()
void
processDouble(long timestamp, double data)
void
reset()
-
Constructor Details
-
ExponentiallyDecayedSum
public ExponentiallyDecayedSum(double decayRate, boolean enableTimestepOutOfOrderException)Creates a new exponentially decayed sum.- Parameters:
decayRate
- rate in milliseconds to decay the sum.enableTimestepOutOfOrderException
- true to allow an exception to be thrown when timesteps are not sequential.
-
-
Method Details
-
processDouble
public void processDouble(long timestamp, double data) -
getValue
public double getValue() -
getLastTimestamp
public long getLastTimestamp() -
reset
public void reset()
-