public class FixedRunningAverage extends Object implements RunningAverage, Serializable
A simple class that represents a fixed value of an average and count. This is useful
when an API needs to return RunningAverage
but is not in a position to accept
updates to it.
Constructor and Description |
---|
FixedRunningAverage(double average,
int count) |
Modifier and Type | Method and Description |
---|---|
void |
addDatum(double datum) |
void |
changeDatum(double delta) |
double |
getAverage() |
int |
getCount() |
RunningAverage |
inverse() |
void |
removeDatum(double datum) |
String |
toString() |
public void addDatum(double datum)
addDatum
in interface RunningAverage
datum
- new item to add to the running averageUnsupportedOperationException
public void removeDatum(double datum)
removeDatum
in interface RunningAverage
datum
- item to remove to the running averageUnsupportedOperationException
public void changeDatum(double delta)
changeDatum
in interface RunningAverage
delta
- amount by which to change a datum in the running averageUnsupportedOperationException
public int getCount()
getCount
in interface RunningAverage
public double getAverage()
getAverage
in interface RunningAverage
public RunningAverage inverse()
inverse
in interface RunningAverage
Copyright © 2008–2015 The Apache Software Foundation. All rights reserved.