net.spy.stat
Class ComputingStat

java.lang.Object
  extended by net.spy.SpyObject
      extended by net.spy.stat.Stat
          extended by net.spy.stat.ComputingStat

public class ComputingStat
extends Stat

Stat implementation that keeps averages and standard deviation and stuff. Basically stole from Scott Lamb's Axomol library.


Constructor Summary
ComputingStat()
           
 
Method Summary
 void add(double value)
          Add the given value to the current stat.
 void clear()
          Clear the stats that have been accumulated so far.
 int getCount()
          Get the number of times a value has been added to this stat.
 double getDecayAvg()
          Get the decaying average of this series.
 double getMax()
          Get the maximum value seen in this stat.
 double getMean()
          Get the average value seen in this stat.
 double getMin()
          Get the minimum value seen in this stat.
 String getStat()
          Get the current value of this stat as a String.
 double getStddev()
          Compute the standard deviation of the current series.
 double getSum()
          Get the sum of all values added to this stat.
 
Methods inherited from class net.spy.stat.Stat
getName, setName, toString
 
Methods inherited from class net.spy.SpyObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComputingStat

public ComputingStat()
Method Detail

clear

public void clear()
Clear the stats that have been accumulated so far.


add

public void add(double value)
Add the given value to the current stat.

Parameters:
value - the value

getStddev

public double getStddev()
Compute the standard deviation of the current series.

Returns:
the stddev or NaN if there aren't enough samples yet

getDecayAvg

public double getDecayAvg()
Get the decaying average of this series.

Returns:
the decaying average, or NaN if there aren't enough samples yet

getStat

public String getStat()
Description copied from class: Stat
Get the current value of this stat as a String.

Specified by:
getStat in class Stat

getMax

public double getMax()
Get the maximum value seen in this stat.


getMean

public double getMean()
Get the average value seen in this stat.


getMin

public double getMin()
Get the minimum value seen in this stat.


getCount

public int getCount()
Get the number of times a value has been added to this stat.


getSum

public double getSum()
Get the sum of all values added to this stat.



Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.