public class MeanAccumulator extends Object
Accumulate a mean. Only the sum and the item count is stored, not the values themselves.
| Constructor and Description |
|---|
MeanAccumulator()
Construct a new, zeroed average accumulator.
|
MeanAccumulator(double sum,
long count)
Initialize the
MeanAccumulator with a pre-calculated sum and the amount of values included. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(double datum)
Add a new datum to the
MeanAccumulator. |
long |
getCount() |
double |
getMean() |
double |
getTotal()
Get the total of the values accumulated so far.
|
String |
toString() |
public MeanAccumulator()
Construct a new, zeroed average accumulator.
public MeanAccumulator(double sum,
long count)
Initialize the MeanAccumulator with a pre-calculated sum and the amount of values included.
sum - pre-calculated sumcount - amount of values that where used to build this sumpublic void add(double datum)
Add a new datum to the MeanAccumulator.
datum - new datum to include into the average.public double getMean()
public double getTotal()
Get the total of the values accumulated so far.
public long getCount()