org.apache.commons.math.stat.descriptive
Class DescriptiveStatisticsImpl

java.lang.Object
  extended byorg.apache.commons.math.stat.descriptive.DescriptiveStatistics
      extended byorg.apache.commons.math.stat.descriptive.DescriptiveStatisticsImpl
All Implemented Interfaces:
Serializable, StatisticalSummary

public class DescriptiveStatisticsImpl
extends DescriptiveStatistics
implements Serializable

Default implementation of DescriptiveStatistics.

Version:
$Revision: 348519 $ $Date: 2005-11-23 12:12:18 -0700 (Wed, 23 Nov 2005) $
See Also:
Serialized Form

Field Summary
protected  ResizableDoubleArray eDA
          Stored data values
protected  int windowSize
          hold the window size
 
Fields inherited from class org.apache.commons.math.stat.descriptive.DescriptiveStatistics
INFINITE_WINDOW
 
Constructor Summary
DescriptiveStatisticsImpl()
          Construct a DescriptiveStatisticsImpl with infinite window
DescriptiveStatisticsImpl(int window)
          Construct a DescriptiveStatisticsImpl with finite window
 
Method Summary
 void addValue(double v)
          Adds the value to the set of numbers
 double apply(UnivariateStatistic stat)
          Apply the given statistic to this univariate collection.
 void clear()
          Resets all statistics and storage
 double getElement(int index)
          Returns the element at the specified index
 long getN()
          Returns the number of available values
 double[] getValues()
          Returns the current set of values in an array of double primitives.
 int getWindowSize()
          Access the window size.
 void setWindowSize(int windowSize)
          WindowSize controls the number of values which contribute to the values returned by Univariate.
 
Methods inherited from class org.apache.commons.math.stat.descriptive.DescriptiveStatistics
getGeometricMean, getKurtosis, getMax, getMean, getMin, getPercentile, getSkewness, getSortedValues, getStandardDeviation, getSum, getSumsq, getVariance, newInstance, newInstance, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

windowSize

protected int windowSize
hold the window size


eDA

protected ResizableDoubleArray eDA
Stored data values

Constructor Detail

DescriptiveStatisticsImpl

public DescriptiveStatisticsImpl()
Construct a DescriptiveStatisticsImpl with infinite window


DescriptiveStatisticsImpl

public DescriptiveStatisticsImpl(int window)
Construct a DescriptiveStatisticsImpl with finite window

Parameters:
window - the finite window size.
Method Detail

getWindowSize

public int getWindowSize()
Access the window size.

Specified by:
getWindowSize in class DescriptiveStatistics
Returns:
the current window size.

getValues

public double[] getValues()
Description copied from class: DescriptiveStatistics
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.

Specified by:
getValues in class DescriptiveStatistics
Returns:
returns the current set of numbers in the order in which they were added to this set
See Also:
DescriptiveStatistics.getValues()

getElement

public double getElement(int index)
Description copied from class: DescriptiveStatistics
Returns the element at the specified index

Specified by:
getElement in class DescriptiveStatistics
Parameters:
index - The Index of the element
Returns:
return the element at the specified index
See Also:
DescriptiveStatistics.getElement(int)

getN

public long getN()
Description copied from class: DescriptiveStatistics
Returns the number of available values

Specified by:
getN in interface StatisticalSummary
Specified by:
getN in class DescriptiveStatistics
Returns:
The number of available values
See Also:
DescriptiveStatistics.getN()

addValue

public void addValue(double v)
Description copied from class: DescriptiveStatistics
Adds the value to the set of numbers

Specified by:
addValue in class DescriptiveStatistics
Parameters:
v - the value to be added
See Also:
DescriptiveStatistics.addValue(double)

clear

public void clear()
Description copied from class: DescriptiveStatistics
Resets all statistics and storage

Specified by:
clear in class DescriptiveStatistics
See Also:
DescriptiveStatistics.clear()

setWindowSize

public void setWindowSize(int windowSize)
Description copied from class: DescriptiveStatistics
WindowSize controls the number of values which contribute to the values returned by Univariate. 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

Specified by:
setWindowSize in class DescriptiveStatistics
Parameters:
windowSize - sets the size of the window.
See Also:
DescriptiveStatistics.setWindowSize(int)

apply

public double apply(UnivariateStatistic stat)
Apply the given statistic to this univariate collection.

Specified by:
apply in class DescriptiveStatistics
Parameters:
stat - the statistic to apply
Returns:
the computed value of the statistic.


Copyright © 2003-2008 The Apache Software Foundation. All Rights Reserved.