Fix null argument check. Fix javadoc error.

This commit is contained in:
aherbert 2021-06-09 16:41:20 +01:00
parent 97080fdc38
commit df117c1e46
1 changed files with 4 additions and 4 deletions

View File

@ -290,7 +290,7 @@ public class Percentile extends AbstractUnivariateStatistic implements Serializa
* If weights have been set, it will compute weighted percentile.
* <p>
* The stored array is the one which was set by previous calls to
* {@link #setData(double[])} or {@link #setData(double[], double[] sampleWeights, int begin, int length)}
* {@link #setData(double[])} or {@link #setData(double[], double[], int, int)}
* </p>
* @param p the percentile value to compute
* @return the value of the statistic applied to the stored data
@ -484,14 +484,14 @@ public class Percentile extends AbstractUnivariateStatistic implements Serializa
*/
public double evaluate(final double[] values, final double[] sampleWeights, final int begin,
final int length, final double p) {
if (values == null || sampleWeights == null) {
throw new MathIllegalArgumentException(LocalizedFormats.NULL_NOT_ALLOWED);
}
/** Check length */
if (values.length != sampleWeights.length) {
throw new MathIllegalArgumentException(LocalizedFormats.LENGTH,
values, sampleWeights);
}
if (values == null || sampleWeights == null) {
throw new MathIllegalArgumentException(LocalizedFormats.NULL_NOT_ALLOWED);
}
MathArrays.verifyValues(values, begin, length);
MathArrays.verifyValues(sampleWeights, begin, length);
MathArrays.checkPositive(sampleWeights);