Class Statistic

java.lang.Object
  extended by Statistic

public class Statistic
extends java.lang.Object

Abstract data type to collect values and provide certain statistical properties of the collection.


Constructor Summary
Statistic(String name)
          Constructor
 
Method Summary
 void collect(double value)
          Adds a value to the statistic collection
 int count()
          Retrieves the count of how many values collected so far
 double current()
          Retrieves the most recent value collected
 double highest()
          Retrieves the highest value collected so far
 double lowest()
          Retrieves the lowest value collected so far
 double mean()
          Retrieves the mean (average) of the values collected so far
 String name()
          Retrieves the name given to the Statistic object
 double standardDeviation()
          Retrieves the standard deviation of the values collected so far
 double sum()
          Retrieves the sum of the values collected so far
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Statistic

public Statistic(String name)
Constructor

Parameters:
name - String with descriptive name for this object
Method Detail

name

public String name()
Retrieves the name given to the Statistic object

Returns:
the name as a String

lowest

public double lowest()
Retrieves the lowest value collected so far

Returns:
smallest value

highest

public double highest()
Retrieves the highest value collected so far

Returns:
largest value

current

public double current()
Retrieves the most recent value collected

Returns:
current value

sum

public double sum()
Retrieves the sum of the values collected so far

Returns:
the sum

count

public int count()
Retrieves the count of how many values collected so far

Returns:
the count

mean

public double mean()
Retrieves the mean (average) of the values collected so far

Returns:
the mean

standardDeviation

public double standardDeviation()
Retrieves the standard deviation of the values collected so far

Returns:
the standard deviation

collect

public void collect(double value)
Adds a value to the statistic collection

Parameters:
value - the value to be sampled
Postcondition:
statistic object is updated to reflect addition of new value