public class ExponentialMovingAverage
extends java.lang.Object
| Constructor and Description |
|---|
ExponentialMovingAverage(double initialValue,
double newSampleWeight,
boolean logarithmicWeighting)
Creates a new value to track.
|
| Modifier and Type | Method and Description |
|---|---|
double |
addNewSample(double newSample)
Adds a new sample to the moving average and returns the updated value.
|
double |
getCurrentValue()
Returns the current moving average.
|
java.lang.String |
toString() |
public ExponentialMovingAverage(double initialValue,
double newSampleWeight,
boolean logarithmicWeighting)
initialValue - The value to be used as the initial averagenewSampleWeight - The fractional weight to give to new samples. 0.0 - 1.0 (exclusive)logarithmicWeighting - If the samples should be weighted logarithmically to reduce the impact of outliers.public double getCurrentValue()
public double addNewSample(double newSample)
newSample - the new value to be addedpublic java.lang.String toString()
toString in class java.lang.Object