org.apache.commons.math3.stat.descriptive.DescriptiveStatistics 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.
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Hides org. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | SynchronizedDescriptiveStatistics(int
the finite window size. window)Construct an instance with finite window |
| public | SynchronizedDescriptiveStatistics(SynchronizedDescriptiveStatistics
the original)SynchronizedDescriptiveStatistics instance to copyA copy constructor. |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | addValue(double
the value to be added v)Overrides org. Adds the value to the dataset. |
| public synchronized double | apply(UnivariateStatistic
the statistic to apply stat)Overrides org. Apply the given statistic to the data associated with this set of statistics. |
| public synchronized void | clear()
Overrides org. Resets all statistics and storage |
| public synchronized SynchronizedDescriptiveStatistics | Returns: a copy of thisOverrides org. Returns a copy of this SynchronizedDescriptiveStatistics instance with the same internal state. |
| public static void | copy(SynchronizedDescriptiveStatistics
SynchronizedDescriptiveStatistics to copy source, SynchronizedDescriptiveStatistics SynchronizedDescriptiveStatistics to copy to dest)Copies source to dest. |
| public synchronized double | getElement(int
The Index of the element index)Overrides org. Returns the element at the specified index |
| public synchronized long | getN()
Overrides org. Implements org. Returns the number of available values |
| public synchronized double | getQuadraticMean()
Overrides org. Returns the quadratic mean, a.k.a. root-mean-square of the available values |
| public synchronized double | getStandardDeviation()
Overrides org. Implements org. Returns the standard deviation of the available values. |
| public synchronized double[] | getValues()
Overrides org. Returns the current set of values in an array of double primitives. |
| public synchronized int | getWindowSize()
Overrides org. Returns the maximum number of values that can be stored in the dataset, or INFINITE_WINDOW (-1) if there is no limit. |
| public synchronized void | setWindowSize(int
sets the size of the window. windowSize)Overrides org. WindowSize controls the number of values that contribute to the reported statistics. |
| public synchronized String | toString()
Overrides org. Generates a text report displaying univariate statistics from values that have been added. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Serialization UID | |
| SynchronizedDescriptiveStatistics | back to summary |
|---|---|
| public SynchronizedDescriptiveStatistics() Construct an instance with infinite window | |
| SynchronizedDescriptiveStatistics | back to summary |
|---|---|
| public SynchronizedDescriptiveStatistics(int window) throws MathIllegalArgumentException Construct an instance with finite window
| |
| SynchronizedDescriptiveStatistics | back to summary |
|---|---|
| public SynchronizedDescriptiveStatistics(SynchronizedDescriptiveStatistics original) throws NullArgumentException A copy constructor. Creates a deep-copy of the
| |
| addValue | back to summary |
|---|---|
| public synchronized void addValue(double v) Overrides org. Doc from org. Adds the value to the dataset. If the dataset is at the maximum size (i.e., the number of stored elements equals the currently configured windowSize), the first (oldest) element in the dataset is discarded to make room for the new value.
| |
| apply | back to summary |
|---|---|
| public synchronized double apply(UnivariateStatistic stat) Overrides org. Doc from org. Apply the given statistic to the data associated with this set of statistics.
| |
| clear | back to summary |
|---|---|
| public synchronized void clear() Overrides org. Doc from org. Resets all statistics and storage
| |
| copy | back to summary |
|---|---|
| public synchronized SynchronizedDescriptiveStatistics copy() Overrides org. Returns a copy of this SynchronizedDescriptiveStatistics instance with the same internal state.
| |
| copy | back to summary |
|---|---|
| public static void copy(SynchronizedDescriptiveStatistics source, SynchronizedDescriptiveStatistics dest) throws NullArgumentException Copies source to dest. Neither source nor dest can be null. Acquires synchronization lock on source, then dest before copying.
| |
| getElement | back to summary |
|---|---|
| public synchronized double getElement(int index) Overrides org. Doc from org. Returns the element at the specified index
| |
| getN | back to summary |
|---|---|
| public synchronized long getN() Overrides org. Implements org. Doc from org. Returns the number of available values
| |
| getQuadraticMean | back to summary |
|---|---|
| public synchronized double getQuadraticMean() Overrides org. Doc from org. Returns the quadratic mean, a.k.a. root-mean-square of the available values
| |
| getStandardDeviation | back to summary |
|---|---|
| public synchronized double getStandardDeviation() Overrides org. Implements org. Doc from org. Returns the standard deviation of the available values.
| |
| getValues | back to summary |
|---|---|
| public synchronized double[] getValues() Overrides org. Doc from org. Returns the current set of values in an array of double primitives. The order of addition is preserved. The returned array is a fresh copy of the underlying data -- i.e., it is not a reference to the stored data.
| |
| getWindowSize | back to summary |
|---|---|
| public synchronized int getWindowSize() Overrides org. Doc from org. Returns the maximum number of values that can be stored in the dataset, or INFINITE_WINDOW (-1) if there is no limit.
| |
| setWindowSize | back to summary |
|---|---|
| public synchronized void setWindowSize(int windowSize) throws MathIllegalArgumentException Overrides org. Doc from org. WindowSize controls the number of values that contribute to the
reported statistics. For example, if windowSize is set to 3 and the
values {1,2,3,4,5} have been added in that order then
the available values are {3,4,5} and all reported statistics will
be based on these values. If
| |
| toString | back to summary |
|---|---|
| public synchronized String toString() Overrides org. Doc from org. Generates a text report displaying univariate statistics from values that have been added. Each statistic is displayed on a separate line. | |