public abstract class AbstractStorelessUnivariateStatistic extends Object implements StorelessUnivariateStatistic
StorelessUnivariateStatistic interface.
Provides default evaluate(double[],...) and incrementAll(double[])
implementations.
Note that these implementations are not synchronized.
| Constructor and Description |
|---|
AbstractStorelessUnivariateStatistic() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
clear()
Clears the internal state of the Statistic
|
abstract StorelessUnivariateStatistic |
copy()
Returns a copy of the statistic with the same internal state.
|
boolean |
equals(Object object)
Returns true iff
object is the same type of
StorelessUnivariateStatistic (the object's class equals this
instance) returning the same values as this for getResult()
and getN(). |
double |
evaluate(double[] values)
This default implementation creates a copy of this
StorelessUnivariateStatistic
instance, calls clear() on it, then calls incrementAll(double[]) with the specified
portion of the input array, and then uses getResult() to compute the return value. |
double |
evaluate(double[] values,
int begin,
int length)
This default implementation creates a copy of this
StorelessUnivariateStatistic
instance, calls clear() on it, then calls incrementAll(double[]) with the specified
portion of the input array, and then uses getResult() to compute the return value. |
abstract double |
getResult()
Returns the current value of the Statistic.
|
int |
hashCode()
Returns hash code based on getResult() and getN().
|
abstract void |
increment(double d)
Updates the internal state of the statistic to reflect the addition of the new value.
|
void |
incrementAll(double[] values)
This default implementation just calls
increment(double) in a loop over
the input array. |
void |
incrementAll(double[] values,
int begin,
int length)
This default implementation just calls
increment(double) in a loop over
the specified portion of the input array. |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetNpublic AbstractStorelessUnivariateStatistic()
public double evaluate(double[] values)
throws MathIllegalArgumentException
StorelessUnivariateStatistic
instance, calls clear() on it, then calls incrementAll(double[]) with the specified
portion of the input array, and then uses getResult() to compute the return value.
Note that this implementation does not change the internal state of the statistic.
Implementations may override this method with a more efficient and possibly more accurate implementation that works directly with the input array.
If the array is null, a MathIllegalArgumentException is thrown.
evaluate in interface UnivariateStatisticevaluate in interface MathArrays.Functionvalues - input arrayMathIllegalArgumentException - if values is nullUnivariateStatistic.evaluate(double[])public double evaluate(double[] values,
int begin,
int length)
throws MathIllegalArgumentException
StorelessUnivariateStatistic
instance, calls clear() on it, then calls incrementAll(double[]) with the specified
portion of the input array, and then uses getResult() to compute the return value.
Note that this implementation does not change the internal state of the statistic.
Implementations may override this method with a more efficient and possibly more accurate implementation that works directly with the input array.
If the array is null or the index parameters are not valid, an MathIllegalArgumentException is thrown.
evaluate in interface UnivariateStatisticevaluate in interface MathArrays.Functionvalues - the input arraybegin - the index of the first element to includelength - the number of elements to includeMathIllegalArgumentException - if the array is null or the indices are not validUnivariateStatistic.evaluate(double[], int, int)public abstract StorelessUnivariateStatistic copy()
copy in interface StorelessUnivariateStatisticcopy in interface UnivariateStatisticpublic abstract void clear()
clear in interface StorelessUnivariateStatisticpublic abstract double getResult()
getResult in interface StorelessUnivariateStatisticDouble.NaN if it
has been cleared or just instantiated.public abstract void increment(double d)
increment in interface StorelessUnivariateStatisticd - the new value.public void incrementAll(double[] values)
throws MathIllegalArgumentException
increment(double) in a loop over
the input array.
Throws IllegalArgumentException if the input values array is null.
incrementAll in interface StorelessUnivariateStatisticvalues - values to addMathIllegalArgumentException - if values is nullStorelessUnivariateStatistic.incrementAll(double[])public void incrementAll(double[] values,
int begin,
int length)
throws MathIllegalArgumentException
increment(double) in a loop over
the specified portion of the input array.
Throws IllegalArgumentException if the input values array is null.
incrementAll in interface StorelessUnivariateStatisticvalues - array holding values to addbegin - index of the first array element to addlength - number of array elements to addMathIllegalArgumentException - if values is nullStorelessUnivariateStatistic.incrementAll(double[], int, int)public boolean equals(Object object)
object is the same type of
StorelessUnivariateStatistic (the object's class equals this
instance) returning the same values as this for getResult()
and getN().Copyright © 2003–2015 The Apache Software Foundation. All rights reserved.