private class ValueTest.MovingAverage
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private int |
count
The number of updates.
|
private double |
value
The incrementally updated value.
|
| Modifier | Constructor and Description |
|---|---|
private |
MovingAverage() |
| Modifier and Type | Method and Description |
|---|---|
int |
getCount()
Returns the number of updates.
|
double |
getValue()
Returns the current average.
|
double |
update(double increment)
Updates the currently stored average value by considering
increment as an additional value. |
private double value
private int count
public double update(double increment)
increment as an additional value.increment - the additional valuepublic int getCount()
public double getValue()