Class RunningSumExtrema
Object
RunningSumExtrema
Like a
RunningSum but also remembers the mean and max across all the added
values.- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double value) Adds a value to the running-sum, also remembering ifvalueis the minimum or maximum of calls to this method.doublemax()The maximum across allvalues passed toadd(double)orDouble.MIN_VALUEif the method was never called.doublemean()Calculates the mean.doublemin()The minimum across allvalues passed toadd(double)orDouble.MAX_VALUEif the method was never called.
-
Constructor Details
-
RunningSumExtrema
public RunningSumExtrema()
-
-
Method Details
-
add
public void add(double value) Adds a value to the running-sum, also remembering ifvalueis the minimum or maximum of calls to this method.- Parameters:
value- the value.
-
mean
public double mean()Calculates the mean.- Returns:
- the mean or
NaNifadd(double)was never called.
-
min
public double min()The minimum across allvalues passed toadd(double)orDouble.MAX_VALUEif the method was never called. -
max
public double max()The maximum across allvalues passed toadd(double)orDouble.MIN_VALUEif the method was never called.
-