diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/interpolation/UnivariatePeriodicInterpolator.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/interpolation/UnivariatePeriodicInterpolator.java index ef3122a138..942d055563 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/interpolation/UnivariatePeriodicInterpolator.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/interpolation/UnivariatePeriodicInterpolator.java @@ -114,7 +114,7 @@ public UnivariateFunction interpolate(double[] xval, y[index] = yval[i]; } - SortInPlace.ASCENDING.accept(x, y); + SortInPlace.ASCENDING.apply(x, y); final UnivariateFunction f = interpolator.interpolate(x, y); return new UnivariateFunction() { diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/polynomials/PolynomialFunctionLagrangeForm.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/polynomials/PolynomialFunctionLagrangeForm.java index c0fe244b84..14f94b7c69 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/polynomials/PolynomialFunctionLagrangeForm.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/polynomials/PolynomialFunctionLagrangeForm.java @@ -78,7 +78,7 @@ public PolynomialFunctionLagrangeForm(double x[], double y[]) coefficientsComputed = false; if (!verifyInterpolationArray(x, y, false)) { - SortInPlace.ASCENDING.accept(this.x, this.y); + SortInPlace.ASCENDING.apply(this.x, this.y); // Second check in case some abscissa is duplicated. verifyInterpolationArray(this.x, this.y, true); } @@ -183,7 +183,7 @@ public static double evaluate(double x[], double y[], double z) System.arraycopy(x, 0, xNew, 0, x.length); System.arraycopy(y, 0, yNew, 0, y.length); - SortInPlace.ASCENDING.accept(xNew, yNew); + SortInPlace.ASCENDING.apply(xNew, yNew); // Second check in case some abscissa is duplicated. verifyInterpolationArray(xNew, yNew, true); return evaluateInternal(xNew, yNew, z); diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/polynomials/PolynomialsUtils.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/polynomials/PolynomialsUtils.java index 44da4c1451..6430d3140f 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/polynomials/PolynomialsUtils.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/polynomials/PolynomialsUtils.java @@ -366,7 +366,9 @@ public static double[] shift(final double[] coefficients, private static PolynomialFunction buildPolynomial(final int degree, final List coefficients, final RecurrenceCoefficientsGenerator generator) { - + // Synchronizing on a method parameter is not safe; however, in this + // case, the lock object is an immutable field that belongs to this + // class. synchronized (coefficients) { final int maxDegree = (int) AccurateMath.floor(AccurateMath.sqrt(2 * coefficients.size())) - 1; if (degree > maxDegree) { diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/distribution/EmpiricalDistribution.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/distribution/EmpiricalDistribution.java index c8f5021533..65e580883c 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/distribution/EmpiricalDistribution.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/distribution/EmpiricalDistribution.java @@ -46,40 +46,46 @@ /** *

Represents an - * empirical probability distribution -- a probability distribution derived + * empirical probability distribution: Probability distribution derived * from observed data without making any assumptions about the functional form * of the population distribution that the data come from.

* - *

An EmpiricalDistribution maintains data structures, called - * distribution digests, that describe empirical distributions and - * support the following operations: