public class SimpleMovingAverage
extends java.lang.Object
| Constructor and Description |
|---|
SimpleMovingAverage(int count)
Creates a new instance of the SimpleMovingAverage class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int value)
Adds the given value to the moving average.
|
double |
getAverage(double defaultValue)
Gets a value indicating the current moving average.
|
void |
reset()
Clears the SimpleMovingAverage of any data.
|
public SimpleMovingAverage(int count)
count - The maximum number of elements to keep track of.public void add(int value)
value - The value to add.public void reset()
public double getAverage(double defaultValue)
defaultValue - The default value to use.