|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.limewire.statistic.AbstractStatistic
public abstract class AbstractStatistic
Provides a default implementation of the Statistic interface as an
abstract class. AbstractStatistic tracks the history for the
given statistic, provides access to the average value, the maximum value
and optionally writes values to disk.
Additionally, AbstractStatistic implements Inspectable and
includes a default implementation of inspect() to examine the stored
statistics.
See the Lime Wire Wiki for sample code using the org.limewire.statistic package.
| Field Summary | |
|---|---|
protected Buffer<Double> |
_buffer
IntBuffer for recording stats data -- initialized to an empty buffer until stats are actually recorded. |
protected int |
_current
int for the statistic currently being added to. |
protected double |
_max
The maximum value ever recorded for any time period. |
protected double |
_total
Variable for the total number of messages received for this statistic. |
protected int |
_totalStatsRecorded
The total number of stats recorded. |
| Fields inherited from interface org.limewire.statistic.Statistic |
|---|
HISTORY_LENGTH |
| Constructor Summary | |
|---|---|
AbstractStatistic()
|
|
| 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. |
int |
getCurrent()
Accessor for the current recorded stat value over the most recent time period. |
int |
getLastStored()
Accessor for the most recently recorded stat value. |
double |
getMax()
Accessor for the maximum recorded stat value over all recorded time periods. |
Buffer<Double> |
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. |
protected void |
initializeBuffer()
Constructs the IntBuffer with 0 for all values if it is not already constructed. |
Object |
inspect()
|
void |
storeCurrentStat()
Stores the current set of gathered statistics into the history set, setting the currently recorded data back to zero. |
void |
storeStats(Writer writer)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Buffer<Double> _buffer
protected volatile int _current
protected volatile double _total
protected volatile int _totalStatsRecorded
protected volatile double _max
| Constructor Detail |
|---|
public AbstractStatistic()
| Method Detail |
|---|
public double getTotal()
Statistic
getTotal in interface Statisticpublic double getAverage()
Statistic
getAverage in interface Statisticpublic double getMax()
Statistic
getMax in interface Statisticpublic int getCurrent()
Statistic
getCurrent in interface Statisticpublic int getLastStored()
Statistic
getLastStored in interface Statisticpublic void incrementStat()
Statistic
incrementStat in interface Statisticpublic void addData(int data)
Statistic
addData in interface Statisticdata - the number to increment the current statisticpublic Buffer<Double> getStatHistory()
Statistic
getStatHistory in interface Statisticpublic void clearData()
Statistic
clearData in interface Statisticpublic void storeCurrentStat()
Statistic
storeCurrentStat in interface Statistic
public void storeStats(Writer writer)
throws IOException
storeStats in interface StatisticIOExceptionprotected final void initializeBuffer()
public Object inspect()
inspect in interface Inspectable
|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||