/** * Returns true iff <code>object</code> is an * <code>AbstractStorelessUnivariateStatistic</code> returning the same * values as this for <code>getResult()</code> and <code>getN()</code> * @param object object to test equality against. * @return true if object returns the same value as this */ public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof AbstractStorelessUnivariateStatistic == false) { return false; } AbstractStorelessUnivariateStatistic stat = (AbstractStorelessUnivariateStatistic) object; return (MathUtils.equals(stat.getResult(), this.getResult()) && MathUtils.equals(stat.getN(), this.getN())); }
/** * Returns true iff <code>object</code> is an * <code>AbstractStorelessUnivariateStatistic</code> returning the same * values as this for <code>getResult()</code> and <code>getN()</code> * @param object object to test equality against. * @return true if object returns the same value as this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof AbstractStorelessUnivariateStatistic == false) { return false; } AbstractStorelessUnivariateStatistic stat = (AbstractStorelessUnivariateStatistic) object; return MathUtils.equalsIncludingNaN(stat.getResult(), this.getResult()) && MathUtils.equalsIncludingNaN(stat.getN(), this.getN()); }
/** * Returns true iff <code>object</code> is an * <code>AbstractStorelessUnivariateStatistic</code> returning the same * values as this for <code>getResult()</code> and <code>getN()</code> * @param object object to test equality against. * @return true if object returns the same value as this */ @Override public boolean equals(Object object) { if (object == this ) { return true; } if (object instanceof AbstractStorelessUnivariateStatistic == false) { return false; } AbstractStorelessUnivariateStatistic stat = (AbstractStorelessUnivariateStatistic) object; return MathUtils.equals(stat.getResult(), this.getResult()) && MathUtils.equals(stat.getN(), this.getN()); }
/** * Returns hash code based on getResult() and getN() * * @return hash code */ @Override public int hashCode() { return 31* (31 + MathUtils.hash(getResult())) + MathUtils.hash(getN()); }
/** * Returns hash code based on getResult() and getN() * * @return hash code */ public int hashCode() { return 31* (31 + MathUtils.hash(getResult())) + MathUtils.hash(getN()); }
/** * Returns hash code based on getResult() and getN() * * @return hash code */ @Override public int hashCode() { return 31* (31 + MathUtils.hash(getResult())) + MathUtils.hash(getN()); }
/** * This default implementation calls {@link #clear}, then invokes * {@link #increment} in a loop over the specified portion of the input * array, and then uses {@link #getResult} to compute the return value. * <p> * Note that this implementation changes the internal state of the * statistic. Its side effects are the same as invoking {@link #clear} and * then {@link #incrementAll(double[], int, int)}.</p> * <p> * Implementations may override this method with a more efficient and * possibly more accurate implementation that works directly with the * input array.</p> * <p> * If the array is null or the index parameters are not valid, an * IllegalArgumentException is thrown.</p> * @param values the input array * @param begin the index of the first element to include * @param length the number of elements to include * @return the value of the statistic applied to the included array entries * @see org.apache.commons.math.stat.descriptive.UnivariateStatistic#evaluate(double[], int, int) */ @Override public double evaluate(final double[] values, final int begin, final int length) { if (test(values, begin, length)) { clear(); incrementAll(values, begin, length); } return getResult(); }
/** * This default implementation calls {@link #clear}, then invokes * {@link #increment} in a loop over the specified portion of the input * array, and then uses {@link #getResult} to compute the return value. * <p> * Note that this implementation changes the internal state of the * statistic. Its side effects are the same as invoking {@link #clear} and * then {@link #incrementAll(double[], int, int)}.</p> * <p> * Implementations may override this method with a more efficient and * possibly more accurate implementation that works directly with the * input array.</p> * <p> * If the array is null or the index parameters are not valid, an * IllegalArgumentException is thrown.</p> * * @see org.apache.commons.math.stat.descriptive.UnivariateStatistic#evaluate(double[], int, int) */ public double evaluate(final double[] values, final int begin, final int length) { if (test(values, begin, length)) { clear(); incrementAll(values, begin, length); } return getResult(); }
/** * This default implementation calls {@link #clear}, then invokes * {@link #increment} in a loop over the specified portion of the input * array, and then uses {@link #getResult} to compute the return value. * <p> * Note that this implementation changes the internal state of the * statistic. Its side effects are the same as invoking {@link #clear} and * then {@link #incrementAll(double[], int, int)}.</p> * <p> * Implementations may override this method with a more efficient and * possibly more accurate implementation that works directly with the * input array.</p> * <p> * If the array is null or the index parameters are not valid, an * IllegalArgumentException is thrown.</p> * @param values the input array * @param begin the index of the first element to include * @param length the number of elements to include * @return the value of the statistic applied to the included array entries * @see org.apache.commons.math.stat.descriptive.UnivariateStatistic#evaluate(double[], int, int) */ @Override public double evaluate(final double[] values, final int begin, final int length) { if (test(values, begin, length)) { clear(); incrementAll(values, begin, length); } return getResult(); }