T
- type parameter for the calculatorpublic abstract class StatCalculator<T extends Number & Comparable<? super T>> extends Object
Constructor and Description |
---|
StatCalculator(T zero,
T min,
T max)
This constructor is used to set up particular values for the generic class instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addAll(StatCalculator<T> calc) |
void |
addBytes(long newValue)
Add to received bytes
|
void |
addSentBytes(long newValue)
Add to sent bytes
|
void |
addValue(T val)
Add a single value (normally elapsed time)
|
void |
addValue(T val,
long sampleCount)
Update the calculator with the value for an aggregated sample.
|
void |
clear() |
protected abstract T |
divide(T val,
int n) |
protected abstract T |
divide(T val,
long n) |
long |
getCount() |
Map<Number,Number[]> |
getDistribution()
Returns the distribution of the values in the list.
|
T |
getMax() |
double |
getMean() |
T |
getMedian() |
T |
getMin() |
T |
getPercentPoint(double percent)
Get the value which %percent% of the values are less than.
|
T |
getPercentPoint(float percent)
Get the value which %percent% of the values are less than.
|
double |
getStandardDeviation() |
double |
getSum() |
long |
getTotalBytes() |
long |
getTotalSentBytes() |
public StatCalculator(T zero, T min, T max)
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 valuespublic void clear()
public void addBytes(long newValue)
newValue
- number of newly received bytespublic void addSentBytes(long newValue)
newValue
- number of newly sent bytespublic void addAll(StatCalculator<T> calc)
public T getMedian()
public long getTotalBytes()
public long getTotalSentBytes()
public T getPercentPoint(float percent)
percent
- number representing the wished percent (between 0
and 1.0
)public T getPercentPoint(double percent)
percent
- number representing the wished percent (between 0
and 1.0
)public Map<Number,Number[]> getDistribution()
public double getMean()
public double getStandardDeviation()
public T getMin()
public T getMax()
public long getCount()
public double getSum()
public void addValue(T val, long sampleCount)
val
- the aggregate value, normally the elapsed timesampleCount
- the number of samples contributing to the aggregate valuepublic void addValue(T val)
val
- the value to add, which should correspond with a single sampleaddValue(Number, long)
Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.