|
ModeShape Distribution 3.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.common.statistic.SimpleStatistics<T>
T
- the number type used in these statistics@ThreadSafe public class SimpleStatistics<T extends Number>
Encapsulation of the statistics for a series of values to which new values are frequently added. The statistics include the
minimum
, maximum
, total (aggregate sum)
, and mean (average)
. See DetailedStatistics
for a subclass that also calculates the median
, standard deviation
and the histogram
of the values.
This class is threadsafe.
Field Summary | |
---|---|
protected MathOperations<T> |
math
|
Constructor Summary | |
---|---|
SimpleStatistics(MathOperations<T> operations)
|
Method Summary | |
---|---|
void |
add(T value)
Add a new value to these statistics. |
protected void |
doAddValue(T value)
A method that can be overridden by subclasses when add is called. |
protected void |
doReset()
Method that can be overridden by subclasses when reset() is called. |
int |
getCount()
Get the number of values that have been measured. |
protected ReadWriteLock |
getLock()
|
MathOperations<T> |
getMathOperations()
|
T |
getMaximum()
Get the maximum value in the series. |
T |
getMean()
Return the approximate mean (average) value represented as an instance of the operand type. |
double |
getMeanValue()
Return the mean (average) value. |
T |
getMinimum()
Get the minimum value in the series. |
T |
getTotal()
Get the aggregate sum of the values in the series. |
void |
reset()
Reset the statistics in this object, and clear out any stored information. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final MathOperations<T extends Number> math
Constructor Detail |
---|
public SimpleStatistics(MathOperations<T> operations)
Method Detail |
---|
public void add(T value)
value
- the new valueprotected void doAddValue(T value)
add
is called. This method is called within the
write lock, and does real work. Therefore, subclasses should call this method when they overwrite it.
value
- the value already addedpublic T getTotal()
count
is 0public T getMaximum()
count
is 0public T getMinimum()
count
is 0public int getCount()
public T getMean()
getMeanValue()
.
count
is 0public double getMeanValue()
count
is 0getMean()
public void reset()
public MathOperations<T> getMathOperations()
protected ReadWriteLock getLock()
protected void doReset()
reset()
is called. This method is called while the object is
locked for write and does work; therefore, the subclass should call this method.
public String toString()
toString
in class Object
|
ModeShape Distribution 3.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |