Package com.biglybt.core.util.average
Class ExponentialMovingAverage
- java.lang.Object
-
- com.biglybt.core.util.average.ExponentialMovingAverage
-
-
Constructor Summary
Constructors Constructor Description ExponentialMovingAverage(float weight)
Create a new exponential moving average, using the given smoothing rate weight.ExponentialMovingAverage(int periods)
Create a new exponential moving average which smooths over the given number of periods.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getAverage()
Return average-so-far.void
reset()
sets back to start-of-daydouble
update(double newValue)
Update average and return average-so-far.
-
-
-
Constructor Detail
-
ExponentialMovingAverage
public ExponentialMovingAverage(int periods)
Create a new exponential moving average which smooths over the given number of periods.
-
ExponentialMovingAverage
public ExponentialMovingAverage(float weight)
Create a new exponential moving average, using the given smoothing rate weight.
-
-
Method Detail
-
reset
public void reset()
Description copied from interface:Average
sets back to start-of-day
-
update
public double update(double newValue)
Update average and return average-so-far.
-
getAverage
public double getAverage()
Return average-so-far.- Specified by:
getAverage
in interfaceAverage
-
-