|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.math3.stat.descriptive.AbstractUnivariateStatistic org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic
public abstract class AbstractStorelessUnivariateStatistic
Abstract implementation of the StorelessUnivariateStatistic
interface.
Provides default evaluate()
and incrementAll(double[])
implementations.
Note that these implementations are not synchronized.
Constructor Summary | |
---|---|
AbstractStorelessUnivariateStatistic()
|
Method Summary | |
---|---|
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 an
AbstractStorelessUnivariateStatistic returning the same
values as this for getResult() and getN() |
double |
evaluate(double[] values)
This default implementation calls clear() , then invokes
increment(double) in a loop over the the input array, and then uses
getResult() to compute the return value. |
double |
evaluate(double[] values,
int begin,
int length)
This default implementation calls clear() , then invokes
increment(double) in a loop over 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. |
Methods inherited from class org.apache.commons.math3.stat.descriptive.AbstractUnivariateStatistic |
---|
evaluate, getData, getDataRef, setData, setData, test, test, test, test |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic |
---|
getN |
Constructor Detail |
---|
public AbstractStorelessUnivariateStatistic()
Method Detail |
---|
public double evaluate(double[] values) throws MathIllegalArgumentException
clear()
, then invokes
increment(double)
in a loop over the the input array, and then uses
getResult()
to compute the return value.
Note that this implementation changes the internal state of the
statistic. Its side effects are the same as invoking clear()
and
then incrementAll(double[])
.
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 UnivariateStatistic
evaluate
in interface MathArrays.Function
evaluate
in class AbstractUnivariateStatistic
values
- input array
MathIllegalArgumentException
- if values is nullUnivariateStatistic.evaluate(double[])
public double evaluate(double[] values, int begin, int length) throws MathIllegalArgumentException
clear()
, then invokes
increment(double)
in a loop over the specified portion of the input
array, and then uses getResult()
to compute the return value.
Note that this implementation changes the internal state of the
statistic. Its side effects are the same as invoking clear()
and
then incrementAll(double[], int, int)
.
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 UnivariateStatistic
evaluate
in interface MathArrays.Function
evaluate
in class AbstractUnivariateStatistic
values
- the input arraybegin
- the index of the first element to includelength
- the number of elements to include
MathIllegalArgumentException
- if the array is null or the indices are not validUnivariateStatistic.evaluate(double[], int, int)
public abstract StorelessUnivariateStatistic copy()
copy
in interface StorelessUnivariateStatistic
copy
in interface UnivariateStatistic
copy
in class AbstractUnivariateStatistic
public abstract void clear()
clear
in interface StorelessUnivariateStatistic
public abstract double getResult()
getResult
in interface StorelessUnivariateStatistic
Double.NaN
if it
has been cleared or just instantiated.public abstract void increment(double d)
increment
in interface StorelessUnivariateStatistic
d
- 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 StorelessUnivariateStatistic
values
- values to add
MathIllegalArgumentException
- 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 StorelessUnivariateStatistic
values
- array holding values to addbegin
- index of the first array element to addlength
- number of array elements to add
MathIllegalArgumentException
- if values is nullStorelessUnivariateStatistic.incrementAll(double[], int, int)
public boolean equals(Object object)
object
is an
AbstractStorelessUnivariateStatistic
returning the same
values as this for getResult()
and getN()
equals
in class Object
object
- object to test equality against.
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |