public class Stats extends java.lang.Object implements java.io.Serializable, RevisionHandler
Modifier and Type | Field and Description |
---|---|
double |
count
The number of values seen
|
double |
max
The maximum value seen, or Double.NaN if no values seen
|
double |
mean
The mean of values at the last calculateDerived() call
|
double |
min
The minimum value seen, or Double.NaN if no values seen
|
double |
stdDev
The std deviation of values at the last calculateDerived() call
|
double |
sum
The sum of values seen
|
double |
sumSq
The sum of values squared seen
|
Constructor and Description |
---|
Stats() |
Modifier and Type | Method and Description |
---|---|
void |
add(double value)
Adds a value to the observed values
|
void |
add(double value,
double n)
Adds a value that has been seen n times to the observed values
|
void |
calculateDerived()
Tells the object to calculate any statistics that don't have their
values automatically updated during add.
|
java.lang.String |
getRevision()
Returns the revision string.
|
static void |
main(java.lang.String[] args)
Tests the paired stats object from the command line.
|
void |
subtract(double value)
Removes a value to the observed values (no checking is done
that the value being removed was actually added).
|
void |
subtract(double value,
double n)
Subtracts a value that has been seen n times from the observed values
|
java.lang.String |
toString()
Returns a string summarising the stats so far.
|
public double count
public double sum
public double sumSq
public double stdDev
public double mean
public double min
public double max
public void add(double value)
value
- the observed valuepublic void add(double value, double n)
value
- the observed valuen
- the number of times to add valuepublic void subtract(double value)
value
- the observed valuepublic void subtract(double value, double n)
value
- the observed valuen
- the number of times to subtract valuepublic void calculateDerived()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
public static void main(java.lang.String[] args)
args
- ignored.