bcds.tools.stat
Class Average

java.lang.Object
  extended by bcds.tools.stat.CollectorBase
      extended by bcds.tools.stat.SimpleAvg
          extended by bcds.tools.stat.Average
All Implemented Interfaces:
Collector

public class Average
extends SimpleAvg

Implements a collector that produces the following: a) arithmetic mean; b) standard deviation; c) number of observations; d) minimum value; e) maximum value. The class RunningStdDev is used to compute the standard deviation; therefore, the individual observations are never stored.

Author:
Juan Segovia S.

Constructor Summary
Average()
          Default constructor.
Average(java.lang.String name, java.lang.String desc)
          Creates a new collector of the given name.
 
Method Summary
 void collect(double value)
          Registers a new observation: updates the sum and observations counter, determines min and max values and updates the object for obtaining the (running) standard deviation.
 double getMax()
          Returns the maximum value among the observations.
 double getMin()
          Returns the minimum value among the observations.
 double[] getResults()
          Returns the arithmetic mean, the standard deviation, the observations counter, and the min and max values, in that order.
 java.lang.String[] getResultsLabels()
          Returns {"average", "stddev", "count", "min", "max"}.
 double getStdDev()
          Returns the standard deviation of the observations.
 void setup(java.lang.String name, java.lang.String desc)
          Resets this collector.
 
Methods inherited from class bcds.tools.stat.SimpleAvg
getAverage, getCount
 
Methods inherited from class bcds.tools.stat.CollectorBase
equals, getDescription, getName, hashCode, report, report, report, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Average

public Average()
Default constructor.


Average

public Average(java.lang.String name,
               java.lang.String desc)
Creates a new collector of the given name.

Method Detail

setup

public void setup(java.lang.String name,
                  java.lang.String desc)
Resets this collector. The min value is set to +INF and the max to -INF.

Specified by:
setup in interface Collector
Overrides:
setup in class SimpleAvg

collect

public void collect(double value)
Registers a new observation: updates the sum and observations counter, determines min and max values and updates the object for obtaining the (running) standard deviation.

Specified by:
collect in interface Collector
Overrides:
collect in class SimpleAvg

getResults

public double[] getResults()
Returns the arithmetic mean, the standard deviation, the observations counter, and the min and max values, in that order.

Specified by:
getResults in interface Collector
Overrides:
getResults in class SimpleAvg

getResultsLabels

public java.lang.String[] getResultsLabels()
Returns {"average", "stddev", "count", "min", "max"}.

Specified by:
getResultsLabels in interface Collector
Overrides:
getResultsLabels in class SimpleAvg

getMin

public double getMin()
Returns the minimum value among the observations.


getMax

public double getMax()
Returns the maximum value among the observations.


getStdDev

public double getStdDev()
Returns the standard deviation of the observations.