From 277321564dd18c68fce97594652d5aea50ff221c Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Wed, 6 Jan 2016 12:41:40 +0100 Subject: [PATCH] Fixed syntax incompatible with Java 5. --- .../commons/math4/ode/FieldExpandableODE.java | 2 +- ...actEmbeddedRungeKuttaFieldIntegratorTest.java | 16 ++++++++-------- .../AbstractRungeKuttaFieldIntegratorTest.java | 14 +++++++------- ...tractRungeKuttaFieldStepInterpolatorTest.java | 6 +++--- .../ode/sampling/StepInterpolatorTestUtils.java | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java b/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java index 882f93cb1..2a8d6c0e1 100644 --- a/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java +++ b/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java @@ -92,7 +92,7 @@ public class FieldExpandableODE> { public int addSecondaryEquations(final FieldSecondaryEquations secondary) { components.add(secondary); - mapper = new FieldEquationsMapper<>(mapper, secondary.getDimension()); + mapper = new FieldEquationsMapper(mapper, secondary.getDimension()); return components.size() - 1; diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java index 3f2b0becb..26a73642e 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java @@ -151,7 +151,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { EmbeddedRungeKuttaFieldIntegrator integrator = createIntegrator(field, 0.0, 1.0, 1.0e-10, 1.0e-10); try { - integrator.integrate(new FieldExpandableODE<>(equations), + integrator.integrate(new FieldExpandableODE(equations), new FieldODEState(field.getOne().negate(), MathArrays.buildArray(field, 1)), field.getZero()); @@ -161,7 +161,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { } try { - integrator.integrate(new FieldExpandableODE<>(equations), + integrator.integrate(new FieldExpandableODE(equations), new FieldODEState(field.getZero(), MathArrays.buildArray(field, 1)), field.getOne()); @@ -191,7 +191,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { vecAbsoluteTolerance, vecRelativeTolerance); TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); Assert.fail("an exception should have been thrown"); } @@ -352,7 +352,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { EmbeddedRungeKuttaFieldIntegrator integrator = createIntegrator(field, 0, pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(), new double[4], new double[4]); - integrator.integrate(new FieldExpandableODE<>(pb), + integrator.integrate(new FieldExpandableODE(pb), new FieldODEState(pb.getInitialState().getTime(), MathArrays.buildArray(field, 6)), pb.getFinalTime()); @@ -364,7 +364,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { createIntegrator(field, 0, pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(), new double[2], new double[4]); - integrator.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integrator.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); Assert.fail("an exception should have been thrown"); } catch(DimensionMismatchException ie) { } @@ -373,7 +373,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { createIntegrator(field, 0, pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(), new double[4], new double[4]); - integrator.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getInitialState().getTime()); + integrator.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getInitialState().getTime()); Assert.fail("an exception should have been thrown"); } catch(NumberIsTooSmallException ie) { } @@ -401,7 +401,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { scalRelativeTolerance); TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); Assert.assertEquals(0, handler.getLastError().getReal(), espilonLast); Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue); @@ -424,7 +424,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FieldFirstOrderIntegrator integ = createIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); integ.addStepHandler(new KeplerHandler(pb, epsilon)); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); } private static class KeplerHandler> implements FieldStepHandler { diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java index cc66cd15f..80d6251c3 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java @@ -201,7 +201,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { RungeKuttaFieldIntegrator integrator = createIntegrator(field, field.getZero().add(0.01)); try { TestFieldProblem1 pb = new TestFieldProblem1(field); - integrator.integrate(new FieldExpandableODE<>(pb), + integrator.integrate(new FieldExpandableODE(pb), new FieldODEState(field.getZero(), MathArrays.buildArray(field, pb.getDimension() + 10)), field.getOne()); Assert.fail("an exception should have been thrown"); @@ -209,7 +209,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { } try { TestFieldProblem1 pb = new TestFieldProblem1(field); - integrator.integrate(new FieldExpandableODE<>(pb), + integrator.integrate(new FieldExpandableODE(pb), new FieldODEState(field.getZero(), MathArrays.buildArray(field, pb.getDimension())), field.getZero()); Assert.fail("an exception should have been thrown"); @@ -349,7 +349,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { RungeKuttaFieldIntegrator integ = createIntegrator(field, step); TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); Assert.assertEquals(0, handler.getLastError().getReal(), espilonLast); Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue); @@ -370,7 +370,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { RungeKuttaFieldIntegrator integ = createIntegrator(field, step); integ.addStepHandler(new KeplerHandler(pb, expectedMaxError, epsilon)); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); } private static class KeplerHandler> implements FieldStepHandler { @@ -488,7 +488,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { }; - integ.integrate(new FieldExpandableODE<>(equations), new FieldODEState(t0, y0), t); + integ.integrate(new FieldExpandableODE(equations), new FieldODEState(t0, y0), t); } @@ -502,8 +502,8 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { field.getZero().add(2.0)); RungeKuttaFieldIntegrator integ = createIntegrator(field, field.getZero().add(0.3)); integ.addEventHandler(stepProblem, 1.0, 1.0e-12, 1000); - FieldODEStateAndDerivative result = integ.integrate(new FieldExpandableODE<>(stepProblem), - new FieldODEState<>(field.getZero(), MathArrays.buildArray(field, 1)), + FieldODEStateAndDerivative result = integ.integrate(new FieldExpandableODE(stepProblem), + new FieldODEState(field.getZero(), MathArrays.buildArray(field, 1)), field.getZero().add(10.0)); Assert.assertEquals(8.0, result.getState()[0].getReal(), epsilon); } diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java index 64e91a227..4716b81e7 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java @@ -46,7 +46,7 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest { protected > void doInterpolationAtBounds(final Field field, double epsilon) { RungeKuttaFieldStepInterpolator interpolator = setUpInterpolator(field, - new SinCos<>(field), + new SinCos(field), 0.0, new double[] { 0.0, 1.0 }, 0.125); Assert.assertEquals(0.0, interpolator.getPreviousState().getTime().getReal(), 1.0e-15); @@ -71,7 +71,7 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest { double epsilonSin, double epsilonCos) { RungeKuttaFieldStepInterpolator interpolator = setUpInterpolator(field, - new SinCos<>(field), + new SinCos(field), 0.0, new double[] { 0.0, 1.0 }, 0.0125); int n = 100; @@ -97,7 +97,7 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest { double epsilonSin, double epsilonCos, double epsilonSinDot, double epsilonCosDot) { - FieldFirstOrderDifferentialEquations eqn = new SinCos<>(field); + FieldFirstOrderDifferentialEquations eqn = new SinCos(field); RungeKuttaFieldStepInterpolator fieldInterpolator = setUpInterpolator(field, eqn, 0.0, new double[] { 0.0, 1.0 }, 0.125); RungeKuttaStepInterpolator regularInterpolator = convertInterpolator(fieldInterpolator, eqn); diff --git a/src/test/java/org/apache/commons/math4/ode/sampling/StepInterpolatorTestUtils.java b/src/test/java/org/apache/commons/math4/ode/sampling/StepInterpolatorTestUtils.java index 98d799c58..9798b9d6e 100644 --- a/src/test/java/org/apache/commons/math4/ode/sampling/StepInterpolatorTestUtils.java +++ b/src/test/java/org/apache/commons/math4/ode/sampling/StepInterpolatorTestUtils.java @@ -137,7 +137,7 @@ public class StepInterpolatorTestUtils { }); - integrator.integrate(new FieldExpandableODE<>(problem), problem.getInitialState(), problem.getFinalTime()); + integrator.integrate(new FieldExpandableODE(problem), problem.getInitialState(), problem.getFinalTime()); } }