Package com.comphenix.protocol.timing
Class StatisticsStream
java.lang.Object
com.comphenix.protocol.timing.StatisticsStream
Represents an online algortihm for computing the mean and standard deviation without storing every value.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new stream with no observations.StatisticsStream(StatisticsStream other) Construct a copy of the given stream. -
Method Summary
Modifier and TypeMethodDescriptionadd(StatisticsStream other) Combine the two statistics.intgetCount()Retrieve the number of observations.doubleRetrieve the maximum observation yet observed.doublegetMean()Retrieve the average of all the observations.doubleRetrieve the minimum observation yet observed.doubleRetrieve the standard deviation of all the observations.doubleRetrieve the variance of all the observations.voidobserve(double value) Observe a value.toString()
-
Constructor Details
-
StatisticsStream
public StatisticsStream()Construct a new stream with no observations. -
StatisticsStream
Construct a copy of the given stream.- Parameters:
other- - copy of the stream.
-
-
Method Details
-
observe
public void observe(double value) Observe a value.- Parameters:
value- - the observed value.
-
getMean
public double getMean()Retrieve the average of all the observations.- Returns:
- The average.
-
getVariance
public double getVariance()Retrieve the variance of all the observations.- Returns:
- The variance.
-
getStandardDeviation
public double getStandardDeviation()Retrieve the standard deviation of all the observations.- Returns:
- The STDV.
-
getMinimum
public double getMinimum()Retrieve the minimum observation yet observed.- Returns:
- The minimum observation.
-
getMaximum
public double getMaximum()Retrieve the maximum observation yet observed.- Returns:
- The maximum observation.
-
add
Combine the two statistics.- Parameters:
other- - the other statistics.- Returns:
- Combined statistics
-
getCount
public int getCount()Retrieve the number of observations.- Returns:
- Number of observations.
-
toString
-