From 56a6287761d0ca1e8d360bce1765f5ec697e7d04 Mon Sep 17 00:00:00 2001 From: Thomas Neidhart Date: Tue, 29 Dec 2015 20:47:31 +0100 Subject: [PATCH] Fix compilation problems with java 1.5: remove @Override tags for interfaces, fix problem with cast, remove unneeded type parameters in test methods. Additionally, added @Override tags for implemented abstract methods as suggested by eclipse, small typo fixes. --- .../interpolation/MicrosphereProjectionInterpolator.java | 2 -- .../math3/analysis/polynomials/PolynomialsUtils.java | 5 ----- .../math3/dfp/BracketingNthOrderBrentSolverDFP.java | 1 - .../commons/math3/distribution/ZipfDistribution.java | 2 ++ .../math3/fitting/leastsquares/LeastSquaresFactory.java | 1 + .../org/apache/commons/math3/fraction/BigFraction.java | 9 --------- .../math3/geometry/partitioning/RegionFactory.java | 2 +- .../org/apache/commons/math3/ml/neuralnet/MapUtils.java | 1 - .../math3/ml/neuralnet/sofm/KohonenUpdateAction.java | 1 - .../math3/ml/neuralnet/twod/util/QuantizationError.java | 1 - .../commons/math3/ode/nonstiff/AdamsFieldIntegrator.java | 1 - .../math3/ode/nonstiff/AdamsFieldStepInterpolator.java | 1 + .../ode/nonstiff/AdamsNordsieckFieldTransformer.java | 9 +++++---- .../ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java | 3 --- .../ClassicalRungeKuttaFieldStepInterpolator.java | 1 + .../ode/nonstiff/DormandPrince54FieldIntegrator.java | 3 --- .../nonstiff/DormandPrince54FieldStepInterpolator.java | 1 + .../ode/nonstiff/DormandPrince853FieldIntegrator.java | 3 --- .../nonstiff/DormandPrince853FieldStepInterpolator.java | 1 + .../ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java | 1 - .../commons/math3/ode/nonstiff/EulerFieldIntegrator.java | 3 --- .../math3/ode/nonstiff/EulerFieldStepInterpolator.java | 1 + .../commons/math3/ode/nonstiff/GillFieldIntegrator.java | 3 --- .../math3/ode/nonstiff/GillFieldStepInterpolator.java | 1 + .../math3/ode/nonstiff/HighamHall54FieldIntegrator.java | 3 --- .../ode/nonstiff/HighamHall54FieldStepInterpolator.java | 1 + .../math3/ode/nonstiff/LutherFieldIntegrator.java | 3 --- .../math3/ode/nonstiff/LutherFieldStepInterpolator.java | 1 + .../math3/ode/nonstiff/MidpointFieldIntegrator.java | 3 --- .../ode/nonstiff/MidpointFieldStepInterpolator.java | 1 + .../math3/ode/nonstiff/RungeKuttaFieldIntegrator.java | 1 - .../ode/nonstiff/RungeKuttaFieldStepInterpolator.java | 7 ++----- .../math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java | 3 --- .../ode/nonstiff/ThreeEighthesFieldStepInterpolator.java | 1 + .../org/apache/commons/math3/util/IntegerSequence.java | 7 +------ .../org/apache/commons/math3/util/IterationManager.java | 1 - .../MicrosphereProjectionInterpolatorTest.java | 1 - .../commons/math3/distribution/ZipfDistributionTest.java | 2 +- .../AbstractEmbeddedRungeKuttaFieldIntegratorTest.java | 6 +++--- .../nonstiff/AbstractRungeKuttaFieldIntegratorTest.java | 6 +++--- .../math3/ode/nonstiff/EulerFieldIntegratorTest.java | 1 + 41 files changed, 30 insertions(+), 75 deletions(-) diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereProjectionInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereProjectionInterpolator.java index 700b2906f..28f5b26a7 100644 --- a/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereProjectionInterpolator.java +++ b/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereProjectionInterpolator.java @@ -124,7 +124,6 @@ public class MicrosphereProjectionInterpolator * @throws DimensionMismatchException if the space dimension of the * given samples does not match the space dimension of the microsphere. */ - @Override public MultivariateFunction interpolate(final double[][] xval, final double[] yval) throws DimensionMismatchException, @@ -153,7 +152,6 @@ public class MicrosphereProjectionInterpolator return new MultivariateFunction() { /** {inheritDoc} */ - @Override public double value(double[] point) { return m.value(point, xval, diff --git a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java b/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java index d6064330c..bb697b80c 100644 --- a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java +++ b/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java @@ -108,7 +108,6 @@ public class PolynomialsUtils { /** Fixed recurrence coefficients. */ private final BigFraction[] coeffs = { BigFraction.ZERO, BigFraction.TWO, BigFraction.ONE }; /** {@inheritDoc} */ - @Override public BigFraction[] generate(int k) { return coeffs; } @@ -134,7 +133,6 @@ public class PolynomialsUtils { return buildPolynomial(degree, HERMITE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ - @Override public BigFraction[] generate(int k) { return new BigFraction[] { BigFraction.ZERO, @@ -162,7 +160,6 @@ public class PolynomialsUtils { return buildPolynomial(degree, LAGUERRE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ - @Override public BigFraction[] generate(int k) { final int kP1 = k + 1; return new BigFraction[] { @@ -191,7 +188,6 @@ public class PolynomialsUtils { return buildPolynomial(degree, LEGENDRE_COEFFICIENTS, new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ - @Override public BigFraction[] generate(int k) { final int kP1 = k + 1; return new BigFraction[] { @@ -243,7 +239,6 @@ public class PolynomialsUtils { return buildPolynomial(degree, JACOBI_COEFFICIENTS.get(key), new RecurrenceCoefficientsGenerator() { /** {@inheritDoc} */ - @Override public BigFraction[] generate(int k) { k++; final int kvw = k + v + w; diff --git a/src/main/java/org/apache/commons/math3/dfp/BracketingNthOrderBrentSolverDFP.java b/src/main/java/org/apache/commons/math3/dfp/BracketingNthOrderBrentSolverDFP.java index 0c5fa3145..81155d582 100644 --- a/src/main/java/org/apache/commons/math3/dfp/BracketingNthOrderBrentSolverDFP.java +++ b/src/main/java/org/apache/commons/math3/dfp/BracketingNthOrderBrentSolverDFP.java @@ -138,7 +138,6 @@ public class BracketingNthOrderBrentSolverDFP extends FieldBracketingNthOrderBre RealFieldUnivariateFunction fieldF = new RealFieldUnivariateFunction() { /** {@inheritDoc} */ - @Override public Dfp value(final Dfp x) { return f.value(x); } diff --git a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java index 224aad403..88ab4b083 100644 --- a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java +++ b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java @@ -137,6 +137,7 @@ public class ZipfDistribution extends AbstractIntegerDistribution { } /** {@inheritDoc} */ + @Override public double logProbability(int x) { if (x <= 0 || x > numberOfElements) { return Double.NEGATIVE_INFINITY; @@ -277,6 +278,7 @@ public class ZipfDistribution extends AbstractIntegerDistribution { /** * {@inheritDoc} */ + @Override public int sample() { if (sampler == null) { sampler = new ZipfRejectionInversionSampler(numberOfElements, exponent); diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresFactory.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresFactory.java index db1d6ea66..42cdf8974 100644 --- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresFactory.java +++ b/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresFactory.java @@ -228,6 +228,7 @@ public class LeastSquaresFactory { return new LeastSquaresAdapter(problem) { /** {@inheritDoc} */ + @Override public Evaluation evaluate(final RealVector point) { counter.incrementCount(); return super.evaluate(point); diff --git a/src/main/java/org/apache/commons/math3/fraction/BigFraction.java b/src/main/java/org/apache/commons/math3/fraction/BigFraction.java index 92438577c..a297adf6f 100644 --- a/src/main/java/org/apache/commons/math3/fraction/BigFraction.java +++ b/src/main/java/org/apache/commons/math3/fraction/BigFraction.java @@ -517,7 +517,6 @@ public class BigFraction * @return a {@link BigFraction} instance with the resulting values. * @throws NullArgumentException if the {@link BigFraction} is {@code null}. */ - @Override public BigFraction add(final BigFraction fraction) { if (fraction == null) { throw new NullArgumentException(LocalizedFormats.FRACTION); @@ -613,7 +612,6 @@ public class BigFraction * than {@code object}, 0 if they are equal. * @see java.lang.Comparable#compareTo(java.lang.Object) */ - @Override public int compareTo(final BigFraction object) { int lhsSigNum = numerator.signum(); int rhsSigNum = object.numerator.signum(); @@ -693,7 +691,6 @@ public class BigFraction * @throws NullArgumentException if the {@code fraction} is {@code null}. * @throws MathArithmeticException if the fraction to divide by is zero */ - @Override public BigFraction divide(final BigFraction fraction) { if (fraction == null) { throw new NullArgumentException(LocalizedFormats.FRACTION); @@ -921,7 +918,6 @@ public class BigFraction * the {@code int} to multiply by. * @return a {@link BigFraction} instance with the resulting values. */ - @Override public BigFraction multiply(final int i) { if (i == 0 || numerator.signum() == 0) { return ZERO; @@ -958,7 +954,6 @@ public class BigFraction * @return a {@link BigFraction} instance with the resulting values. * @throws NullArgumentException if {@code fraction} is {@code null}. */ - @Override public BigFraction multiply(final BigFraction fraction) { if (fraction == null) { throw new NullArgumentException(LocalizedFormats.FRACTION); @@ -979,7 +974,6 @@ public class BigFraction * * @return the negation of this fraction. */ - @Override public BigFraction negate() { return new BigFraction(numerator.negate(), denominator); } @@ -1096,7 +1090,6 @@ public class BigFraction * * @return the reciprocal fraction. */ - @Override public BigFraction reciprocal() { return new BigFraction(denominator, numerator); } @@ -1179,7 +1172,6 @@ public class BigFraction * @return a {@link BigFraction} instance with the resulting values * @throws NullArgumentException if the {@code fraction} is {@code null}. */ - @Override public BigFraction subtract(final BigFraction fraction) { if (fraction == null) { throw new NullArgumentException(LocalizedFormats.FRACTION); @@ -1227,7 +1219,6 @@ public class BigFraction } /** {@inheritDoc} */ - @Override public BigFractionField getField() { return BigFractionField.getInstance(); } diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/RegionFactory.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/RegionFactory.java index 86605be12..688ffde50 100644 --- a/src/main/java/org/apache/commons/math3/geometry/partitioning/RegionFactory.java +++ b/src/main/java/org/apache/commons/math3/geometry/partitioning/RegionFactory.java @@ -48,7 +48,7 @@ public class RegionFactory { * @param hyperplanes collection of bounding hyperplanes * @return a new convex region, or null if the collection is empty */ - public Region buildConvex(@SuppressWarnings("unchecked") final Hyperplane ... hyperplanes) { + public Region buildConvex(final Hyperplane ... hyperplanes) { if ((hyperplanes == null) || (hyperplanes.length == 0)) { return null; } diff --git a/src/main/java/org/apache/commons/math3/ml/neuralnet/MapUtils.java b/src/main/java/org/apache/commons/math3/ml/neuralnet/MapUtils.java index 7ea2100fc..0b7a67501 100644 --- a/src/main/java/org/apache/commons/math3/ml/neuralnet/MapUtils.java +++ b/src/main/java/org/apache/commons/math3/ml/neuralnet/MapUtils.java @@ -298,7 +298,6 @@ public class MapUtils { static final Comparator COMPARATOR = new Comparator() { /** {@inheritDoc} */ - @Override public int compare(PairNeuronDouble o1, PairNeuronDouble o2) { return Double.compare(o1.value, o2.value); diff --git a/src/main/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenUpdateAction.java b/src/main/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenUpdateAction.java index fb3ec4d74..0618aebf2 100644 --- a/src/main/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenUpdateAction.java +++ b/src/main/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenUpdateAction.java @@ -92,7 +92,6 @@ public class KohonenUpdateAction implements UpdateAction { /** * {@inheritDoc} */ - @Override public void update(Network net, double[] features) { final long numCalls = numberOfCalls.incrementAndGet() - 1; diff --git a/src/main/java/org/apache/commons/math3/ml/neuralnet/twod/util/QuantizationError.java b/src/main/java/org/apache/commons/math3/ml/neuralnet/twod/util/QuantizationError.java index 226447897..8ec1da3a4 100644 --- a/src/main/java/org/apache/commons/math3/ml/neuralnet/twod/util/QuantizationError.java +++ b/src/main/java/org/apache/commons/math3/ml/neuralnet/twod/util/QuantizationError.java @@ -40,7 +40,6 @@ public class QuantizationError implements MapDataVisualization { } /** {@inheritDoc} */ - @Override public double[][] computeImage(NeuronSquareMesh2D map, Iterable data) { final int nR = map.getNumberOfRows(); diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/AdamsFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/AdamsFieldIntegrator.java index 1657ca571..e1f9b6d9a 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/AdamsFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/AdamsFieldIntegrator.java @@ -95,7 +95,6 @@ public abstract class AdamsFieldIntegrator> extend } /** {@inheritDoc} */ - @Override public abstract FieldODEStateAndDerivative integrate(final FieldExpandableODE equations, final FieldODEState initialState, final T finalTime) diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/AdamsFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/AdamsFieldStepInterpolator.java index f49ab1e3b..5de61cc16 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/AdamsFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/AdamsFieldStepInterpolator.java @@ -115,6 +115,7 @@ class AdamsFieldStepInterpolator> extends Abstract * @param newMapper equations mapper for the all equations * @return a new instance */ + @Override protected AdamsFieldStepInterpolator create(boolean newForward, FieldODEStateAndDerivative newGlobalPreviousState, FieldODEStateAndDerivative newGlobalCurrentState, diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/AdamsNordsieckFieldTransformer.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/AdamsNordsieckFieldTransformer.java index 89f83932f..5fa7c7bec 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/AdamsNordsieckFieldTransformer.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/AdamsNordsieckFieldTransformer.java @@ -189,6 +189,7 @@ public class AdamsNordsieckFieldTransformer> { * @return Nordsieck transformer for the specified field and number of steps * @param the type of the field elements */ + @SuppressWarnings("unchecked") public static > AdamsNordsieckFieldTransformer getInstance(final Field field, final int nSteps) { synchronized(CACHE) { @@ -199,13 +200,13 @@ public class AdamsNordsieckFieldTransformer> { AdamsNordsieckFieldTransformer>>(); CACHE.put(nSteps, map); } - @SuppressWarnings("unchecked") - AdamsNordsieckFieldTransformer t = (AdamsNordsieckFieldTransformer) map.get(field); + @SuppressWarnings("rawtypes") // use rawtype to avoid compilation problems with java 1.5 + AdamsNordsieckFieldTransformer t = map.get(field); if (t == null) { t = new AdamsNordsieckFieldTransformer(field, nSteps); - map.put(field, t); + map.put(field, (AdamsNordsieckFieldTransformer) t); } - return t; + return (AdamsNordsieckFieldTransformer) t; } } diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java index d7e5ce1f7..81e6d69d5 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java @@ -62,7 +62,6 @@ public class ClassicalRungeKuttaFieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getC() { final T[] c = MathArrays.buildArray(getField(), 3); c[0] = getField().getOne().multiply(0.5); @@ -72,7 +71,6 @@ public class ClassicalRungeKuttaFieldIntegrator> } /** {@inheritDoc} */ - @Override public T[][] getA() { final T[][] a = MathArrays.buildArray(getField(), 3, -1); for (int i = 0; i < a.length; ++i) { @@ -88,7 +86,6 @@ public class ClassicalRungeKuttaFieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getB() { final T[] b = MathArrays.buildArray(getField(), 4); b[0] = fraction(1, 6); diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java index 9ee4e981e..4ad8f4e88 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java @@ -82,6 +82,7 @@ class ClassicalRungeKuttaFieldStepInterpolator> } /** {@inheritDoc} */ + @Override protected ClassicalRungeKuttaFieldStepInterpolator create(final Field newField, final boolean newForward, final T[][] newYDotK, final FieldODEStateAndDerivative newGlobalPreviousState, final FieldODEStateAndDerivative newGlobalCurrentState, diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java index 4c33c310c..5cdd82853 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldIntegrator.java @@ -130,7 +130,6 @@ public class DormandPrince54FieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getC() { final T[] c = MathArrays.buildArray(getField(), 6); c[0] = fraction(1, 5); @@ -143,7 +142,6 @@ public class DormandPrince54FieldIntegrator> } /** {@inheritDoc} */ - @Override public T[][] getA() { final T[][] a = MathArrays.buildArray(getField(), 6, -1); for (int i = 0; i < a.length; ++i) { @@ -174,7 +172,6 @@ public class DormandPrince54FieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getB() { final T[] b = MathArrays.buildArray(getField(), 7); b[0] = fraction( 35, 384); diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolator.java index 93ad5f367..62a6fa31c 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince54FieldStepInterpolator.java @@ -107,6 +107,7 @@ class DormandPrince54FieldStepInterpolator> } /** {@inheritDoc} */ + @Override protected DormandPrince54FieldStepInterpolator create(final Field newField, final boolean newForward, final T[][] newYDotK, final FieldODEStateAndDerivative newGlobalPreviousState, final FieldODEStateAndDerivative newGlobalCurrentState, diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java index 8ce8573a7..31117564c 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldIntegrator.java @@ -191,7 +191,6 @@ public class DormandPrince853FieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getC() { final T sqrt6 = getField().getOne().multiply(6).sqrt(); @@ -218,7 +217,6 @@ public class DormandPrince853FieldIntegrator> } /** {@inheritDoc} */ - @Override public T[][] getA() { final T sqrt6 = getField().getOne().multiply(6).sqrt(); @@ -371,7 +369,6 @@ public class DormandPrince853FieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getB() { final T[] b = MathArrays.buildArray(getField(), 16); b[ 0] = fraction(104257, 1920240); diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java index 7ba2648b0..c706e2a99 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/DormandPrince853FieldStepInterpolator.java @@ -188,6 +188,7 @@ class DormandPrince853FieldStepInterpolator> } /** {@inheritDoc} */ + @Override protected DormandPrince853FieldStepInterpolator create(final Field newField, final boolean newForward, final T[][] newYDotK, final FieldODEStateAndDerivative newGlobalPreviousState, final FieldODEStateAndDerivative newGlobalCurrentState, diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java index ae8c07413..036cf014c 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java @@ -213,7 +213,6 @@ public abstract class EmbeddedRungeKuttaFieldIntegrator integrate(final FieldExpandableODE equations, final FieldODEState initialState, final T finalTime) throws NumberIsTooSmallException, DimensionMismatchException, diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java index 27cc91367..38516cfad 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java @@ -64,19 +64,16 @@ public class EulerFieldIntegrator> extends RungeKu } /** {@inheritDoc} */ - @Override public T[] getC() { return MathArrays.buildArray(getField(), 0); } /** {@inheritDoc} */ - @Override public T[][] getA() { return MathArrays.buildArray(getField(), 0, 0); } /** {@inheritDoc} */ - @Override public T[] getB() { final T[] b = MathArrays.buildArray(getField(), 1); b[0] = getField().getOne(); diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java index ac6b7c711..0907b8e8e 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java @@ -72,6 +72,7 @@ class EulerFieldStepInterpolator> } /** {@inheritDoc} */ + @Override protected EulerFieldStepInterpolator create(final Field newField, final boolean newForward, final T[][] newYDotK, final FieldODEStateAndDerivative newGlobalPreviousState, final FieldODEStateAndDerivative newGlobalCurrentState, diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java index d9df8073a..d5f7c645b 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldIntegrator.java @@ -62,7 +62,6 @@ public class GillFieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getC() { final T[] c = MathArrays.buildArray(getField(), 3); c[0] = fraction(1, 2); @@ -72,7 +71,6 @@ public class GillFieldIntegrator> } /** {@inheritDoc} */ - @Override public T[][] getA() { final T two = getField().getZero().add(2); @@ -92,7 +90,6 @@ public class GillFieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getB() { final T two = getField().getZero().add(2); diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolator.java index 63dfb0ce9..5639ed586 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/GillFieldStepInterpolator.java @@ -90,6 +90,7 @@ class GillFieldStepInterpolator> } /** {@inheritDoc} */ + @Override protected GillFieldStepInterpolator create(final Field newField, final boolean newForward, final T[][] newYDotK, final FieldODEStateAndDerivative newGlobalPreviousState, final FieldODEStateAndDerivative newGlobalCurrentState, diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java index f79f3d561..d7d6f634d 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldIntegrator.java @@ -105,7 +105,6 @@ public class HighamHall54FieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getC() { final T[] c = MathArrays.buildArray(getField(), 6); c[0] = fraction(2, 9); @@ -118,7 +117,6 @@ public class HighamHall54FieldIntegrator> } /** {@inheritDoc} */ - @Override public T[][] getA() { final T[][] a = MathArrays.buildArray(getField(), 6, -1); for (int i = 0; i < a.length; ++i) { @@ -149,7 +147,6 @@ public class HighamHall54FieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getB() { final T[] b = MathArrays.buildArray(getField(), 7); b[0] = fraction( 1, 12); diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolator.java index 48d6fddde..10240fdbf 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/HighamHall54FieldStepInterpolator.java @@ -58,6 +58,7 @@ class HighamHall54FieldStepInterpolator> } /** {@inheritDoc} */ + @Override protected HighamHall54FieldStepInterpolator create(final Field newField, final boolean newForward, final T[][] newYDotK, final FieldODEStateAndDerivative newGlobalPreviousState, final FieldODEStateAndDerivative newGlobalCurrentState, diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java index ab2305609..7b57b5a17 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegrator.java @@ -71,7 +71,6 @@ public class LutherFieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getC() { final T q = getField().getZero().add(21).sqrt(); final T[] c = MathArrays.buildArray(getField(), 6); @@ -85,7 +84,6 @@ public class LutherFieldIntegrator> } /** {@inheritDoc} */ - @Override public T[][] getA() { final T q = getField().getZero().add(21).sqrt(); final T[][] a = MathArrays.buildArray(getField(), 6, -1); @@ -117,7 +115,6 @@ public class LutherFieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getB() { final T[] b = MathArrays.buildArray(getField(), 7); diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolator.java index 04135f987..9e38a96fe 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/LutherFieldStepInterpolator.java @@ -118,6 +118,7 @@ class LutherFieldStepInterpolator> } /** {@inheritDoc} */ + @Override protected LutherFieldStepInterpolator create(final Field newField, final boolean newForward, final T[][] newYDotK, final FieldODEStateAndDerivative newGlobalPreviousState, final FieldODEStateAndDerivative newGlobalCurrentState, diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java index 72d8db0af..e0dd8cf5c 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldIntegrator.java @@ -59,7 +59,6 @@ public class MidpointFieldIntegrator> extends Rung } /** {@inheritDoc} */ - @Override public T[] getC() { final T[] c = MathArrays.buildArray(getField(), 1); c[0] = getField().getOne().multiply(0.5); @@ -67,7 +66,6 @@ public class MidpointFieldIntegrator> extends Rung } /** {@inheritDoc} */ - @Override public T[][] getA() { final T[][] a = MathArrays.buildArray(getField(), 1, 1); a[0][0] = fraction(1, 2); @@ -75,7 +73,6 @@ public class MidpointFieldIntegrator> extends Rung } /** {@inheritDoc} */ - @Override public T[] getB() { final T[] b = MathArrays.buildArray(getField(), 2); b[0] = getField().getZero(); diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolator.java index 18aa4683e..911e3b22a 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/MidpointFieldStepInterpolator.java @@ -74,6 +74,7 @@ class MidpointFieldStepInterpolator> } /** {@inheritDoc} */ + @Override protected MidpointFieldStepInterpolator create(final Field newField, final boolean newForward, final T[][] newYDotK, final FieldODEStateAndDerivative newGlobalPreviousState, final FieldODEStateAndDerivative newGlobalCurrentState, diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java index 97ba805d1..a97e9f59a 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java @@ -111,7 +111,6 @@ public abstract class RungeKuttaFieldIntegrator> FieldEquationsMapper mapper); /** {@inheritDoc} */ - @Override public FieldODEStateAndDerivative integrate(final FieldExpandableODE equations, final FieldODEState initialState, final T finalTime) throws NumberIsTooSmallException, DimensionMismatchException, diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldStepInterpolator.java index 93a6df7ff..7d92d7864 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldStepInterpolator.java @@ -69,6 +69,7 @@ abstract class RungeKuttaFieldStepInterpolator> } /** {@inheritDoc} */ + @Override protected RungeKuttaFieldStepInterpolator create(boolean newForward, FieldODEStateAndDerivative newGlobalPreviousState, FieldODEStateAndDerivative newGlobalCurrentState, @@ -103,7 +104,6 @@ abstract class RungeKuttaFieldStepInterpolator> * @param coefficients coefficients to apply to the method staged derivatives * @return combined state */ - @SafeVarargs protected final T[] previousStateLinearCombination(final T ... coefficients) { return combine(getPreviousState().getState(), coefficients); @@ -113,7 +113,6 @@ abstract class RungeKuttaFieldStepInterpolator> * @param coefficients coefficients to apply to the method staged derivatives * @return combined state */ - @SuppressWarnings("unchecked") protected T[] currentStateLinearCombination(final T ... coefficients) { return combine(getCurrentState().getState(), coefficients); @@ -123,7 +122,6 @@ abstract class RungeKuttaFieldStepInterpolator> * @param coefficients coefficients to apply to the method staged derivatives * @return combined state */ - @SuppressWarnings("unchecked") protected T[] derivativeLinearCombination(final T ... coefficients) { return combine(MathArrays.buildArray(field, yDotK[0].length), coefficients); } @@ -131,9 +129,8 @@ abstract class RungeKuttaFieldStepInterpolator> /** Linearly combine arrays. * @param a array to add to * @param coefficients coefficients to apply to the method staged derivatives - * @return a itself, as a conveniency for fluent API + * @return a itself, as a convenience for fluent API */ - @SuppressWarnings("unchecked") private T[] combine(final T[] a, final T ... coefficients) { for (int i = 0; i < a.length; ++i) { for (int k = 0; k < coefficients.length; ++k) { diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java index 26691c7d1..7e91de8f3 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldIntegrator.java @@ -61,7 +61,6 @@ public class ThreeEighthesFieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getC() { final T[] c = MathArrays.buildArray(getField(), 3); c[0] = fraction(1, 3); @@ -71,7 +70,6 @@ public class ThreeEighthesFieldIntegrator> } /** {@inheritDoc} */ - @Override public T[][] getA() { final T[][] a = MathArrays.buildArray(getField(), 3, -1); for (int i = 0; i < a.length; ++i) { @@ -87,7 +85,6 @@ public class ThreeEighthesFieldIntegrator> } /** {@inheritDoc} */ - @Override public T[] getB() { final T[] b = MathArrays.buildArray(getField(), 4); b[0] = fraction(1, 8); diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java index 1fac3ce58..14a4eb8bb 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java @@ -84,6 +84,7 @@ class ThreeEighthesFieldStepInterpolator> } /** {@inheritDoc} */ + @Override protected ThreeEighthesFieldStepInterpolator create(final Field newField, final boolean newForward, final T[][] newYDotK, final FieldODEStateAndDerivative newGlobalPreviousState, final FieldODEStateAndDerivative newGlobalCurrentState, diff --git a/src/main/java/org/apache/commons/math3/util/IntegerSequence.java b/src/main/java/org/apache/commons/math3/util/IntegerSequence.java index 10f3a6a6c..7636bbeaa 100644 --- a/src/main/java/org/apache/commons/math3/util/IntegerSequence.java +++ b/src/main/java/org/apache/commons/math3/util/IntegerSequence.java @@ -108,7 +108,6 @@ public class IntegerSequence { } /** {@inheritDoc} */ - @Override public Iterator iterator() { return Incrementor.create() .withStart(start) @@ -130,7 +129,6 @@ public class IntegerSequence { private static final MaxCountExceededCallback CALLBACK = new MaxCountExceededCallback() { /** {@inheritDoc} */ - @Override public void trigger(int max) throws MaxCountExceededException { throw new MaxCountExceededException(max); } @@ -328,7 +326,7 @@ public class IntegerSequence { * {@link MaxCountExceededCallback#trigger(int) trigger} method of the * callback object passed to the * {@link #withCallback(MaxCountExceededCallback)} method. - * If not explictly set, a default callback is used that will throw + * If not explicitly set, a default callback is used that will throw * a {@code MaxCountExceededException}. * * @throws MaxCountExceededException at counter exhaustion, unless a @@ -341,13 +339,11 @@ public class IntegerSequence { } /** {@inheritDoc} */ - @Override public boolean hasNext() { return canIncrement(0); } /** {@inheritDoc} */ - @Override public Integer next() { final int value = count; increment(); @@ -359,7 +355,6 @@ public class IntegerSequence { * * @throws MathUnsupportedOperationException */ - @Override public void remove() { throw new MathUnsupportedOperationException(); } diff --git a/src/main/java/org/apache/commons/math3/util/IterationManager.java b/src/main/java/org/apache/commons/math3/util/IterationManager.java index 4839c96b3..e39094445 100644 --- a/src/main/java/org/apache/commons/math3/util/IterationManager.java +++ b/src/main/java/org/apache/commons/math3/util/IterationManager.java @@ -62,7 +62,6 @@ public class IterationManager { final Incrementor.MaxCountExceededCallback callBack) { this(maxIterations, new IntegerSequence.Incrementor.MaxCountExceededCallback() { /** {@inheritDoc} */ - @Override public void trigger(final int maximalCount) throws MaxCountExceededException { callBack.trigger(maximalCount); } diff --git a/src/test/java/org/apache/commons/math3/analysis/interpolation/MicrosphereProjectionInterpolatorTest.java b/src/test/java/org/apache/commons/math3/analysis/interpolation/MicrosphereProjectionInterpolatorTest.java index 9eeaba4ba..d0281040d 100644 --- a/src/test/java/org/apache/commons/math3/analysis/interpolation/MicrosphereProjectionInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math3/analysis/interpolation/MicrosphereProjectionInterpolatorTest.java @@ -34,7 +34,6 @@ public final class MicrosphereProjectionInterpolatorTest { @Test public void testLinearFunction2D() { MultivariateFunction f = new MultivariateFunction() { - @Override public double value(double[] x) { if (x.length != 2) { throw new IllegalArgumentException(); diff --git a/src/test/java/org/apache/commons/math3/distribution/ZipfDistributionTest.java b/src/test/java/org/apache/commons/math3/distribution/ZipfDistributionTest.java index 93c180eb3..16113a381 100644 --- a/src/test/java/org/apache/commons/math3/distribution/ZipfDistributionTest.java +++ b/src/test/java/org/apache/commons/math3/distribution/ZipfDistributionTest.java @@ -171,7 +171,7 @@ public class ZipfDistributionTest extends IntegerDistributionAbstractTest { public void testSamplerHelper1() { final double tol = 1e-12; final double[] testValues = { - Math.nextUp(-1.), -1e-1, -1e-2, -1e-3, -1e-4, -1e-5, -1e-6, -1e-7, -1e-8, + FastMath.nextUp(-1.), -1e-1, -1e-2, -1e-3, -1e-4, -1e-5, -1e-6, -1e-7, -1e-8, -1e-9, -1e-10, -1e-11, 0., 1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1e0 }; diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java index 8bef0c23f..97458d092 100644 --- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java @@ -460,8 +460,8 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { @Test public abstract void testPartialDerivatives(); - protected > void doTestPartialDerivatives(final double epsilonY, - final double[] epsilonPartials) { + protected void doTestPartialDerivatives(final double epsilonY, + final double[] epsilonPartials) { // parameters indices final int parameters = 5; @@ -496,7 +496,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { } // check derivatives - final double[][] derivatives = sinCos.getDerivatives(t.getReal()); + final double[][] derivatives = sinCos.getDerivatives(t.getReal()); for (int i = 0; i < sinCos.getDimension(); ++i) { for (int parameter = 0; parameter < parameters; ++parameter) { Assert.assertEquals(derivatives[i][parameter], dYdP(result.getState()[i], parameter), epsilonPartials[parameter]); diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java index 3db8f1c78..35cc13d07 100644 --- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java @@ -522,8 +522,8 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { @Test public abstract void testPartialDerivatives(); - protected > void doTestPartialDerivatives(final double epsilonY, - final double[] epsilonPartials) { + protected void doTestPartialDerivatives(final double epsilonY, + final double[] epsilonPartials) { // parameters indices final int parameters = 5; @@ -556,7 +556,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { } // check derivatives - final double[][] derivatives = sinCos.getDerivatives(t.getReal()); + final double[][] derivatives = sinCos.getDerivatives(t.getReal()); for (int i = 0; i < sinCos.getDimension(); ++i) { for (int parameter = 0; parameter < parameters; ++parameter) { Assert.assertEquals(derivatives[i][parameter], diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegratorTest.java index bf886eddd..b3a84882c 100644 --- a/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegratorTest.java @@ -24,6 +24,7 @@ import org.apache.commons.math3.util.Decimal64Field; public class EulerFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest { + @Override protected > RungeKuttaFieldIntegrator createIntegrator(Field field, T step) { return new EulerFieldIntegrator(field, step);