Class StatCalculator<T extends Number & Comparable<? super T>>
java.lang.Object
org.apache.jorphan.math.StatCalculator<T>
- Type Parameters:
T- type parameter for the calculator
- Direct Known Subclasses:
StatCalculatorInteger, StatCalculatorLong
This class serves as a way to calculate the median, max, min etc. of a list of values.
It is not threadsafe.
-
Constructor Summary
ConstructorsConstructorDescriptionStatCalculator(T zero, T min, T max) This constructor is used to set up particular values for the generic class instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAll(StatCalculator<T> calc) voidaddBytes(long newValue) voidAdd a single value (normally elapsed time)voidUpdate the calculator with the value for an aggregated sample.voidclear()protected abstract Tprotected abstract TlonggetCount()Returns the distribution of the values in the list.getMax()doublegetMean()getMin()getPercentPoint(double percent) Get the value which %percent% of the values are less than.getPercentPoint(float percent) Get the value which %percent% of the values are less than.doubledoublegetSum()long
-
Constructor Details
-
StatCalculator
This constructor is used to set up particular values for the generic class instance.- Parameters:
zero- - value to return for Median and PercentPoint if there are no valuesmin- - value to return for minimum if there are no valuesmax- - value to return for maximum if there are no values
-
-
Method Details
-
clear
public void clear() -
addBytes
public void addBytes(long newValue) -
addAll
-
getMedian
-
getTotalBytes
public long getTotalBytes() -
getPercentPoint
Get the value which %percent% of the values are less than. This works just like median (where median represents the 50% point). A typical desire is to see the 90% point - the value that 90% of the data points are below, the remaining 10% are above.- Parameters:
percent- number representing the wished percent (between0and1.0)- Returns:
- number of values less than the percentage
-
getPercentPoint
Get the value which %percent% of the values are less than. This works just like median (where median represents the 50% point). A typical desire is to see the 90% point - the value that 90% of the data points are below, the remaining 10% are above.- Parameters:
percent- number representing the wished percent (between0and1.0)- Returns:
- the value which %percent% of the values are less than
-
getDistribution
-
getMean
public double getMean() -
getStandardDeviation
public double getStandardDeviation() -
getMin
-
getMax
-
getCount
public long getCount() -
getSum
public double getSum() -
divide
-
divide
-
addValue
Update the calculator with the value for an aggregated sample.- Parameters:
val- the aggregate value, normally the elapsed timesampleCount- the number of samples contributing to the aggregate value
-
addValue
Add a single value (normally elapsed time)- Parameters:
val- the value to add, which should correspond with a single sample- See Also:
-