com.limegroup.gnutella.statistics
Interface Statistic

All Known Implementing Classes:
AbstractStatistic

public interface Statistic

Interface for generalized access to a Statistic.


Field Summary
static int HISTORY_LENGTH
          Constant for the number of records to hold for each statistic.
 
Method Summary
 void addData(int data)
          Add the specified number to the current recording for this statistic.
 void clearData()
          Clears the current data stored in this statistic.
 double getAverage()
          Accessor for the average number of this statistic type received per recording time period.
 double getMax()
          Accessor for the maximum recorded stat value over all recorded time periods.
 IntBuffer getStatHistory()
          Accessor for the Integer array of all statistics recorded over a discrete interval.
 double getTotal()
          Accessor for the total number of this statistic recorded.
 void incrementStat()
          Increments this statistic by one.
 void setWriteStatToFile(boolean write)
          Sets whether or not to write this Statistic out to a file.
 void storeCurrentStat()
          Stores the current set of gathered statistics into the history set, setting the currently recorded data back to zero.
 

Field Detail

HISTORY_LENGTH

public static final int HISTORY_LENGTH
Constant for the number of records to hold for each statistic.

See Also:
Constant Field Values
Method Detail

getTotal

public double getTotal()
Accessor for the total number of this statistic recorded.

Returns:
the total of this statistic recorded, regardless of any time increments

getAverage

public double getAverage()
Accessor for the average number of this statistic type received per recording time period.

Returns:
the average number of this statistic type received per recording time period

getMax

public double getMax()
Accessor for the maximum recorded stat value over all recorded time periods.

Returns:
the maximum recorded stat value over all recorded time periods

incrementStat

public void incrementStat()
Increments this statistic by one.


addData

public void addData(int data)
Add the specified number to the current recording for this statistic. This is the equivalent of calling incrementStat data times.

Parameters:
data - the number to increment the current statistic

getStatHistory

public IntBuffer getStatHistory()
Accessor for the Integer array of all statistics recorded over a discrete interval. Note that this has a finite size, so only a fixed size array will be returned.

Returns:
the Integer array for all statistics recorded for this statistic

clearData

public void clearData()
Clears the current data stored in this statistic. Useful for statistics that want to be analyzed repeatedly in a single session, starting from scratch each time.


storeCurrentStat

public void storeCurrentStat()
Stores the current set of gathered statistics into the history set, setting the currently recorded data back to zero.


setWriteStatToFile

public void setWriteStatToFile(boolean write)
Sets whether or not to write this Statistic out to a file. If it does write to a file, the file name is automatically generated from the name of the class, which should easily label the data. All data is written in comma-delimited format.

Parameters:
write - whether or not to write the data to a file