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

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

public abstract class AbstractUnivariateStatistic
extends Object
implements UnivariateStatistic, Serializable

Abstract base class for all implementations of the UnivariateStatistic interface.

Provides a default implementation of evaluate(double[]), delegating to evaluate(double[], int, int) in the natural way.

Also includes a test method that performs generic parameter validation for the evaluate methods.

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

Constructor Summary
AbstractUnivariateStatistic()
           
 
Method Summary
 double evaluate(double[] values)
          Returns the result of evaluating the statistic over the input array.
abstract  double evaluate(double[] values, int begin, int length)
          Returns the result of evaluating the statistic over the specified entries in the input array.
protected  boolean test(double[] values, int begin, int length)
          This method is used by evaluate(double[], int, int) methods to verify that the input parameters designate a subarray of positive length.
 
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)
Description copied from interface: UnivariateStatistic
Returns the result of evaluating the statistic over the input array.

Specified by:
evaluate in interface UnivariateStatistic
Parameters:
values - input array
Returns:
the value of the statistic applied to the input array
See Also:
UnivariateStatistic.evaluate(double[])

evaluate

public abstract double evaluate(double[] values,
                                int begin,
                                int length)
Description copied from interface: UnivariateStatistic
Returns the result of evaluating the statistic over the specified entries in the input array.

Specified by:
evaluate in interface UnivariateStatistic
Parameters:
values - the input array
begin - the index of the first element to include
length - the number of elements to include
Returns:
the value of the statistic applied to the included array entries
See Also:
UnivariateStatistic.evaluate(double[], int, int)

test

protected boolean test(double[] values,
                       int begin,
                       int length)
This method is used by evaluate(double[], int, int) methods to verify that the input parameters designate a subarray of positive length.

Parameters:
values - the input array
begin - index of the first array element to include
length - the number of elements to include
Returns:
true if the parameters are valid and designate a subarray of positive length
Throws:
IllegalArgumentException - if the indices are invalid or the array is null


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