public class SynchronizedSummaryStatistics extends SummaryStatistics
SummaryStatistics that
is safe to use in a multithreaded environment. Multiple threads can safely
operate on a single instance without causing runtime exceptions due to race
conditions. In effect, this implementation makes modification and access
methods atomic operations for a single instance. That is to say, as one
thread is computing a statistic from the instance, no other thread can modify
the instance nor compute another statistic.| Constructor and Description |
|---|
SynchronizedSummaryStatistics()
Construct a SynchronizedSummaryStatistics instance
|
SynchronizedSummaryStatistics(SynchronizedSummaryStatistics original)
A copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addValue(double value)
Add a value to the data
|
void |
clear()
Resets all statistics and storage
|
SynchronizedSummaryStatistics |
copy()
Returns a copy of this SynchronizedSummaryStatistics instance with the
same internal state.
|
static void |
copy(SynchronizedSummaryStatistics source,
SynchronizedSummaryStatistics dest)
Copies source to dest.
|
boolean |
equals(Object object)
Returns true iff
object is a
SummaryStatistics instance and all statistics have the
same values as this. |
StorelessUnivariateStatistic |
getGeoMeanImpl()
Returns the currently configured geometric mean implementation
|
double |
getGeometricMean()
Returns the geometric mean of the values that have been added.
|
double |
getMax()
Returns the maximum of the values that have been added.
|
StorelessUnivariateStatistic |
getMaxImpl()
Returns the currently configured maximum implementation
|
double |
getMean()
Returns the mean of the values that have been added.
|
StorelessUnivariateStatistic |
getMeanImpl()
Returns the currently configured mean implementation
|
double |
getMin()
Returns the minimum of the values that have been added.
|
StorelessUnivariateStatistic |
getMinImpl()
Returns the currently configured minimum implementation
|
long |
getN()
Returns the number of available values
|
double |
getPopulationVariance()
Returns the
population variance of the values that have been added.
|
double |
getQuadraticMean()
Returns the quadratic mean, a.k.a.
|
double |
getStandardDeviation()
Returns the standard deviation of the values that have been added.
|
double |
getSum()
Returns the sum of the values that have been added
|
StorelessUnivariateStatistic |
getSumImpl()
Returns the currently configured Sum implementation
|
StorelessUnivariateStatistic |
getSumLogImpl()
Returns the currently configured sum of logs implementation
|
StatisticalSummary |
getSummary()
Return a
StatisticalSummaryValues instance reporting current
statistics. |
double |
getSumsq()
Returns the sum of the squares of the values that have been added.
|
StorelessUnivariateStatistic |
getSumsqImpl()
Returns the currently configured sum of squares implementation
|
double |
getVariance()
Returns the (sample) variance of the available values.
|
StorelessUnivariateStatistic |
getVarianceImpl()
Returns the currently configured variance implementation
|
int |
hashCode()
Returns hash code based on values of statistics
|
void |
setGeoMeanImpl(StorelessUnivariateStatistic geoMeanImpl)
Sets the implementation for the geometric mean.
|
void |
setMaxImpl(StorelessUnivariateStatistic maxImpl)
Sets the implementation for the maximum.
|
void |
setMeanImpl(StorelessUnivariateStatistic meanImpl)
Sets the implementation for the mean.
|
void |
setMinImpl(StorelessUnivariateStatistic minImpl)
Sets the implementation for the minimum.
|
void |
setSumImpl(StorelessUnivariateStatistic sumImpl)
Sets the implementation for the Sum.
|
void |
setSumLogImpl(StorelessUnivariateStatistic sumLogImpl)
Sets the implementation for the sum of logs.
|
void |
setSumsqImpl(StorelessUnivariateStatistic sumsqImpl)
Sets the implementation for the sum of squares.
|
void |
setVarianceImpl(StorelessUnivariateStatistic varianceImpl)
Sets the implementation for the variance.
|
String |
toString()
Generates a text report displaying summary statistics from values that
have been added.
|
copy, getSecondMoment, getSumOfLogspublic SynchronizedSummaryStatistics()
public SynchronizedSummaryStatistics(SynchronizedSummaryStatistics original) throws NullArgumentException
original.original - the SynchronizedSummaryStatistics instance to copyNullArgumentException - if original is nullpublic StatisticalSummary getSummary()
StatisticalSummaryValues instance reporting current
statistics.getSummary in class SummaryStatisticspublic void addValue(double value)
addValue in class SummaryStatisticsvalue - the value to addpublic long getN()
getN in interface StatisticalSummarygetN in class SummaryStatisticspublic double getSum()
getSum in interface StatisticalSummarygetSum in class SummaryStatisticsDouble.NaN if no values have been addedpublic double getSumsq()
Double.NaN is returned if no values have been added.
getSumsq in class SummaryStatisticspublic double getMean()
Double.NaN is returned if no values have been added.
getMean in interface StatisticalSummarygetMean in class SummaryStatisticspublic double getStandardDeviation()
Double.NaN is returned if no values have been added.
getStandardDeviation in interface StatisticalSummarygetStandardDeviation in class SummaryStatisticspublic double getQuadraticMean()
getQuadraticMean in class SummaryStatisticsDouble.NaN if no values
have been added.public double getVariance()
This method returns the bias-corrected sample variance (using n - 1 in
the denominator). Use SummaryStatistics.getPopulationVariance() for the non-bias-corrected
population variance.
Double.NaN is returned if no values have been added.
getVariance in interface StatisticalSummarygetVariance in class SummaryStatisticspublic double getPopulationVariance()
Double.NaN is returned if no values have been added.
getPopulationVariance in class SummaryStatisticspublic double getMax()
Double.NaN is returned if no values have been added.
getMax in interface StatisticalSummarygetMax in class SummaryStatisticspublic double getMin()
Double.NaN is returned if no values have been added.
getMin in interface StatisticalSummarygetMin in class SummaryStatisticspublic double getGeometricMean()
Double.NaN is returned if no values have been added.
getGeometricMean in class SummaryStatisticspublic String toString()
toString in class SummaryStatisticspublic void clear()
clear in class SummaryStatisticspublic boolean equals(Object object)
object is a
SummaryStatistics instance and all statistics have the
same values as this.equals in class SummaryStatisticsobject - the object to test equality against.public int hashCode()
hashCode in class SummaryStatisticspublic StorelessUnivariateStatistic getSumImpl()
getSumImpl in class SummaryStatisticspublic void setSumImpl(StorelessUnivariateStatistic sumImpl) throws MathIllegalStateException
Sets the implementation for the Sum.
This method cannot be activated after data has been added - i.e.,
after addValue has been used to add data.
If it is activated after data has been added, an IllegalStateException
will be thrown.
setSumImpl in class SummaryStatisticssumImpl - the StorelessUnivariateStatistic instance to use for
computing the SumMathIllegalStateException - if data has already been added (i.e if n >0)public StorelessUnivariateStatistic getSumsqImpl()
getSumsqImpl in class SummaryStatisticspublic void setSumsqImpl(StorelessUnivariateStatistic sumsqImpl) throws MathIllegalStateException
Sets the implementation for the sum of squares.
This method cannot be activated after data has been added - i.e.,
after addValue has been used to add data.
If it is activated after data has been added, an IllegalStateException
will be thrown.
setSumsqImpl in class SummaryStatisticssumsqImpl - the StorelessUnivariateStatistic instance to use for
computing the sum of squaresMathIllegalStateException - if data has already been added (i.e if n > 0)public StorelessUnivariateStatistic getMinImpl()
getMinImpl in class SummaryStatisticspublic void setMinImpl(StorelessUnivariateStatistic minImpl) throws MathIllegalStateException
Sets the implementation for the minimum.
This method cannot be activated after data has been added - i.e.,
after addValue has been used to add data.
If it is activated after data has been added, an IllegalStateException
will be thrown.
setMinImpl in class SummaryStatisticsminImpl - the StorelessUnivariateStatistic instance to use for
computing the minimumMathIllegalStateException - if data has already been added (i.e if n > 0)public StorelessUnivariateStatistic getMaxImpl()
getMaxImpl in class SummaryStatisticspublic void setMaxImpl(StorelessUnivariateStatistic maxImpl) throws MathIllegalStateException
Sets the implementation for the maximum.
This method cannot be activated after data has been added - i.e.,
after addValue has been used to add data.
If it is activated after data has been added, an IllegalStateException
will be thrown.
setMaxImpl in class SummaryStatisticsmaxImpl - the StorelessUnivariateStatistic instance to use for
computing the maximumMathIllegalStateException - if data has already been added (i.e if n > 0)public StorelessUnivariateStatistic getSumLogImpl()
getSumLogImpl in class SummaryStatisticspublic void setSumLogImpl(StorelessUnivariateStatistic sumLogImpl) throws MathIllegalStateException
Sets the implementation for the sum of logs.
This method cannot be activated after data has been added - i.e.,
after addValue has been used to add data.
If it is activated after data has been added, an IllegalStateException
will be thrown.
setSumLogImpl in class SummaryStatisticssumLogImpl - the StorelessUnivariateStatistic instance to use for
computing the log sumMathIllegalStateException - if data has already been added (i.e if n > 0)public StorelessUnivariateStatistic getGeoMeanImpl()
getGeoMeanImpl in class SummaryStatisticspublic void setGeoMeanImpl(StorelessUnivariateStatistic geoMeanImpl) throws MathIllegalStateException
Sets the implementation for the geometric mean.
This method cannot be activated after data has been added - i.e.,
after addValue has been used to add data.
If it is activated after data has been added, an IllegalStateException
will be thrown.
setGeoMeanImpl in class SummaryStatisticsgeoMeanImpl - the StorelessUnivariateStatistic instance to use for
computing the geometric meanMathIllegalStateException - if data has already been added (i.e if n > 0)public StorelessUnivariateStatistic getMeanImpl()
getMeanImpl in class SummaryStatisticspublic void setMeanImpl(StorelessUnivariateStatistic meanImpl) throws MathIllegalStateException
Sets the implementation for the mean.
This method cannot be activated after data has been added - i.e.,
after addValue has been used to add data.
If it is activated after data has been added, an IllegalStateException
will be thrown.
setMeanImpl in class SummaryStatisticsmeanImpl - the StorelessUnivariateStatistic instance to use for
computing the meanMathIllegalStateException - if data has already been added (i.e if n > 0)public StorelessUnivariateStatistic getVarianceImpl()
getVarianceImpl in class SummaryStatisticspublic void setVarianceImpl(StorelessUnivariateStatistic varianceImpl) throws MathIllegalStateException
Sets the implementation for the variance.
This method cannot be activated after data has been added - i.e.,
after addValue has been used to add data.
If it is activated after data has been added, an IllegalStateException
will be thrown.
setVarianceImpl in class SummaryStatisticsvarianceImpl - the StorelessUnivariateStatistic instance to use for
computing the varianceMathIllegalStateException - if data has already been added (i.e if n > 0)public SynchronizedSummaryStatistics copy()
copy in class SummaryStatisticspublic static void copy(SynchronizedSummaryStatistics source, SynchronizedSummaryStatistics dest) throws NullArgumentException
Neither source nor dest can be null.
Acquires synchronization lock on source, then dest before copying.
source - SynchronizedSummaryStatistics to copydest - SynchronizedSummaryStatistics to copy toNullArgumentException - if either source or dest is nullCopyright © 2003–2016 The Apache Software Foundation. All rights reserved.