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 TypeMethodDescriptionvoid
add
(double value) Adds a value to the running-sum, also remembering ifvalue
is the minimum or maximum of calls to this method.double
max()
The maximum across allvalue
s passed toadd(double)
orDouble.MIN_VALUE
if the method was never called.double
mean()
Calculates the mean.double
min()
The minimum across allvalue
s passed toadd(double)
orDouble.MAX_VALUE
if 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 ifvalue
is the minimum or maximum of calls to this method.- Parameters:
value
- the value.
-
mean
public double mean()Calculates the mean.- Returns:
- the mean or
NaN
ifadd(double)
was never called.
-
min
public double min()The minimum across allvalue
s passed toadd(double)
orDouble.MAX_VALUE
if the method was never called. -
max
public double max()The maximum across allvalue
s passed toadd(double)
orDouble.MIN_VALUE
if the method was never called.
-