org.apache.commons.math.stat.univariate
Class AbstractUnivariateStatistic

java.lang.Object
  extended byorg.apache.commons.math.stat.univariate.AbstractUnivariateStatistic
All Implemented Interfaces:
UnivariateStatistic
Direct Known Subclasses:
AbstractStorelessUnivariateStatistic, Percentile

public abstract class AbstractUnivariateStatistic
extends Object
implements UnivariateStatistic

Abstract Implementation for UnivariateStatistics. Provides the ability to extend polymophically so that indiviual statistics do not need to implement these methods.

Version:
$Revision: 1.10 $ $Date: 2003/11/14 22:22:21 $

Constructor Summary
AbstractUnivariateStatistic()
           
 
Method Summary
 double evaluate(double[] values)
          This implementation provides a simple wrapper around the double[] and passes the request onto the evaluate(DoubleArray da) method.
abstract  double evaluate(double[] values, int begin, int length)
          Subclasses of AbstractUnivariateStatistc need to implement this method.
protected  boolean test(double[] values, int begin, int length)
          this protected test method used by all methods to verify the content of the array and indicies are correct.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractUnivariateStatistic

public AbstractUnivariateStatistic()
Method Detail

evaluate

public double evaluate(double[] values)
This implementation provides a simple wrapper around the double[] and passes the request onto the evaluate(DoubleArray da) method.

Specified by:
evaluate in interface UnivariateStatistic
Parameters:
values - Is a double[] containing the values
Returns:
the result of the evaluation or Double.NaN if the array is empty
See Also:
UnivariateStatistic.evaluate(double[])

evaluate

public abstract double evaluate(double[] values,
                                int begin,
                                int length)
Subclasses of AbstractUnivariateStatistc need to implement this method.

Specified by:
evaluate in interface UnivariateStatistic
Parameters:
values - Is a double[] containing the values
begin - processing at this point in the array
length - processing at this point in the array
Returns:
the result of the evaluation or Double.NaN if the array is empty
See Also:
UnivariateStatistic.evaluate(double[], int, int)

test

protected boolean test(double[] values,
                       int begin,
                       int length)
this protected test method used by all methods to verify the content of the array and indicies are correct.

Parameters:
values - Is a double[] containing the values
begin - processing at this point in the array
length - processing at this point in the array
Returns:
this is used to determine if the array is of 0 length or not, it is used by an individual statistic to determine if continuation of a statistical calculation should continue or return NaN.


Copyright © 2003-2004 Apache Software Foundation. All Rights Reserved.