public interface RunningAverage
Interface for classes that can keep track of a running average of a series of numbers. One can add to or remove from the series, as well as update a datum in the series. The class does not actually keep track of the series of values, just its running average, so it doesn't even matter if you remove/change a value that wasn't added.
| Modifier and Type | Method and Description |
|---|---|
void |
addDatum(double datum) |
void |
changeDatum(double delta) |
double |
getAverage() |
int |
getCount() |
RunningAverage |
inverse() |
void |
removeDatum(double datum) |
void addDatum(double datum)
datum - new item to add to the running averageIllegalArgumentException - if datum is Double.NaNvoid removeDatum(double datum)
datum - item to remove to the running averageIllegalArgumentException - if datum is Double.NaNIllegalStateException - if count is 0void changeDatum(double delta)
delta - amount by which to change a datum in the running averageIllegalArgumentException - if delta is Double.NaNIllegalStateException - if count is 0int getCount()
double getAverage()
RunningAverage inverse()
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.