edu.indiana.util.statistics
Class RunningMean

java.lang.Object
  extended by edu.indiana.util.statistics.RunningMean
All Implemented Interfaces:
RunningAggregate, java.io.Serializable
Direct Known Subclasses:
RunningRoundedMean

public class RunningMean
extends java.lang.Object
implements RunningAggregate

A RunningMean tracks the sum of provided doubles and is prepared to provide the mean. Additional doubles may be added to the sum (and mean calculation) at any time. This class is particularly useful for tracking an aggregate value for an interval variable.

See Also:
Serialized Form

Field Summary
protected  double max
           
protected  double min
           
protected  int numElements
           
protected  double sum
           
 
Constructor Summary
RunningMean()
           
RunningMean(double sum, int numElements)
           
 
Method Summary
 void add(double value)
           
 double calcAggregateValue()
           
 boolean equals(java.lang.Object otherObj)
           
 double getMax()
           
 double getMin()
           
 int hashCode()
           
 void remove(double value)
           
 void reset()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

sum

protected double sum

numElements

protected int numElements

max

protected double max

min

protected double min
Constructor Detail

RunningMean

public RunningMean()

RunningMean

public RunningMean(double sum,
                   int numElements)
Method Detail

add

public void add(double value)
Specified by:
add in interface RunningAggregate

remove

public void remove(double value)
Specified by:
remove in interface RunningAggregate

calcAggregateValue

public double calcAggregateValue()
Specified by:
calcAggregateValue in interface RunningAggregate

reset

public void reset()
Specified by:
reset in interface RunningAggregate

equals

public boolean equals(java.lang.Object otherObj)
Specified by:
equals in interface RunningAggregate
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface RunningAggregate
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getMax

public double getMax()
Specified by:
getMax in interface RunningAggregate

getMin

public double getMin()
Specified by:
getMin in interface RunningAggregate