org.opensha.commons.util
Class DataUtils.MinMaxAveTracker

java.lang.Object
  extended by org.opensha.commons.util.DataUtils.MinMaxAveTracker
Enclosing class:
DataUtils

public static class DataUtils.MinMaxAveTracker
extends Object

Class for tracking the minimum and maximum values of a set of data.


Constructor Summary
DataUtils.MinMaxAveTracker()
           
 
Method Summary
 void addValue(double val)
          Add a new value to the tracker.
 double getAverage()
          Computes the average of all values that have been added to this tracker.
 double getMax()
          Returns the maximum value that has been added to this tracker, or negative infinity if no values have been added.
 double getMin()
          Returns the minimum value that has been added to this tracker, or positive infinity if no values have been added.
 int getNum()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataUtils.MinMaxAveTracker

public DataUtils.MinMaxAveTracker()
Method Detail

addValue

public void addValue(double val)
Add a new value to the tracker. Min/Max/Average will be updated.

Parameters:
val - value to be added

getMin

public double getMin()
Returns the minimum value that has been added to this tracker, or positive infinity if no values have been added.

Returns:
minimum value

getMax

public double getMax()
Returns the maximum value that has been added to this tracker, or negative infinity if no values have been added.

Returns:
maximum value

getAverage

public double getAverage()
Computes the average of all values that have been added to this tracker.

Returns:
the average of all values that have been added to this tracker.

getNum

public int getNum()
Returns:
total number of values added to this tracker.

toString

public String toString()
Overrides:
toString in class Object