From 6df150da22b4690ae521c6bd1abf10a1ed60c41b Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Tue, 20 Sep 2016 10:30:57 -0700 Subject: [PATCH] Revert "Remove redundant type arguments." This reverts commit 8b5f4535ec5a3983e655e5fc66a90fce657d4344. --- .../analysis/differentiation/DSCompiler.java | 10 +- .../differentiation/SparseGradient.java | 4 +- .../integration/gauss/BaseRuleFactory.java | 8 +- .../gauss/GaussIntegratorFactory.java | 2 +- .../integration/gauss/HermiteRuleFactory.java | 4 +- .../LegendreHighPrecisionRuleFactory.java | 4 +- .../gauss/LegendreRuleFactory.java | 4 +- .../FieldHermiteInterpolator.java | 6 +- .../interpolation/HermiteInterpolator.java | 6 +- .../InterpolatingMicrosphere.java | 6 +- .../polynomials/PolynomialsUtils.java | 12 +- .../apache/commons/math4/complex/Complex.java | 2 +- .../distribution/EnumeratedDistribution.java | 6 +- .../EnumeratedIntegerDistribution.java | 10 +- .../EnumeratedRealDistribution.java | 10 +- ...MixtureMultivariateNormalDistribution.java | 4 +- .../MixtureMultivariateRealDistribution.java | 6 +- ...eNormalMixtureExpectationMaximization.java | 4 +- .../math4/exception/util/ArgUtils.java | 2 +- .../exception/util/ExceptionContext.java | 12 +- .../math4/fitting/GaussianCurveFitter.java | 2 +- .../math4/fitting/HarmonicCurveFitter.java | 2 +- .../math4/fitting/WeightedObservedPoints.java | 4 +- .../leastsquares/GaussNewtonOptimizer.java | 2 +- .../leastsquares/LeastSquaresFactory.java | 2 +- .../genetics/AbstractListChromosome.java | 2 +- .../math4/genetics/BinaryChromosome.java | 2 +- .../math4/genetics/BinaryMutation.java | 2 +- .../math4/genetics/CycleCrossover.java | 8 +- .../math4/genetics/ListPopulation.java | 2 +- .../math4/genetics/NPointCrossover.java | 4 +- .../math4/genetics/OnePointCrossover.java | 4 +- .../math4/genetics/OrderedCrossover.java | 8 +- .../commons/math4/genetics/RandomKey.java | 16 +- .../math4/genetics/RandomKeyMutation.java | 2 +- .../math4/genetics/TournamentSelection.java | 2 +- .../math4/genetics/UniformCrossover.java | 4 +- .../geometry/enclosing/WelzlEncloser.java | 4 +- .../geometry/euclidean/oned/IntervalsSet.java | 22 +- .../euclidean/oned/SubOrientedPoint.java | 6 +- .../euclidean/threed/FieldRotation.java | 40 ++-- .../euclidean/threed/FieldVector3D.java | 42 ++-- .../euclidean/threed/OutlineExtractor.java | 2 +- .../euclidean/threed/PolyhedronsSet.java | 4 +- .../euclidean/threed/SphereGenerator.java | 10 +- .../geometry/euclidean/threed/SubLine.java | 2 +- .../geometry/euclidean/threed/SubPlane.java | 12 +- .../euclidean/twod/DiskGenerator.java | 8 +- .../geometry/euclidean/twod/NestedLoops.java | 8 +- .../geometry/euclidean/twod/PolygonsSet.java | 18 +- .../geometry/euclidean/twod/SubLine.java | 14 +- .../twod/hull/AklToussaintHeuristic.java | 4 +- .../euclidean/twod/hull/ConvexHull2D.java | 2 +- .../euclidean/twod/hull/MonotoneChain.java | 8 +- .../geometry/partitioning/AbstractRegion.java | 26 +- .../partitioning/AbstractSubHyperplane.java | 8 +- .../math4/geometry/partitioning/BSPTree.java | 34 +-- .../partitioning/BoundaryBuilder.java | 12 +- .../partitioning/BoundaryProjector.java | 4 +- .../partitioning/Characterization.java | 4 +- .../math4/geometry/partitioning/NodesSet.java | 2 +- .../geometry/partitioning/RegionFactory.java | 14 +- .../geometry/spherical/oned/ArcsSet.java | 36 +-- .../spherical/oned/SubLimitAngle.java | 4 +- .../geometry/spherical/twod/EdgesBuilder.java | 6 +- .../spherical/twod/PropertiesComputer.java | 2 +- .../spherical/twod/SphericalPolygonsSet.java | 30 +-- .../geometry/spherical/twod/SubCircle.java | 4 +- .../math4/geometry/spherical/twod/Vertex.java | 2 +- .../math4/linear/AbstractFieldMatrix.java | 16 +- .../math4/linear/AbstractRealMatrix.java | 2 +- .../math4/linear/Array2DRowFieldMatrix.java | 10 +- .../math4/linear/ArrayFieldVector.java | 40 ++-- .../math4/linear/BlockFieldMatrix.java | 32 +-- .../math4/linear/FieldLUDecomposition.java | 16 +- .../commons/math4/linear/MatrixUtils.java | 8 +- .../math4/linear/RealMatrixFormat.java | 6 +- .../math4/linear/RealVectorFormat.java | 2 +- .../math4/linear/SparseFieldMatrix.java | 12 +- .../math4/linear/SparseFieldVector.java | 32 +-- .../commons/math4/ml/clustering/Cluster.java | 2 +- .../math4/ml/clustering/DBSCANClusterer.java | 12 +- .../ml/clustering/FuzzyKMeansClusterer.java | 6 +- .../clustering/KMeansPlusPlusClusterer.java | 6 +- .../commons/math4/ml/neuralnet/MapUtils.java | 6 +- .../commons/math4/ml/neuralnet/Network.java | 14 +- .../commons/math4/ml/neuralnet/Neuron.java | 2 +- .../neuralnet/sofm/KohonenUpdateAction.java | 4 +- .../ml/neuralnet/twod/NeuronSquareMesh2D.java | 2 +- .../neuralnet/twod/util/LocationFinder.java | 2 +- .../math4/ode/AbstractFieldIntegrator.java | 14 +- .../commons/math4/ode/AbstractIntegrator.java | 8 +- .../math4/ode/AbstractParameterizable.java | 4 +- .../math4/ode/ContinuousOutputFieldModel.java | 2 +- .../math4/ode/ContinuousOutputModel.java | 2 +- .../math4/ode/ExpandableStatefulODE.java | 4 +- .../math4/ode/FieldEquationsMapper.java | 4 +- .../commons/math4/ode/FieldExpandableODE.java | 6 +- .../commons/math4/ode/JacobianMatrices.java | 2 +- .../math4/ode/MultistepFieldIntegrator.java | 4 +- .../math4/ode/ParameterJacobianWrapper.java | 2 +- .../math4/ode/ParameterizedWrapper.java | 2 +- .../AdamsBashforthFieldIntegrator.java | 2 +- .../nonstiff/AdamsFieldStepInterpolator.java | 6 +- .../nonstiff/AdamsMoultonFieldIntegrator.java | 4 +- .../AdamsNordsieckFieldTransformer.java | 22 +- .../nonstiff/AdamsNordsieckTransformer.java | 10 +- .../ClassicalRungeKuttaFieldIntegrator.java | 2 +- ...ssicalRungeKuttaFieldStepInterpolator.java | 4 +- .../DormandPrince54FieldIntegrator.java | 2 +- .../DormandPrince54FieldStepInterpolator.java | 4 +- .../DormandPrince853FieldIntegrator.java | 2 +- ...DormandPrince853FieldStepInterpolator.java | 4 +- .../EmbeddedRungeKuttaFieldIntegrator.java | 2 +- .../ode/nonstiff/EulerFieldIntegrator.java | 2 +- .../nonstiff/EulerFieldStepInterpolator.java | 4 +- .../ode/nonstiff/GillFieldIntegrator.java | 2 +- .../nonstiff/GillFieldStepInterpolator.java | 4 +- .../nonstiff/HighamHall54FieldIntegrator.java | 2 +- .../HighamHall54FieldStepInterpolator.java | 4 +- .../ode/nonstiff/LutherFieldIntegrator.java | 2 +- .../nonstiff/LutherFieldStepInterpolator.java | 4 +- .../ode/nonstiff/MidpointFieldIntegrator.java | 2 +- .../MidpointFieldStepInterpolator.java | 4 +- .../nonstiff/RungeKuttaFieldIntegrator.java | 2 +- .../ThreeEighthesFieldIntegrator.java | 2 +- .../ThreeEighthesFieldStepInterpolator.java | 4 +- .../optim/linear/LinearConstraintSet.java | 2 +- .../math4/optim/linear/SimplexSolver.java | 2 +- .../math4/optim/linear/SimplexTableau.java | 8 +- .../MultiStartMultivariateOptimizer.java | 2 +- .../scalar/noderiv/CMAESOptimizer.java | 8 +- .../commons/math4/primes/SmallPrimes.java | 2 +- .../math4/random/EmpiricalDistribution.java | 2 +- .../apache/commons/math4/stat/Frequency.java | 6 +- .../stat/correlation/KendallsCorrelation.java | 2 +- .../descriptive/rank/PSquarePercentile.java | 2 +- .../stat/inference/KolmogorovSmirnovTest.java | 4 +- .../math4/stat/inference/OneWayAnova.java | 2 +- .../math4/stat/ranking/NaturalRanking.java | 6 +- .../math4/util/CombinatoricsUtils.java | 2 +- .../commons/math4/util/IterationManager.java | 4 +- .../apache/commons/math4/util/MathArrays.java | 4 +- .../org/apache/commons/math4/util/Pair.java | 2 +- .../commons/math4/util/TransformerMap.java | 2 +- .../differentiation/DSCompilerTest.java | 4 +- .../gauss/BaseRuleFactoryTest.java | 4 +- .../gauss/GaussIntegratorTest.java | 6 +- .../gauss/HermiteParametricTest.java | 2 +- .../LegendreHighPrecisionParametricTest.java | 2 +- .../gauss/LegendreParametricTest.java | 2 +- .../FieldHermiteInterpolatorTest.java | 20 +- ...ieldBracketingNthOrderBrentSolverTest.java | 8 +- .../EnumeratedRealDistributionTest.java | 4 +- ...ateNormalMixtureModelDistributionTest.java | 4 +- .../RealDistributionAbstractTest.java | 2 +- ...malMixtureExpectationMaximizationTest.java | 6 +- .../math4/exception/util/ArgUtilsTest.java | 2 +- .../fitting/HarmonicCurveFitterTest.java | 2 +- .../fitting/leastsquares/CircleProblem.java | 2 +- .../fitting/leastsquares/CircleVectorial.java | 2 +- .../fitting/leastsquares/EvaluationTest.java | 4 +- .../EvaluationTestValidation.java | 2 +- .../LevenbergMarquardtOptimizerTest.java | 4 +- .../StatisticalReferenceDataset.java | 2 +- .../leastsquares/StraightLineProblem.java | 2 +- .../math4/genetics/ChromosomeTest.java | 2 +- .../math4/genetics/FitnessCachingTest.java | 2 +- .../genetics/GeneticAlgorithmTestBinary.java | 2 +- .../GeneticAlgorithmTestPermutations.java | 4 +- .../math4/genetics/ListPopulationTest.java | 14 +- .../math4/genetics/NPointCrossoverTest.java | 2 +- .../math4/genetics/OnePointCrossoverTest.java | 2 +- .../math4/genetics/OrderedCrossoverTest.java | 4 +- .../math4/genetics/UniformCrossoverTest.java | 4 +- .../enclosing/WelzlEncloser2DTest.java | 12 +- .../enclosing/WelzlEncloser3DTest.java | 14 +- .../euclidean/oned/IntervalsSetTest.java | 2 +- .../euclidean/threed/FieldRotationDSTest.java | 118 ++++----- .../threed/FieldRotationDfpTest.java | 116 ++++----- .../euclidean/threed/FieldVector3DTest.java | 48 ++-- .../geometry/euclidean/threed/PLYParser.java | 2 +- .../euclidean/threed/PolyhedronsSetTest.java | 6 +- .../euclidean/threed/SphereGeneratorTest.java | 2 +- .../euclidean/twod/DiskGeneratorTest.java | 2 +- .../euclidean/twod/PolygonsSetTest.java | 52 ++-- .../ConvexHullGenerator2DAbstractTest.java | 24 +- .../twod/hull/MonotoneChainTest.java | 2 +- .../geometry/partitioning/RegionParser.java | 2 +- .../geometry/spherical/oned/ArcsSetTest.java | 14 +- .../twod/SphericalPolygonsSetTest.java | 14 +- .../spherical/twod/SubCircleTest.java | 2 +- .../math4/linear/ArrayFieldVectorTest.java | 96 ++++---- .../math4/linear/BlockFieldMatrixTest.java | 226 +++++++++--------- .../linear/FieldLUDecompositionTest.java | 62 ++--- .../math4/linear/FieldLUSolverTest.java | 18 +- .../math4/linear/FieldMatrixImplTest.java | 212 ++++++++-------- .../commons/math4/linear/MatrixUtilsTest.java | 16 +- .../math4/linear/SparseFieldMatrixTest.java | 26 +- .../math4/linear/SparseFieldVectorTest.java | 40 ++-- .../UnmodifiableRealVectorAbstractTest.java | 2 +- .../ml/clustering/DBSCANClustererTest.java | 10 +- .../clustering/FuzzyKMeansClustererTest.java | 16 +- .../KMeansPlusPlusClustererTest.java | 10 +- .../MultiKMeansPlusPlusClustererTest.java | 2 +- .../evaluation/SumOfClusterVariancesTest.java | 8 +- .../math4/ml/neuralnet/MapUtilsTest.java | 6 +- .../ml/neuralnet/oned/NeuronStringTest.java | 2 +- .../sofm/KohonenTrainingTaskTest.java | 4 +- .../sofm/TravellingSalesmanSolver.java | 8 +- .../twod/NeuronSquareMesh2DTest.java | 8 +- .../ode/ContinuousOutputFieldModelTest.java | 44 ++-- .../math4/ode/FieldExpandableODETest.java | 46 ++-- .../commons/math4/ode/TestFieldProblem4.java | 6 +- .../math4/ode/TestFieldProblemAbstract.java | 2 +- .../ode/events/OverlappingEventsTest.java | 4 +- ...EmbeddedRungeKuttaFieldIntegratorTest.java | 64 ++--- ...AbstractRungeKuttaFieldIntegratorTest.java | 80 +++---- .../AdamsBashforthFieldIntegratorTest.java | 4 +- .../AdamsFieldIntegratorAbstractTest.java | 44 ++-- .../AdamsMoultonFieldIntegratorTest.java | 4 +- ...calRungKuttaFieldStepInterpolatorTest.java | 4 +- ...lassicalRungeKuttaFieldIntegratorTest.java | 2 +- .../DormandPrince54FieldIntegratorTest.java | 4 +- ...mandPrince54FieldStepInterpolatorTest.java | 4 +- .../DormandPrince853FieldIntegratorTest.java | 4 +- ...andPrince853FieldStepInterpolatorTest.java | 4 +- ...RungeKuttaFieldIntegratorAbstractTest.java | 64 ++--- .../nonstiff/EulerFieldIntegratorTest.java | 2 +- .../EulerFieldStepInterpolatorTest.java | 4 +- .../ode/nonstiff/GillFieldIntegratorTest.java | 2 +- .../GillFieldStepInterpolatorTest.java | 4 +- .../HighamHall54FieldIntegratorTest.java | 4 +- ...HighamHall54FieldStepInterpolatorTest.java | 4 +- .../nonstiff/LutherFieldIntegratorTest.java | 2 +- .../LutherFieldStepInterpolatorTest.java | 4 +- .../nonstiff/MidpointFieldIntegratorTest.java | 2 +- .../MidpointFieldStepInterpolatorTest.java | 4 +- ...RungeKuttaFieldIntegratorAbstractTest.java | 80 +++---- ...uttaFieldStepInterpolatorAbstractTest.java | 12 +- .../ThreeEighthesFieldIntegratorTest.java | 2 +- ...hreeEighthesFieldStepInterpolatorTest.java | 4 +- .../sampling/DummyFieldStepInterpolator.java | 2 +- .../sampling/StepInterpolatorTestUtils.java | 2 +- .../StepNormalizerOutputTestBase.java | 2 +- .../math4/optim/SimplePointCheckerTest.java | 4 +- .../math4/optim/linear/SimplexSolverTest.java | 62 ++--- .../optim/linear/SimplexTableauTest.java | 4 +- .../scalar/gradient/CircleScalar.java | 2 +- .../commons/math4/primes/PrimesTest.java | 2 +- .../random/EmpiricalDistributionTest.java | 2 +- .../math4/random/RandomDataGeneratorTest.java | 12 +- .../SynchronizedRandomGeneratorTest.java | 2 +- .../commons/math4/stat/FrequencyTest.java | 2 +- .../stat/data/CertifiedDataAbstractTest.java | 2 +- .../AggregateSummaryStatisticsTest.java | 8 +- .../stat/descriptive/ListUnivariateImpl.java | 2 +- .../descriptive/ListUnivariateImplTest.java | 6 +- .../MixedListUnivariateImplTest.java | 8 +- .../UnivariateStatisticAbstractTest.java | 2 +- .../rank/PSquarePercentileTest.java | 4 +- .../math4/stat/inference/OneWayAnovaTest.java | 20 +- .../math4/stat/inference/TestUtilsTest.java | 2 +- .../math4/util/ArithmeticUtilsTest.java | 2 +- .../math4/util/CombinatoricsUtilsTest.java | 2 +- .../util/FastMathStrictComparisonTest.java | 2 +- .../math4/util/IntegerSequenceTest.java | 16 +- .../util/OpenIntToDoubleHashMapTest.java | 8 +- .../math4/util/OpenIntToFieldTest.java | 26 +- .../apache/commons/math4/util/PairTest.java | 24 +- 270 files changed, 1554 insertions(+), 1552 deletions(-) diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java index 3b1bc738d..7515a1898 100644 --- a/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java +++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java @@ -126,7 +126,7 @@ public class DSCompiler { /** Array of all compilers created so far. */ private static AtomicReference compilers = - new AtomicReference<>(null); + new AtomicReference(null); /** Number of free parameters. */ private final int parameters; @@ -358,14 +358,14 @@ public class DSCompiler { for (int i = 0; i < dSize; ++i) { final int[][] dRow = derivativeCompiler.multIndirection[i]; - List row = new ArrayList<>(dRow.length * 2); + List row = new ArrayList(dRow.length * 2); for (int j = 0; j < dRow.length; ++j) { row.add(new int[] { dRow[j][0], lowerIndirection[dRow[j][1]], vSize + dRow[j][2] }); row.add(new int[] { dRow[j][0], vSize + dRow[j][1], lowerIndirection[dRow[j][2]] }); } // combine terms with similar derivation orders - final List combined = new ArrayList<>(row.size()); + final List combined = new ArrayList(row.size()); for (int j = 0; j < row.size(); ++j) { final int[] termJ = row.get(j); if (termJ[0] > 0) { @@ -428,7 +428,7 @@ public class DSCompiler { // with respect to the parameter this compiler handles and the // underlying one did not handle for (int i = 0; i < dSize; ++i) { - List row = new ArrayList<>(); + List row = new ArrayList(); for (int[] term : derivativeCompiler.compIndirection[i]) { // handle term p * f_k(g(x)) * g_l1(x) * g_l2(x) * ... * g_lp(x) @@ -475,7 +475,7 @@ public class DSCompiler { } // combine terms with similar derivation orders - final List combined = new ArrayList<>(row.size()); + final List combined = new ArrayList(row.size()); for (int j = 0; j < row.size(); ++j) { final int[] termJ = row.get(j); if (termJ[0] > 0) { diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java index 643a975f7..130c33505 100644 --- a/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java +++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java @@ -61,7 +61,7 @@ public class SparseGradient implements RealFieldElement, Seriali */ private SparseGradient(final double value, final Map derivatives) { this.value = value; - this.derivatives = new HashMap<>(); + this.derivatives = new HashMap(); if (derivatives != null) { this.derivatives.putAll(derivatives); } @@ -77,7 +77,7 @@ public class SparseGradient implements RealFieldElement, Seriali private SparseGradient(final double value, final double scale, final Map derivatives) { this.value = value; - this.derivatives = new HashMap<>(); + this.derivatives = new HashMap(); if (derivatives != null) { for (final Map.Entry entry : derivatives.entrySet()) { this.derivatives.put(entry.getKey(), scale * entry.getValue()); diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java index bd05c5e68..0b3623800 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java @@ -37,10 +37,10 @@ import org.apache.commons.math4.util.Pair; public abstract class BaseRuleFactory { /** List of points and weights, indexed by the order of the rule. */ private final Map> pointsAndWeights - = new TreeMap<>(); + = new TreeMap>(); /** Cache for double-precision rules. */ private final Map> pointsAndWeightsDouble - = new TreeMap<>(); + = new TreeMap>(); /** * Gets a copy of the quadrature rule with the given number of integration @@ -75,7 +75,7 @@ public abstract class BaseRuleFactory { } // Return a copy. - return new Pair<>(cached.getFirst().clone(), + return new Pair(cached.getFirst().clone(), cached.getSecond().clone()); } @@ -149,6 +149,6 @@ public abstract class BaseRuleFactory { wD[i] = wT[i].doubleValue(); } - return new Pair<>(pD, wD); + return new Pair(pD, wD); } } diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java index d392277ab..d15d6abe3 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java @@ -162,6 +162,6 @@ public class GaussIntegratorFactory { weights[i] *= scale; } - return new Pair<>(points, weights); + return new Pair(points, weights); } } diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java index e65f5bdeb..5c1d0a269 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java @@ -63,7 +63,7 @@ public class HermiteRuleFactory extends BaseRuleFactory { if (numberOfPoints == 1) { // Break recursion. - return new Pair<>(new Double[] { 0d }, + return new Pair(new Double[] { 0d }, new Double[] { SQRT_PI }); } @@ -172,6 +172,6 @@ public class HermiteRuleFactory extends BaseRuleFactory { weights[iMax] = w; } - return new Pair<>(points, weights); + return new Pair(points, weights); } } diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java index 1790c725a..e4108a239 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java @@ -66,7 +66,7 @@ public class LegendreHighPrecisionRuleFactory extends BaseRuleFactory(new BigDecimal[] { BigDecimal.ZERO }, + return new Pair(new BigDecimal[] { BigDecimal.ZERO }, new BigDecimal[] { two }); } @@ -210,6 +210,6 @@ public class LegendreHighPrecisionRuleFactory extends BaseRuleFactory(points, weights); + return new Pair(points, weights); } } diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java index 29684bffa..113ab3823 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java @@ -37,7 +37,7 @@ public class LegendreRuleFactory extends BaseRuleFactory { if (numberOfPoints == 1) { // Break recursion. - return new Pair<>(new Double[] { 0d }, + return new Pair(new Double[] { 0d }, new Double[] { 2d }); } @@ -135,6 +135,6 @@ public class LegendreRuleFactory extends BaseRuleFactory { weights[iMax] = w; } - return new Pair<>(points, weights); + return new Pair(points, weights); } } diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java index 3241ddf38..e5e660f7a 100644 --- a/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java +++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java @@ -61,9 +61,9 @@ public class FieldHermiteInterpolator> { /** Create an empty interpolator. */ public FieldHermiteInterpolator() { - this.abscissae = new ArrayList<>(); - this.topDiagonal = new ArrayList<>(); - this.bottomDiagonal = new ArrayList<>(); + this.abscissae = new ArrayList(); + this.topDiagonal = new ArrayList(); + this.bottomDiagonal = new ArrayList(); } /** Add a sample point. diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java index 5a3081506..3aeb13503 100644 --- a/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java +++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java @@ -59,9 +59,9 @@ public class HermiteInterpolator implements UnivariateDifferentiableVectorFuncti /** Create an empty interpolator. */ public HermiteInterpolator() { - this.abscissae = new ArrayList<>(); - this.topDiagonal = new ArrayList<>(); - this.bottomDiagonal = new ArrayList<>(); + this.abscissae = new ArrayList(); + this.topDiagonal = new ArrayList(); + this.bottomDiagonal = new ArrayList(); } /** Add a sample point. diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/InterpolatingMicrosphere.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/InterpolatingMicrosphere.java index 4887d80da..c8929cf0e 100644 --- a/src/main/java/org/apache/commons/math4/analysis/interpolation/InterpolatingMicrosphere.java +++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/InterpolatingMicrosphere.java @@ -93,8 +93,8 @@ public class InterpolatingMicrosphere { this.maxDarkFraction = maxDarkFraction; this.darkThreshold = darkThreshold; this.background = background; - microsphere = new ArrayList<>(size); - microsphereData = new ArrayList<>(size); + microsphere = new ArrayList(size); + microsphereData = new ArrayList(size); } /** @@ -150,7 +150,7 @@ public class InterpolatingMicrosphere { microsphere = other.microsphere; // Field must be copied. - microsphereData = new ArrayList<>(size); + microsphereData = new ArrayList(size); for (FacetData fd : other.microsphereData) { microsphereData.add(new FacetData(fd.illumination(), fd.sample())); } diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java index 92e9e6d9a..c4069792a 100644 --- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java +++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java @@ -51,34 +51,34 @@ public class PolynomialsUtils { // initialize recurrence for Chebyshev polynomials // T0(X) = 1, T1(X) = 0 + 1 * X - CHEBYSHEV_COEFFICIENTS = new ArrayList<>(); + CHEBYSHEV_COEFFICIENTS = new ArrayList(); CHEBYSHEV_COEFFICIENTS.add(BigFraction.ONE); CHEBYSHEV_COEFFICIENTS.add(BigFraction.ZERO); CHEBYSHEV_COEFFICIENTS.add(BigFraction.ONE); // initialize recurrence for Hermite polynomials // H0(X) = 1, H1(X) = 0 + 2 * X - HERMITE_COEFFICIENTS = new ArrayList<>(); + HERMITE_COEFFICIENTS = new ArrayList(); HERMITE_COEFFICIENTS.add(BigFraction.ONE); HERMITE_COEFFICIENTS.add(BigFraction.ZERO); HERMITE_COEFFICIENTS.add(BigFraction.TWO); // initialize recurrence for Laguerre polynomials // L0(X) = 1, L1(X) = 1 - 1 * X - LAGUERRE_COEFFICIENTS = new ArrayList<>(); + LAGUERRE_COEFFICIENTS = new ArrayList(); LAGUERRE_COEFFICIENTS.add(BigFraction.ONE); LAGUERRE_COEFFICIENTS.add(BigFraction.ONE); LAGUERRE_COEFFICIENTS.add(BigFraction.MINUS_ONE); // initialize recurrence for Legendre polynomials // P0(X) = 1, P1(X) = 0 + 1 * X - LEGENDRE_COEFFICIENTS = new ArrayList<>(); + LEGENDRE_COEFFICIENTS = new ArrayList(); LEGENDRE_COEFFICIENTS.add(BigFraction.ONE); LEGENDRE_COEFFICIENTS.add(BigFraction.ZERO); LEGENDRE_COEFFICIENTS.add(BigFraction.ONE); // initialize map for Jacobi polynomials - JACOBI_COEFFICIENTS = new HashMap<>(); + JACOBI_COEFFICIENTS = new HashMap>(); } @@ -228,7 +228,7 @@ public class PolynomialsUtils { if (!JACOBI_COEFFICIENTS.containsKey(key)) { // allocate a new list for v, w - final List list = new ArrayList<>(); + final List list = new ArrayList(); JACOBI_COEFFICIENTS.put(key, list); // Pv,w,0(x) = 1; diff --git a/src/main/java/org/apache/commons/math4/complex/Complex.java b/src/main/java/org/apache/commons/math4/complex/Complex.java index 48b17fc12..5a073c7c2 100644 --- a/src/main/java/org/apache/commons/math4/complex/Complex.java +++ b/src/main/java/org/apache/commons/math4/complex/Complex.java @@ -1209,7 +1209,7 @@ public class Complex implements FieldElement, Serializable { n); } - final List result = new ArrayList<>(); + final List result = new ArrayList(); if (isNaN) { result.add(NaN); diff --git a/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java b/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java index 838e2252b..8e1149f0d 100644 --- a/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java @@ -117,7 +117,7 @@ public class EnumeratedDistribution implements Serializable { throws NotPositiveException, MathArithmeticException, NotFiniteNumberException, NotANumberException { random = rng; - singletons = new ArrayList<>(pmf.size()); + singletons = new ArrayList(pmf.size()); final double[] probs = new double[pmf.size()]; for (int i = 0; i < pmf.size(); i++) { @@ -191,10 +191,10 @@ public class EnumeratedDistribution implements Serializable { * @return the probability mass function. */ public List> getPmf() { - final List> samples = new ArrayList<>(probabilities.length); + final List> samples = new ArrayList>(probabilities.length); for (int i = 0; i < probabilities.length; i++) { - samples.add(new Pair<>(singletons.get(i), probabilities[i])); + samples.add(new Pair(singletons.get(i), probabilities[i])); } return samples; diff --git a/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java b/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java index e3f271d9e..af641406f 100644 --- a/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java @@ -97,7 +97,7 @@ public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution { throws DimensionMismatchException, NotPositiveException, MathArithmeticException, NotFiniteNumberException, NotANumberException { super(rng); - innerDistribution = new EnumeratedDistribution<>( + innerDistribution = new EnumeratedDistribution( rng, createDistribution(singletons, probabilities)); } @@ -111,7 +111,7 @@ public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution { */ public EnumeratedIntegerDistribution(final RandomGenerator rng, final int[] data) { super(rng); - final Map dataMap = new HashMap<>(); + final Map dataMap = new HashMap(); for (int value : data) { Integer count = dataMap.get(value); if (count == null) { @@ -129,7 +129,7 @@ public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution { probabilities[index] = entry.getValue().intValue() / denom; index++; } - innerDistribution = new EnumeratedDistribution<>(rng, createDistribution(values, probabilities)); + innerDistribution = new EnumeratedDistribution(rng, createDistribution(values, probabilities)); } /** @@ -156,10 +156,10 @@ public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution { throw new DimensionMismatchException(probabilities.length, singletons.length); } - final List> samples = new ArrayList<>(singletons.length); + final List> samples = new ArrayList>(singletons.length); for (int i = 0; i < singletons.length; i++) { - samples.add(new Pair<>(singletons[i], probabilities[i])); + samples.add(new Pair(singletons[i], probabilities[i])); } return samples; diff --git a/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java index b98b3ad28..688b3fda4 100644 --- a/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java @@ -99,7 +99,7 @@ public class EnumeratedRealDistribution extends AbstractRealDistribution { NotFiniteNumberException, NotANumberException { super(rng); - innerDistribution = new EnumeratedDistribution<>( + innerDistribution = new EnumeratedDistribution( rng, createDistribution(singletons, probabilities)); } @@ -113,7 +113,7 @@ public class EnumeratedRealDistribution extends AbstractRealDistribution { */ public EnumeratedRealDistribution(final RandomGenerator rng, final double[] data) { super(rng); - final Map dataMap = new HashMap<>(); + final Map dataMap = new HashMap(); for (double value : data) { Integer count = dataMap.get(value); if (count == null) { @@ -131,7 +131,7 @@ public class EnumeratedRealDistribution extends AbstractRealDistribution { probabilities[index] = entry.getValue().intValue() / denom; index++; } - innerDistribution = new EnumeratedDistribution<>(rng, createDistribution(values, probabilities)); + innerDistribution = new EnumeratedDistribution(rng, createDistribution(values, probabilities)); } /** @@ -157,10 +157,10 @@ public class EnumeratedRealDistribution extends AbstractRealDistribution { throw new DimensionMismatchException(probabilities.length, singletons.length); } - final List> samples = new ArrayList<>(singletons.length); + final List> samples = new ArrayList>(singletons.length); for (int i = 0; i < singletons.length; i++) { - samples.add(new Pair<>(singletons[i], probabilities[i])); + samples.add(new Pair(singletons[i], probabilities[i])); } return samples; diff --git a/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateNormalDistribution.java b/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateNormalDistribution.java index c06d8efc1..d7cd4cdb1 100644 --- a/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateNormalDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateNormalDistribution.java @@ -99,13 +99,13 @@ public class MixtureMultivariateNormalDistribution double[][] means, double[][][] covariances) { final List> mvns - = new ArrayList<>(weights.length); + = new ArrayList>(weights.length); for (int i = 0; i < weights.length; i++) { final MultivariateNormalDistribution dist = new MultivariateNormalDistribution(means[i], covariances[i]); - mvns.add(new Pair<>(weights[i], dist)); + mvns.add(new Pair(weights[i], dist)); } return mvns; diff --git a/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java index e20f0d65a..ce8c7d961 100644 --- a/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java +++ b/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java @@ -93,7 +93,7 @@ public class MixtureMultivariateRealDistribution(); + distribution = new ArrayList(); weight = new double[numComp]; for (int i = 0; i < numComp; i++) { final Pair comp = components.get(i); @@ -161,10 +161,10 @@ public class MixtureMultivariateRealDistribution> getComponents() { - final List> list = new ArrayList<>(weight.length); + final List> list = new ArrayList>(weight.length); for (int i = 0; i < weight.length; i++) { - list.add(new Pair<>(weight[i], distribution.get(i))); + list.add(new Pair(weight[i], distribution.get(i))); } return list; diff --git a/src/main/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java b/src/main/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java index 20cbfc207..a0cf24818 100644 --- a/src/main/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java +++ b/src/main/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java @@ -328,7 +328,7 @@ public class MultivariateNormalMixtureExpectationMaximization { // components of mixture model to be created final List> components = - new ArrayList<>(numComponents); + new ArrayList>(numComponents); // create a component based on data in each bin for (int binIndex = 0; binIndex < numComponents; binIndex++) { @@ -364,7 +364,7 @@ public class MultivariateNormalMixtureExpectationMaximization { final MultivariateNormalDistribution mvn = new MultivariateNormalDistribution(columnMeans, covMat); - components.add(new Pair<>(weight, mvn)); + components.add(new Pair(weight, mvn)); } return new MixtureMultivariateNormalDistribution(components); diff --git a/src/main/java/org/apache/commons/math4/exception/util/ArgUtils.java b/src/main/java/org/apache/commons/math4/exception/util/ArgUtils.java index 6e447a019..577b0a56a 100644 --- a/src/main/java/org/apache/commons/math4/exception/util/ArgUtils.java +++ b/src/main/java/org/apache/commons/math4/exception/util/ArgUtils.java @@ -38,7 +38,7 @@ public class ArgUtils { * {@code array}. */ public static Object[] flatten(Object[] array) { - final List list = new ArrayList<>(); + final List list = new ArrayList(); if (array != null) { for (Object o : array) { if (o instanceof Object[]) { diff --git a/src/main/java/org/apache/commons/math4/exception/util/ExceptionContext.java b/src/main/java/org/apache/commons/math4/exception/util/ExceptionContext.java index 4cdde9af9..59f91a313 100644 --- a/src/main/java/org/apache/commons/math4/exception/util/ExceptionContext.java +++ b/src/main/java/org/apache/commons/math4/exception/util/ExceptionContext.java @@ -62,9 +62,9 @@ public class ExceptionContext implements Serializable { */ public ExceptionContext(final Throwable throwable) { this.throwable = throwable; - msgPatterns = new ArrayList<>(); - msgArguments = new ArrayList<>(); - context = new HashMap<>(); + msgPatterns = new ArrayList(); + msgArguments = new ArrayList(); + context = new HashMap(); } /** Get a reference to the exception to which the context relates. @@ -256,8 +256,8 @@ public class ExceptionContext implements Serializable { ClassNotFoundException { // Step 1. final int len = in.readInt(); - msgPatterns = new ArrayList<>(len); - msgArguments = new ArrayList<>(len); + msgPatterns = new ArrayList(len); + msgArguments = new ArrayList(len); // Step 2. for (int i = 0; i < len; i++) { // Step 3. @@ -311,7 +311,7 @@ public class ExceptionContext implements Serializable { ClassNotFoundException { // Step 1. final int len = in.readInt(); - context = new HashMap<>(); + context = new HashMap(); for (int i = 0; i < len; i++) { // Step 2. final String key = (String) in.readObject(); diff --git a/src/main/java/org/apache/commons/math4/fitting/GaussianCurveFitter.java b/src/main/java/org/apache/commons/math4/fitting/GaussianCurveFitter.java index 3c5f14a32..ae2b8d8da 100644 --- a/src/main/java/org/apache/commons/math4/fitting/GaussianCurveFitter.java +++ b/src/main/java/org/apache/commons/math4/fitting/GaussianCurveFitter.java @@ -248,7 +248,7 @@ public class GaussianCurveFitter extends AbstractCurveFitter { * @return the input observations, sorted. */ private List sortObservations(Collection unsorted) { - final List observations = new ArrayList<>(unsorted); + final List observations = new ArrayList(unsorted); final Comparator cmp = new Comparator() { /** {@inheritDoc} */ diff --git a/src/main/java/org/apache/commons/math4/fitting/HarmonicCurveFitter.java b/src/main/java/org/apache/commons/math4/fitting/HarmonicCurveFitter.java index fbd643f2c..c8a2a8e37 100644 --- a/src/main/java/org/apache/commons/math4/fitting/HarmonicCurveFitter.java +++ b/src/main/java/org/apache/commons/math4/fitting/HarmonicCurveFitter.java @@ -292,7 +292,7 @@ public class HarmonicCurveFitter extends AbstractCurveFitter { * @return the input observations, sorted. */ private List sortObservations(Collection unsorted) { - final List observations = new ArrayList<>(unsorted); + final List observations = new ArrayList(unsorted); // Since the samples are almost always already sorted, this // method is implemented as an insertion sort that reorders the diff --git a/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoints.java b/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoints.java index 00cef70ce..520af887b 100644 --- a/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoints.java +++ b/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoints.java @@ -32,7 +32,7 @@ public class WeightedObservedPoints implements Serializable { /** Observed points. */ private final List observations - = new ArrayList<>(); + = new ArrayList(); /** * Adds a point to the sample. @@ -100,7 +100,7 @@ public class WeightedObservedPoints implements Serializable { // The copy is necessary to ensure thread-safety because of the // "clear" method (which otherwise would be able to empty the // list of points while it is being used by another thread). - return new ArrayList<>(observations); + return new ArrayList(observations); } /** diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java index 637382cdf..ec17b931c 100644 --- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java +++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java @@ -294,7 +294,7 @@ public class GaussNewtonOptimizer implements LeastSquaresOptimizer { normal.setEntry(i, j, normal.getEntry(j, i)); } } - return new Pair<>(normal, jTr); + return new Pair(normal, jTr); } } diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java index 933278d5a..a0ddace06 100644 --- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java +++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java @@ -332,7 +332,7 @@ public class LeastSquaresFactory { final double[] p = point.toArray(); // Evaluate. - return new Pair<>(computeValue(p), + return new Pair(computeValue(p), computeJacobian(p)); } diff --git a/src/main/java/org/apache/commons/math4/genetics/AbstractListChromosome.java b/src/main/java/org/apache/commons/math4/genetics/AbstractListChromosome.java index e7ac9a87f..707ddd504 100644 --- a/src/main/java/org/apache/commons/math4/genetics/AbstractListChromosome.java +++ b/src/main/java/org/apache/commons/math4/genetics/AbstractListChromosome.java @@ -59,7 +59,7 @@ public abstract class AbstractListChromosome extends Chromosome { public AbstractListChromosome(final List representation, final boolean copyList) { checkValidity(representation); this.representation = - Collections.unmodifiableList(copyList ? new ArrayList<>(representation) : representation); + Collections.unmodifiableList(copyList ? new ArrayList(representation) : representation); } /** diff --git a/src/main/java/org/apache/commons/math4/genetics/BinaryChromosome.java b/src/main/java/org/apache/commons/math4/genetics/BinaryChromosome.java index 6f1e08cb1..b4aa23291 100644 --- a/src/main/java/org/apache/commons/math4/genetics/BinaryChromosome.java +++ b/src/main/java/org/apache/commons/math4/genetics/BinaryChromosome.java @@ -67,7 +67,7 @@ public abstract class BinaryChromosome extends AbstractListChromosome { */ public static List randomBinaryRepresentation(int length) { // random binary list - List rList= new ArrayList<> (length); + List rList= new ArrayList (length); for (int j=0; j newRepr = new ArrayList<>(origChrom.getRepresentation()); + List newRepr = new ArrayList(origChrom.getRepresentation()); // randomly select a gene int geneIndex = GeneticAlgorithm.getRandomGenerator().nextInt(origChrom.getLength()); diff --git a/src/main/java/org/apache/commons/math4/genetics/CycleCrossover.java b/src/main/java/org/apache/commons/math4/genetics/CycleCrossover.java index 0de83713a..507ffdf49 100644 --- a/src/main/java/org/apache/commons/math4/genetics/CycleCrossover.java +++ b/src/main/java/org/apache/commons/math4/genetics/CycleCrossover.java @@ -129,13 +129,13 @@ public class CycleCrossover implements CrossoverPolicy { final List parent1Rep = first.getRepresentation(); final List parent2Rep = second.getRepresentation(); // and of the children: do a crossover copy to simplify the later processing - final List child1Rep = new ArrayList<>(second.getRepresentation()); - final List child2Rep = new ArrayList<>(first.getRepresentation()); + final List child1Rep = new ArrayList(second.getRepresentation()); + final List child2Rep = new ArrayList(first.getRepresentation()); // the set of all visited indices so far - final Set visitedIndices = new HashSet<>(length); + final Set visitedIndices = new HashSet(length); // the indices of the current cycle - final List indices = new ArrayList<>(length); + final List indices = new ArrayList(length); // determine the starting index int idx = randomStart ? GeneticAlgorithm.getRandomGenerator().nextInt(length) : 0; diff --git a/src/main/java/org/apache/commons/math4/genetics/ListPopulation.java b/src/main/java/org/apache/commons/math4/genetics/ListPopulation.java index 0aa02396b..1adf6ac63 100644 --- a/src/main/java/org/apache/commons/math4/genetics/ListPopulation.java +++ b/src/main/java/org/apache/commons/math4/genetics/ListPopulation.java @@ -76,7 +76,7 @@ public abstract class ListPopulation implements Population { chromosomes.size(), populationLimit, false); } this.populationLimit = populationLimit; - this.chromosomes = new ArrayList<>(populationLimit); + this.chromosomes = new ArrayList(populationLimit); this.chromosomes.addAll(chromosomes); } diff --git a/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java b/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java index 720df8af0..5c79ef1f4 100644 --- a/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java +++ b/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java @@ -139,8 +139,8 @@ public class NPointCrossover implements CrossoverPolicy { final List parent1Rep = first.getRepresentation(); final List parent2Rep = second.getRepresentation(); // and of the children - final List child1Rep = new ArrayList<>(length); - final List child2Rep = new ArrayList<>(length); + final List child1Rep = new ArrayList(length); + final List child2Rep = new ArrayList(length); final RandomGenerator random = GeneticAlgorithm.getRandomGenerator(); diff --git a/src/main/java/org/apache/commons/math4/genetics/OnePointCrossover.java b/src/main/java/org/apache/commons/math4/genetics/OnePointCrossover.java index 730804361..0df7313c6 100644 --- a/src/main/java/org/apache/commons/math4/genetics/OnePointCrossover.java +++ b/src/main/java/org/apache/commons/math4/genetics/OnePointCrossover.java @@ -105,8 +105,8 @@ public class OnePointCrossover implements CrossoverPolicy { final List parent1Rep = first.getRepresentation(); final List parent2Rep = second.getRepresentation(); // and of the children - final List child1Rep = new ArrayList<>(length); - final List child2Rep = new ArrayList<>(length); + final List child1Rep = new ArrayList(length); + final List child2Rep = new ArrayList(length); // select a crossover point at random (0 and length makes no sense) final int crossoverIndex = 1 + (GeneticAlgorithm.getRandomGenerator().nextInt(length-2)); diff --git a/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java b/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java index 2ceb29925..b5aecc8f8 100644 --- a/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java +++ b/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java @@ -97,11 +97,11 @@ public class OrderedCrossover implements CrossoverPolicy { final List parent1Rep = first.getRepresentation(); final List parent2Rep = second.getRepresentation(); // and of the children - final List child1 = new ArrayList<>(length); - final List child2 = new ArrayList<>(length); + final List child1 = new ArrayList(length); + final List child2 = new ArrayList(length); // sets of already inserted items for quick access - final Set child1Set = new HashSet<>(length); - final Set child2Set = new HashSet<>(length); + final Set child1Set = new HashSet(length); + final Set child2Set = new HashSet(length); final RandomGenerator random = GeneticAlgorithm.getRandomGenerator(); // choose random points, making sure that lb < ub. diff --git a/src/main/java/org/apache/commons/math4/genetics/RandomKey.java b/src/main/java/org/apache/commons/math4/genetics/RandomKey.java index ea0a40119..8186a5274 100644 --- a/src/main/java/org/apache/commons/math4/genetics/RandomKey.java +++ b/src/main/java/org/apache/commons/math4/genetics/RandomKey.java @@ -72,7 +72,7 @@ public abstract class RandomKey extends AbstractListChromosome implem public RandomKey(final List representation) throws InvalidRepresentationException { super(representation); // store the sorted representation - List sortedRepr = new ArrayList<> (getRepresentation()); + List sortedRepr = new ArrayList (getRepresentation()); Collections.sort(sortedRepr); sortedRepresentation = Collections.unmodifiableList(sortedRepr); // store the permutation of [0,1,...,n-1] list for toString() and isSame() methods @@ -126,10 +126,10 @@ public abstract class RandomKey extends AbstractListChromosome implem } // do not modify the original representation - List reprCopy = new ArrayList<> (representation); + List reprCopy = new ArrayList (representation); // now find the indices in the original repr and use them for permuting - List res = new ArrayList<> (l); + List res = new ArrayList (l); for (int i=0; i extends AbstractListChromosome implem * @return representation of a random permutation */ public static final List randomPermutation(final int l) { - List repr = new ArrayList<>(l); + List repr = new ArrayList(l); for (int i=0; i extends AbstractListChromosome implem * @return representation of an identity permutation */ public static final List identityPermutation(final int l) { - List repr = new ArrayList<>(l); + List repr = new ArrayList(l); for (int i=0; i extends AbstractListChromosome implem */ public static List comparatorPermutation(final List data, final Comparator comparator) { - List sortedData = new ArrayList<>(data); + List sortedData = new ArrayList(data); Collections.sort(sortedData, comparator); return inducedPermutation(data, sortedData); @@ -264,7 +264,7 @@ public abstract class RandomKey extends AbstractListChromosome implem } int l = originalData.size(); - List origDataCopy = new ArrayList<> (originalData); + List origDataCopy = new ArrayList (originalData); Double[] res = new Double[l]; for (int i=0; i extends AbstractListChromosome implem * @return list of integers from 0 to l-1 */ private static List baseSequence(final int l) { - List baseSequence = new ArrayList<> (l); + List baseSequence = new ArrayList (l); for (int i=0; i repr = originalRk.getRepresentation(); int rInd = GeneticAlgorithm.getRandomGenerator().nextInt(repr.size()); - List newRepr = new ArrayList<> (repr); + List newRepr = new ArrayList (repr); newRepr.set(rInd, GeneticAlgorithm.getRandomGenerator().nextDouble()); return originalRk.newFixedLengthChromosome(newRepr); diff --git a/src/main/java/org/apache/commons/math4/genetics/TournamentSelection.java b/src/main/java/org/apache/commons/math4/genetics/TournamentSelection.java index 092403303..97becff40 100644 --- a/src/main/java/org/apache/commons/math4/genetics/TournamentSelection.java +++ b/src/main/java/org/apache/commons/math4/genetics/TournamentSelection.java @@ -84,7 +84,7 @@ public class TournamentSelection implements SelectionPolicy { }; // create a copy of the chromosome list - List chromosomes = new ArrayList<> (population.getChromosomes()); + List chromosomes = new ArrayList (population.getChromosomes()); for (int i=0; i implements CrossoverPolicy { final List parent1Rep = first.getRepresentation(); final List parent2Rep = second.getRepresentation(); // and of the children - final List child1Rep = new ArrayList<>(length); - final List child2Rep = new ArrayList<>(length); + final List child1Rep = new ArrayList(length); + final List child2Rep = new ArrayList(length); final RandomGenerator random = GeneticAlgorithm.getRandomGenerator(); diff --git a/src/main/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser.java b/src/main/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser.java index b76ff6a9d..9cd111278 100644 --- a/src/main/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser.java +++ b/src/main/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser.java @@ -78,8 +78,8 @@ public class WelzlEncloser> implements Enclo private EnclosingBall pivotingBall(final Iterable

points) { final P first = points.iterator().next(); - final List

extreme = new ArrayList<>(first.getSpace().getDimension() + 1); - final List

support = new ArrayList<>(first.getSpace().getDimension() + 1); + final List

extreme = new ArrayList

(first.getSpace().getDimension() + 1); + final List

support = new ArrayList

(first.getSpace().getDimension() + 1); // start with only first point selected as a candidate support extreme.add(first); diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java index 1b58cd997..7d944afb4 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java @@ -108,12 +108,12 @@ public class IntervalsSet extends AbstractRegion imple if (Double.isInfinite(lower) && (lower < 0)) { if (Double.isInfinite(upper) && (upper > 0)) { // the tree must cover the whole real line - return new BSPTree<>(Boolean.TRUE); + return new BSPTree(Boolean.TRUE); } // the tree must be open on the negative infinity side final SubHyperplane upperCut = new OrientedPoint(new Vector1D(upper), true, tolerance).wholeHyperplane(); - return new BSPTree<>(upperCut, + return new BSPTree(upperCut, new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null); @@ -122,7 +122,7 @@ public class IntervalsSet extends AbstractRegion imple new OrientedPoint(new Vector1D(lower), false, tolerance).wholeHyperplane(); if (Double.isInfinite(upper) && (upper > 0)) { // the tree must be open on the positive infinity side - return new BSPTree<>(lowerCut, + return new BSPTree(lowerCut, new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null); @@ -131,9 +131,9 @@ public class IntervalsSet extends AbstractRegion imple // the tree must be bounded on the two sides final SubHyperplane upperCut = new OrientedPoint(new Vector1D(upper), true, tolerance).wholeHyperplane(); - return new BSPTree<>(lowerCut, + return new BSPTree(lowerCut, new BSPTree(Boolean.FALSE), - new BSPTree<>(upperCut, + new BSPTree(upperCut, new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null), @@ -222,9 +222,9 @@ public class IntervalsSet extends AbstractRegion imple final double previousOffset = x - previous; final double currentOffset = a[0] - x; if (previousOffset < currentOffset) { - return new BoundaryProjection<>(point, finiteOrNullPoint(previous), previousOffset); + return new BoundaryProjection(point, finiteOrNullPoint(previous), previousOffset); } else { - return new BoundaryProjection<>(point, finiteOrNullPoint(a[0]), currentOffset); + return new BoundaryProjection(point, finiteOrNullPoint(a[0]), currentOffset); } } else if (x <= a[1]) { // the test point lies within the current interval @@ -232,16 +232,16 @@ public class IntervalsSet extends AbstractRegion imple final double offset0 = a[0] - x; final double offset1 = x - a[1]; if (offset0 < offset1) { - return new BoundaryProjection<>(point, finiteOrNullPoint(a[1]), offset1); + return new BoundaryProjection(point, finiteOrNullPoint(a[1]), offset1); } else { - return new BoundaryProjection<>(point, finiteOrNullPoint(a[0]), offset0); + return new BoundaryProjection(point, finiteOrNullPoint(a[0]), offset0); } } previous = a[1]; } // the test point if past the last sub-interval - return new BoundaryProjection<>(point, finiteOrNullPoint(previous), x - previous); + return new BoundaryProjection(point, finiteOrNullPoint(previous), x - previous); } @@ -267,7 +267,7 @@ public class IntervalsSet extends AbstractRegion imple * elements */ public List asList() { - final List list = new ArrayList<>(); + final List list = new ArrayList(); for (final double[] a : this) { list.add(new Interval(a[0], a[1])); } diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/SubOrientedPoint.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/SubOrientedPoint.java index 878c0466e..a80873d8a 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/SubOrientedPoint.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/SubOrientedPoint.java @@ -61,11 +61,11 @@ public class SubOrientedPoint extends AbstractSubHyperplane split(final Hyperplane hyperplane) { final double global = hyperplane.getOffset(((OrientedPoint) getHyperplane()).getLocation()); if (global < -1.0e-10) { - return new SplitSubHyperplane<>(null, this); + return new SplitSubHyperplane(null, this); } else if (global > 1.0e-10) { - return new SplitSubHyperplane<>(this, null); + return new SplitSubHyperplane(this, null); } else { - return new SplitSubHyperplane<>(null, null); + return new SplitSubHyperplane(null, null); } } diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java index be89ef41b..2dc69337b 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotation.java @@ -374,9 +374,9 @@ public class FieldRotation> implements Serializabl public FieldRotation(final RotationOrder order, final RotationConvention convention, final T alpha1, final T alpha2, final T alpha3) { final T one = alpha1.getField().getOne(); - final FieldRotation r1 = new FieldRotation<>(new FieldVector3D<>(one, order.getA1()), alpha1, convention); - final FieldRotation r2 = new FieldRotation<>(new FieldVector3D<>(one, order.getA2()), alpha2, convention); - final FieldRotation r3 = new FieldRotation<>(new FieldVector3D<>(one, order.getA3()), alpha3, convention); + final FieldRotation r1 = new FieldRotation(new FieldVector3D(one, order.getA1()), alpha1, convention); + final FieldRotation r2 = new FieldRotation(new FieldVector3D(one, order.getA2()), alpha2, convention); + final FieldRotation r3 = new FieldRotation(new FieldVector3D(one, order.getA3()), alpha3, convention); final FieldRotation composed = r1.compose(r2.compose(r3, convention), convention); q0 = composed.q0; q1 = composed.q1; @@ -453,7 +453,7 @@ public class FieldRotation> implements Serializabl * of the instance */ public FieldRotation revert() { - return new FieldRotation<>(q0.negate(), q1, q2, q3, false); + return new FieldRotation(q0.negate(), q1, q2, q3, false); } /** Get the scalar coordinate of the quaternion. @@ -509,17 +509,17 @@ public class FieldRotation> implements Serializabl final T squaredSine = q1.multiply(q1).add(q2.multiply(q2)).add(q3.multiply(q3)); if (squaredSine.getReal() == 0) { final Field field = squaredSine.getField(); - return new FieldVector3D<>(convention == RotationConvention.VECTOR_OPERATOR ? field.getOne(): field.getOne().negate(), + return new FieldVector3D(convention == RotationConvention.VECTOR_OPERATOR ? field.getOne(): field.getOne().negate(), field.getZero(), field.getZero()); } else { final double sgn = convention == RotationConvention.VECTOR_OPERATOR ? +1 : -1; if (q0.getReal() < 0) { T inverse = squaredSine.sqrt().reciprocal().multiply(sgn); - return new FieldVector3D<>(q1.multiply(inverse), q2.multiply(inverse), q3.multiply(inverse)); + return new FieldVector3D(q1.multiply(inverse), q2.multiply(inverse), q3.multiply(inverse)); } final T inverse = squaredSine.sqrt().reciprocal().negate().multiply(sgn); - return new FieldVector3D<>(q1.multiply(inverse), q2.multiply(inverse), q3.multiply(inverse)); + return new FieldVector3D(q1.multiply(inverse), q2.multiply(inverse), q3.multiply(inverse)); } } @@ -1032,7 +1032,7 @@ public class FieldRotation> implements Serializabl */ private FieldVector3D vector(final double x, final double y, final double z) { final T zero = q0.getField().getZero(); - return new FieldVector3D<>(zero.add(x), zero.add(y), zero.add(z)); + return new FieldVector3D(zero.add(x), zero.add(y), zero.add(z)); } /** Get the 3X3 matrix corresponding to the instance @@ -1090,7 +1090,7 @@ public class FieldRotation> implements Serializabl final T s = q1.multiply(x).add(q2.multiply(y)).add(q3.multiply(z)); - return new FieldVector3D<>(q0.multiply(x.multiply(q0).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x), + return new FieldVector3D(q0.multiply(x.multiply(q0).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x), q0.multiply(y.multiply(q0).subtract(q3.multiply(x).subtract(q1.multiply(z)))).add(s.multiply(q2)).multiply(2).subtract(y), q0.multiply(z.multiply(q0).subtract(q1.multiply(y).subtract(q2.multiply(x)))).add(s.multiply(q3)).multiply(2).subtract(z)); @@ -1108,7 +1108,7 @@ public class FieldRotation> implements Serializabl final T s = q1.multiply(x).add(q2.multiply(y)).add(q3.multiply(z)); - return new FieldVector3D<>(q0.multiply(q0.multiply(x).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x), + return new FieldVector3D(q0.multiply(q0.multiply(x).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x), q0.multiply(q0.multiply(y).subtract(q3.multiply(x).subtract(q1.multiply(z)))).add(s.multiply(q2)).multiply(2).subtract(y), q0.multiply(q0.multiply(z).subtract(q1.multiply(y).subtract(q2.multiply(x)))).add(s.multiply(q3)).multiply(2).subtract(z)); @@ -1165,7 +1165,7 @@ public class FieldRotation> implements Serializabl final T s = x.multiply(r.getQ1()).add(y.multiply(r.getQ2())).add(z.multiply(r.getQ3())); - return new FieldVector3D<>(x.multiply(r.getQ0()).subtract(z.multiply(r.getQ2()).subtract(y.multiply(r.getQ3()))).multiply(r.getQ0()).add(s.multiply(r.getQ1())).multiply(2).subtract(x), + return new FieldVector3D(x.multiply(r.getQ0()).subtract(z.multiply(r.getQ2()).subtract(y.multiply(r.getQ3()))).multiply(r.getQ0()).add(s.multiply(r.getQ1())).multiply(2).subtract(x), y.multiply(r.getQ0()).subtract(x.multiply(r.getQ3()).subtract(z.multiply(r.getQ1()))).multiply(r.getQ0()).add(s.multiply(r.getQ2())).multiply(2).subtract(y), z.multiply(r.getQ0()).subtract(y.multiply(r.getQ1()).subtract(x.multiply(r.getQ2()))).multiply(r.getQ0()).add(s.multiply(r.getQ3())).multiply(2).subtract(z)); @@ -1184,7 +1184,7 @@ public class FieldRotation> implements Serializabl final T s = q1.multiply(x).add(q2.multiply(y)).add(q3.multiply(z)); final T m0 = q0.negate(); - return new FieldVector3D<>(m0.multiply(x.multiply(m0).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x), + return new FieldVector3D(m0.multiply(x.multiply(m0).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x), m0.multiply(y.multiply(m0).subtract(q3.multiply(x).subtract(q1.multiply(z)))).add(s.multiply(q2)).multiply(2).subtract(y), m0.multiply(z.multiply(m0).subtract(q1.multiply(y).subtract(q2.multiply(x)))).add(s.multiply(q3)).multiply(2).subtract(z)); @@ -1203,7 +1203,7 @@ public class FieldRotation> implements Serializabl final T s = q1.multiply(x).add(q2.multiply(y)).add(q3.multiply(z)); final T m0 = q0.negate(); - return new FieldVector3D<>(m0.multiply(m0.multiply(x).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x), + return new FieldVector3D(m0.multiply(m0.multiply(x).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x), m0.multiply(m0.multiply(y).subtract(q3.multiply(x).subtract(q1.multiply(z)))).add(s.multiply(q2)).multiply(2).subtract(y), m0.multiply(m0.multiply(z).subtract(q1.multiply(y).subtract(q2.multiply(x)))).add(s.multiply(q3)).multiply(2).subtract(z)); @@ -1263,7 +1263,7 @@ public class FieldRotation> implements Serializabl final T s = x.multiply(r.getQ1()).add(y.multiply(r.getQ2())).add(z.multiply(r.getQ3())); final double m0 = -r.getQ0(); - return new FieldVector3D<>(x.multiply(m0).subtract(z.multiply(r.getQ2()).subtract(y.multiply(r.getQ3()))).multiply(m0).add(s.multiply(r.getQ1())).multiply(2).subtract(x), + return new FieldVector3D(x.multiply(m0).subtract(z.multiply(r.getQ2()).subtract(y.multiply(r.getQ3()))).multiply(m0).add(s.multiply(r.getQ1())).multiply(2).subtract(x), y.multiply(m0).subtract(x.multiply(r.getQ3()).subtract(z.multiply(r.getQ1()))).multiply(m0).add(s.multiply(r.getQ2())).multiply(2).subtract(y), z.multiply(m0).subtract(y.multiply(r.getQ1()).subtract(x.multiply(r.getQ2()))).multiply(m0).add(s.multiply(r.getQ3())).multiply(2).subtract(z)); @@ -1317,7 +1317,7 @@ public class FieldRotation> implements Serializabl * using vector operator convention */ private FieldRotation composeInternal(final FieldRotation r) { - return new FieldRotation<>(r.q0.multiply(q0).subtract(r.q1.multiply(q1).add(r.q2.multiply(q2)).add(r.q3.multiply(q3))), + return new FieldRotation(r.q0.multiply(q0).subtract(r.q1.multiply(q1).add(r.q2.multiply(q2)).add(r.q3.multiply(q3))), r.q1.multiply(q0).add(r.q0.multiply(q1)).add(r.q2.multiply(q3).subtract(r.q3.multiply(q2))), r.q2.multiply(q0).add(r.q0.multiply(q2)).add(r.q3.multiply(q1).subtract(r.q1.multiply(q3))), r.q3.multiply(q0).add(r.q0.multiply(q3)).add(r.q1.multiply(q2).subtract(r.q2.multiply(q1))), @@ -1372,7 +1372,7 @@ public class FieldRotation> implements Serializabl * using vector operator convention */ private FieldRotation composeInternal(final Rotation r) { - return new FieldRotation<>(q0.multiply(r.getQ0()).subtract(q1.multiply(r.getQ1()).add(q2.multiply(r.getQ2())).add(q3.multiply(r.getQ3()))), + return new FieldRotation(q0.multiply(r.getQ0()).subtract(q1.multiply(r.getQ1()).add(q2.multiply(r.getQ2())).add(q3.multiply(r.getQ3()))), q0.multiply(r.getQ1()).add(q1.multiply(r.getQ0())).add(q3.multiply(r.getQ2()).subtract(q2.multiply(r.getQ3()))), q0.multiply(r.getQ2()).add(q2.multiply(r.getQ0())).add(q1.multiply(r.getQ3()).subtract(q3.multiply(r.getQ1()))), q0.multiply(r.getQ3()).add(q3.multiply(r.getQ0())).add(q2.multiply(r.getQ1()).subtract(q1.multiply(r.getQ2()))), @@ -1391,7 +1391,7 @@ public class FieldRotation> implements Serializabl * @return a new rotation which is the composition of r by the instance */ public static > FieldRotation applyTo(final Rotation r1, final FieldRotation rInner) { - return new FieldRotation<>(rInner.q0.multiply(r1.getQ0()).subtract(rInner.q1.multiply(r1.getQ1()).add(rInner.q2.multiply(r1.getQ2())).add(rInner.q3.multiply(r1.getQ3()))), + return new FieldRotation(rInner.q0.multiply(r1.getQ0()).subtract(rInner.q1.multiply(r1.getQ1()).add(rInner.q2.multiply(r1.getQ2())).add(rInner.q3.multiply(r1.getQ3()))), rInner.q1.multiply(r1.getQ0()).add(rInner.q0.multiply(r1.getQ1())).add(rInner.q2.multiply(r1.getQ3()).subtract(rInner.q3.multiply(r1.getQ2()))), rInner.q2.multiply(r1.getQ0()).add(rInner.q0.multiply(r1.getQ2())).add(rInner.q3.multiply(r1.getQ1()).subtract(rInner.q1.multiply(r1.getQ3()))), rInner.q3.multiply(r1.getQ0()).add(rInner.q0.multiply(r1.getQ3())).add(rInner.q1.multiply(r1.getQ2()).subtract(rInner.q2.multiply(r1.getQ1()))), @@ -1450,7 +1450,7 @@ public class FieldRotation> implements Serializabl * of the instance using vector operator convention */ private FieldRotation composeInverseInternal(FieldRotation r) { - return new FieldRotation<>(r.q0.multiply(q0).add(r.q1.multiply(q1).add(r.q2.multiply(q2)).add(r.q3.multiply(q3))).negate(), + return new FieldRotation(r.q0.multiply(q0).add(r.q1.multiply(q1).add(r.q2.multiply(q2)).add(r.q3.multiply(q3))).negate(), r.q0.multiply(q1).add(r.q2.multiply(q3).subtract(r.q3.multiply(q2))).subtract(r.q1.multiply(q0)), r.q0.multiply(q2).add(r.q3.multiply(q1).subtract(r.q1.multiply(q3))).subtract(r.q2.multiply(q0)), r.q0.multiply(q3).add(r.q1.multiply(q2).subtract(r.q2.multiply(q1))).subtract(r.q3.multiply(q0)), @@ -1509,7 +1509,7 @@ public class FieldRotation> implements Serializabl * of the instance using vector operator convention */ private FieldRotation composeInverseInternal(Rotation r) { - return new FieldRotation<>(q0.multiply(r.getQ0()).add(q1.multiply(r.getQ1()).add(q2.multiply(r.getQ2())).add(q3.multiply(r.getQ3()))).negate(), + return new FieldRotation(q0.multiply(r.getQ0()).add(q1.multiply(r.getQ1()).add(q2.multiply(r.getQ2())).add(q3.multiply(r.getQ3()))).negate(), q1.multiply(r.getQ0()).add(q3.multiply(r.getQ2()).subtract(q2.multiply(r.getQ3()))).subtract(q0.multiply(r.getQ1())), q2.multiply(r.getQ0()).add(q1.multiply(r.getQ3()).subtract(q3.multiply(r.getQ1()))).subtract(q0.multiply(r.getQ2())), q3.multiply(r.getQ0()).add(q2.multiply(r.getQ1()).subtract(q1.multiply(r.getQ2()))).subtract(q0.multiply(r.getQ3())), @@ -1530,7 +1530,7 @@ public class FieldRotation> implements Serializabl * of the instance */ public static > FieldRotation applyInverseTo(final Rotation rOuter, final FieldRotation rInner) { - return new FieldRotation<>(rInner.q0.multiply(rOuter.getQ0()).add(rInner.q1.multiply(rOuter.getQ1()).add(rInner.q2.multiply(rOuter.getQ2())).add(rInner.q3.multiply(rOuter.getQ3()))).negate(), + return new FieldRotation(rInner.q0.multiply(rOuter.getQ0()).add(rInner.q1.multiply(rOuter.getQ1()).add(rInner.q2.multiply(rOuter.getQ2())).add(rInner.q3.multiply(rOuter.getQ3()))).negate(), rInner.q0.multiply(rOuter.getQ1()).add(rInner.q2.multiply(rOuter.getQ3()).subtract(rInner.q3.multiply(rOuter.getQ2()))).subtract(rInner.q1.multiply(rOuter.getQ0())), rInner.q0.multiply(rOuter.getQ2()).add(rInner.q3.multiply(rOuter.getQ1()).subtract(rInner.q1.multiply(rOuter.getQ3()))).subtract(rInner.q2.multiply(rOuter.getQ0())), rInner.q0.multiply(rOuter.getQ3()).add(rInner.q1.multiply(rOuter.getQ2()).subtract(rInner.q2.multiply(rOuter.getQ1()))).subtract(rInner.q3.multiply(rOuter.getQ0())), diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java index bec2d74e8..f03a1ecec 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java @@ -408,7 +408,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D add(final FieldVector3D v) { - return new FieldVector3D<>(x.add(v.x), y.add(v.y), z.add(v.z)); + return new FieldVector3D(x.add(v.x), y.add(v.y), z.add(v.z)); } /** Add a vector to the instance. @@ -416,7 +416,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D add(final Vector3D v) { - return new FieldVector3D<>(x.add(v.getX()), y.add(v.getY()), z.add(v.getZ())); + return new FieldVector3D(x.add(v.getX()), y.add(v.getY()), z.add(v.getZ())); } /** Add a scaled vector to the instance. @@ -425,7 +425,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D add(final T factor, final FieldVector3D v) { - return new FieldVector3D<>(x.getField().getOne(), this, factor, v); + return new FieldVector3D(x.getField().getOne(), this, factor, v); } /** Add a scaled vector to the instance. @@ -434,7 +434,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D add(final T factor, final Vector3D v) { - return new FieldVector3D<>(x.add(factor.multiply(v.getX())), + return new FieldVector3D(x.add(factor.multiply(v.getX())), y.add(factor.multiply(v.getY())), z.add(factor.multiply(v.getZ()))); } @@ -445,7 +445,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D add(final double factor, final FieldVector3D v) { - return new FieldVector3D<>(1.0, this, factor, v); + return new FieldVector3D(1.0, this, factor, v); } /** Add a scaled vector to the instance. @@ -454,7 +454,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D add(final double factor, final Vector3D v) { - return new FieldVector3D<>(x.add(factor * v.getX()), + return new FieldVector3D(x.add(factor * v.getX()), y.add(factor * v.getY()), z.add(factor * v.getZ())); } @@ -464,7 +464,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D subtract(final FieldVector3D v) { - return new FieldVector3D<>(x.subtract(v.x), y.subtract(v.y), z.subtract(v.z)); + return new FieldVector3D(x.subtract(v.x), y.subtract(v.y), z.subtract(v.z)); } /** Subtract a vector from the instance. @@ -472,7 +472,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D subtract(final Vector3D v) { - return new FieldVector3D<>(x.subtract(v.getX()), y.subtract(v.getY()), z.subtract(v.getZ())); + return new FieldVector3D(x.subtract(v.getX()), y.subtract(v.getY()), z.subtract(v.getZ())); } /** Subtract a scaled vector from the instance. @@ -481,7 +481,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D subtract(final T factor, final FieldVector3D v) { - return new FieldVector3D<>(x.getField().getOne(), this, factor.negate(), v); + return new FieldVector3D(x.getField().getOne(), this, factor.negate(), v); } /** Subtract a scaled vector from the instance. @@ -490,7 +490,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D subtract(final T factor, final Vector3D v) { - return new FieldVector3D<>(x.subtract(factor.multiply(v.getX())), + return new FieldVector3D(x.subtract(factor.multiply(v.getX())), y.subtract(factor.multiply(v.getY())), z.subtract(factor.multiply(v.getZ()))); } @@ -501,7 +501,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D subtract(final double factor, final FieldVector3D v) { - return new FieldVector3D<>(1.0, this, -factor, v); + return new FieldVector3D(1.0, this, -factor, v); } /** Subtract a scaled vector from the instance. @@ -510,7 +510,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D subtract(final double factor, final Vector3D v) { - return new FieldVector3D<>(x.subtract(factor * v.getX()), + return new FieldVector3D(x.subtract(factor * v.getX()), y.subtract(factor * v.getY()), z.subtract(factor * v.getZ())); } @@ -551,13 +551,13 @@ public class FieldVector3D> implements Serializabl if (FastMath.abs(x.getReal()) <= threshold) { final T inverse = y.multiply(y).add(z.multiply(z)).sqrt().reciprocal(); - return new FieldVector3D<>(inverse.getField().getZero(), inverse.multiply(z), inverse.multiply(y).negate()); + return new FieldVector3D(inverse.getField().getZero(), inverse.multiply(z), inverse.multiply(y).negate()); } else if (FastMath.abs(y.getReal()) <= threshold) { final T inverse = x.multiply(x).add(z.multiply(z)).sqrt().reciprocal(); - return new FieldVector3D<>(inverse.multiply(z).negate(), inverse.getField().getZero(), inverse.multiply(x)); + return new FieldVector3D(inverse.multiply(z).negate(), inverse.getField().getZero(), inverse.multiply(x)); } else { final T inverse = x.multiply(x).add(y.multiply(y)).sqrt().reciprocal(); - return new FieldVector3D<>(inverse.multiply(y), inverse.multiply(x).negate(), inverse.getField().getZero()); + return new FieldVector3D(inverse.multiply(y), inverse.multiply(x).negate(), inverse.getField().getZero()); } } @@ -655,7 +655,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector which is opposite to the instance */ public FieldVector3D negate() { - return new FieldVector3D<>(x.negate(), y.negate(), z.negate()); + return new FieldVector3D(x.negate(), y.negate(), z.negate()); } /** Multiply the instance by a scalar. @@ -663,7 +663,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D scalarMultiply(final T a) { - return new FieldVector3D<>(x.multiply(a), y.multiply(a), z.multiply(a)); + return new FieldVector3D(x.multiply(a), y.multiply(a), z.multiply(a)); } /** Multiply the instance by a scalar. @@ -671,7 +671,7 @@ public class FieldVector3D> implements Serializabl * @return a new vector */ public FieldVector3D scalarMultiply(final double a) { - return new FieldVector3D<>(x.multiply(a), y.multiply(a), z.multiply(a)); + return new FieldVector3D(x.multiply(a), y.multiply(a), z.multiply(a)); } /** @@ -779,7 +779,7 @@ public class FieldVector3D> implements Serializabl * @return the cross product this ^ v as a new Vector3D */ public FieldVector3D crossProduct(final FieldVector3D v) { - return new FieldVector3D<>(x.linearCombination(y, v.z, z.negate(), v.y), + return new FieldVector3D(x.linearCombination(y, v.z, z.negate(), v.y), y.linearCombination(z, v.x, x.negate(), v.z), z.linearCombination(x, v.y, y.negate(), v.x)); } @@ -789,7 +789,7 @@ public class FieldVector3D> implements Serializabl * @return the cross product this ^ v as a new Vector3D */ public FieldVector3D crossProduct(final Vector3D v) { - return new FieldVector3D<>(x.linearCombination(v.getZ(), y, -v.getY(), z), + return new FieldVector3D(x.linearCombination(v.getZ(), y, -v.getY(), z), y.linearCombination(v.getX(), z, -v.getZ(), x), z.linearCombination(v.getY(), x, -v.getX(), y)); } @@ -993,7 +993,7 @@ public class FieldVector3D> implements Serializabl */ public static > FieldVector3D crossProduct(final Vector3D v1, final FieldVector3D v2) { - return new FieldVector3D<>(v2.x.linearCombination(v1.getY(), v2.z, -v1.getZ(), v2.y), + return new FieldVector3D(v2.x.linearCombination(v1.getY(), v2.z, -v1.getZ(), v2.y), v2.y.linearCombination(v1.getZ(), v2.x, -v1.getX(), v2.z), v2.z.linearCombination(v1.getX(), v2.y, -v1.getY(), v2.x)); } diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java index 67abdd199..a5018134d 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java @@ -203,7 +203,7 @@ public class OutlineExtractor { } // compute the projection of the facet in the outline plane - final ArrayList> edges = new ArrayList<>(); + final ArrayList> edges = new ArrayList>(); for (Vector2D[] loop : vertices) { final boolean closed = loop[0] != null; int previous = closed ? (loop.length - 1) : 1; diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java index b99c9c224..095d6d5c5 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java @@ -162,7 +162,7 @@ public class PolyhedronsSet extends AbstractRegion { final double tolerance) { if ((xMin >= xMax - tolerance) || (yMin >= yMax - tolerance) || (zMin >= zMax - tolerance)) { // too thin box, build an empty polygons set - return new BSPTree<>(Boolean.FALSE); + return new BSPTree(Boolean.FALSE); } final Plane pxMin = new Plane(new Vector3D(xMin, 0, 0), Vector3D.MINUS_I, tolerance); final Plane pxMax = new Plane(new Vector3D(xMax, 0, 0), Vector3D.PLUS_I, tolerance); @@ -226,7 +226,7 @@ public class PolyhedronsSet extends AbstractRegion { } } - final List> boundary = new ArrayList<>(); + final List> boundary = new ArrayList>(); for (final int[] facet : facets) { diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGenerator.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGenerator.java index deef1e911..f28a76299 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGenerator.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGenerator.java @@ -37,15 +37,15 @@ public class SphereGenerator implements SupportBallGenerator ballOnSupport(final List support) { if (support.size() < 1) { - return new EnclosingBall<>(Vector3D.ZERO, Double.NEGATIVE_INFINITY); + return new EnclosingBall(Vector3D.ZERO, Double.NEGATIVE_INFINITY); } else { final Vector3D vA = support.get(0); if (support.size() < 2) { - return new EnclosingBall<>(vA, 0, vA); + return new EnclosingBall(vA, 0, vA); } else { final Vector3D vB = support.get(1); if (support.size() < 3) { - return new EnclosingBall<>(new Vector3D(0.5, vA, 0.5, vB), + return new EnclosingBall(new Vector3D(0.5, vA, 0.5, vB), 0.5 * vA.distance(vB), vA, vB); } else { @@ -61,7 +61,7 @@ public class SphereGenerator implements SupportBallGenerator(p.toSpace(disk.getCenter()), + return new EnclosingBall(p.toSpace(disk.getCenter()), disk.getRadius(), vA, vB, vC); } else { @@ -118,7 +118,7 @@ public class SphereGenerator implements SupportBallGenerator(new Vector3D(centerX.doubleValue(), + return new EnclosingBall(new Vector3D(centerX.doubleValue(), centerY.doubleValue(), centerZ.doubleValue()), FastMath.sqrt(r2.doubleValue()), diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubLine.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubLine.java index 61499d9e5..ae3dc4a5a 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubLine.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubLine.java @@ -85,7 +85,7 @@ public class SubLine { public List getSegments() { final List list = remainingRegion.asList(); - final List segments = new ArrayList<>(list.size()); + final List segments = new ArrayList(list.size()); for (final Interval interval : list) { final Vector3D start = line.toSpace((Point) new Vector1D(interval.getInf())); diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubPlane.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubPlane.java index 0c8958449..89885d4b2 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubPlane.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubPlane.java @@ -67,11 +67,11 @@ public class SubPlane extends AbstractSubHyperplane { // the hyperplanes are parallel final double global = otherPlane.getOffset(thisPlane); if (global < -tolerance) { - return new SplitSubHyperplane<>(null, this); + return new SplitSubHyperplane(null, this); } else if (global > tolerance) { - return new SplitSubHyperplane<>(this, null); + return new SplitSubHyperplane(this, null); } else { - return new SplitSubHyperplane<>(null, null); + return new SplitSubHyperplane(null, null); } } @@ -92,15 +92,15 @@ public class SubPlane extends AbstractSubHyperplane { final BSPTree splitTree = getRemainingRegion().getTree(false).split(l2DMinus); final BSPTree plusTree = getRemainingRegion().isEmpty(splitTree.getPlus()) ? new BSPTree(Boolean.FALSE) : - new BSPTree<>(l2DPlus, new BSPTree(Boolean.FALSE), + new BSPTree(l2DPlus, new BSPTree(Boolean.FALSE), splitTree.getPlus(), null); final BSPTree minusTree = getRemainingRegion().isEmpty(splitTree.getMinus()) ? new BSPTree(Boolean.FALSE) : - new BSPTree<>(l2DMinus, new BSPTree(Boolean.FALSE), + new BSPTree(l2DMinus, new BSPTree(Boolean.FALSE), splitTree.getMinus(), null); - return new SplitSubHyperplane<>(new SubPlane(thisPlane.copySelf(), new PolygonsSet(plusTree, tolerance)), + return new SplitSubHyperplane(new SubPlane(thisPlane.copySelf(), new PolygonsSet(plusTree, tolerance)), new SubPlane(thisPlane.copySelf(), new PolygonsSet(minusTree, tolerance))); } diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGenerator.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGenerator.java index a19a8768a..4cc3546f6 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGenerator.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGenerator.java @@ -33,15 +33,15 @@ public class DiskGenerator implements SupportBallGenerator ballOnSupport(final List support) { if (support.size() < 1) { - return new EnclosingBall<>(Vector2D.ZERO, Double.NEGATIVE_INFINITY); + return new EnclosingBall(Vector2D.ZERO, Double.NEGATIVE_INFINITY); } else { final Vector2D vA = support.get(0); if (support.size() < 2) { - return new EnclosingBall<>(vA, 0, vA); + return new EnclosingBall(vA, 0, vA); } else { final Vector2D vB = support.get(1); if (support.size() < 3) { - return new EnclosingBall<>(new Vector2D(0.5, vA, 0.5, vB), + return new EnclosingBall(new Vector2D(0.5, vA, 0.5, vB), 0.5 * vA.distance(vB), vA, vB); } else { @@ -86,7 +86,7 @@ public class DiskGenerator implements SupportBallGenerator(new Vector2D(centerX.doubleValue(), + return new EnclosingBall(new Vector2D(centerX.doubleValue(), centerY.doubleValue()), FastMath.sqrt(r2.doubleValue()), vA, vB, vC); diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoops.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoops.java index a967fb6de..cb3a2be97 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoops.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoops.java @@ -71,7 +71,7 @@ class NestedLoops { * @since 3.3 */ NestedLoops(final double tolerance) { - this.surrounded = new ArrayList<>(); + this.surrounded = new ArrayList(); this.tolerance = tolerance; } @@ -90,11 +90,11 @@ class NestedLoops { } this.loop = loop; - this.surrounded = new ArrayList<>(); + this.surrounded = new ArrayList(); this.tolerance = tolerance; // build the polygon defined by the loop - final ArrayList> edges = new ArrayList<>(); + final ArrayList> edges = new ArrayList>(); Vector2D current = loop[loop.length - 1]; for (int i = 0; i < loop.length; ++i) { final Vector2D previous = current; @@ -152,7 +152,7 @@ class NestedLoops { } // we should be separate from the remaining children - RegionFactory factory = new RegionFactory<>(); + RegionFactory factory = new RegionFactory(); for (final NestedLoops child : surrounded) { if (!factory.intersection(node.polygon, child.polygon).isEmpty()) { throw new MathIllegalArgumentException(LocalizedFormats.CROSSING_BOUNDARY_LOOPS); diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java index 38b94f493..6dcf2cd95 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java @@ -199,7 +199,7 @@ public class PolygonsSet extends AbstractRegion { final int n = vertices.length; if (n == 0) { // the tree represents the whole space - return new BSPTree<>(Boolean.TRUE); + return new BSPTree(Boolean.TRUE); } // build the vertices @@ -209,7 +209,7 @@ public class PolygonsSet extends AbstractRegion { } // build the edges - List edges = new ArrayList<>(n); + List edges = new ArrayList(n); for (int i = 0; i < n; ++i) { // get the endpoints of the edge @@ -238,7 +238,7 @@ public class PolygonsSet extends AbstractRegion { } // build the tree top-down - final BSPTree tree = new BSPTree<>(); + final BSPTree tree = new BSPTree(); insertEdges(hyperplaneThickness, tree, edges); return tree; @@ -287,8 +287,8 @@ public class PolygonsSet extends AbstractRegion { // we have split the node by inserting an edge as a cut sub-hyperplane // distribute the remaining edges in the two sub-trees - final List plusList = new ArrayList<>(); - final List minusList = new ArrayList<>(); + final List plusList = new ArrayList(); + final List minusList = new ArrayList(); for (final Edge edge : edges) { if (edge != inserted) { final double startOffset = inserted.getLine().getOffset((Point) edge.getStart().getLocation()); @@ -365,7 +365,7 @@ public class PolygonsSet extends AbstractRegion { this.location = location; this.incoming = null; this.outgoing = null; - this.lines = new ArrayList<>(); + this.lines = new ArrayList(); } /** Get Vertex location. @@ -640,7 +640,7 @@ public class PolygonsSet extends AbstractRegion { } // create the segment loops - final ArrayList> loops = new ArrayList<>(); + final ArrayList> loops = new ArrayList>(); for (ConnectableSegment s = getUnprocessed(segments); s != null; s = getUnprocessed(segments)) { final List loop = followLoop(s); if (loop != null) { @@ -824,7 +824,7 @@ public class PolygonsSet extends AbstractRegion { */ private List followLoop(final ConnectableSegment defining) { - final List loop = new ArrayList<>(); + final List loop = new ArrayList(); loop.add(defining); defining.setProcessed(true); @@ -998,7 +998,7 @@ public class PolygonsSet extends AbstractRegion { */ SegmentsBuilder(final double tolerance) { this.tolerance = tolerance; - this.segments = new ArrayList<>(); + this.segments = new ArrayList(); } /** {@inheritDoc} */ diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/SubLine.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/SubLine.java index eb247605e..4f53e6c91 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/SubLine.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/SubLine.java @@ -83,7 +83,7 @@ public class SubLine extends AbstractSubHyperplane { final Line line = (Line) getHyperplane(); final List list = ((IntervalsSet) getRemainingRegion()).asList(); - final List segments = new ArrayList<>(list.size()); + final List segments = new ArrayList(list.size()); for (final Interval interval : list) { final Vector2D start = line.toSpace((Point) new Vector1D(interval.getInf())); @@ -168,11 +168,11 @@ public class SubLine extends AbstractSubHyperplane { // the lines are parallel final double global = otherLine.getOffset(thisLine); if (global < -tolerance) { - return new SplitSubHyperplane<>(null, this); + return new SplitSubHyperplane(null, this); } else if (global > tolerance) { - return new SplitSubHyperplane<>(this, null); + return new SplitSubHyperplane(this, null); } else { - return new SplitSubHyperplane<>(null, null); + return new SplitSubHyperplane(null, null); } } @@ -187,13 +187,13 @@ public class SubLine extends AbstractSubHyperplane { final BSPTree splitTree = getRemainingRegion().getTree(false).split(subMinus); final BSPTree plusTree = getRemainingRegion().isEmpty(splitTree.getPlus()) ? new BSPTree(Boolean.FALSE) : - new BSPTree<>(subPlus, new BSPTree(Boolean.FALSE), + new BSPTree(subPlus, new BSPTree(Boolean.FALSE), splitTree.getPlus(), null); final BSPTree minusTree = getRemainingRegion().isEmpty(splitTree.getMinus()) ? new BSPTree(Boolean.FALSE) : - new BSPTree<>(subMinus, new BSPTree(Boolean.FALSE), + new BSPTree(subMinus, new BSPTree(Boolean.FALSE), splitTree.getMinus(), null); - return new SplitSubHyperplane<>(new SubLine(thisLine.copySelf(), new IntervalsSet(plusTree, tolerance)), + return new SplitSubHyperplane(new SubLine(thisLine.copySelf(), new IntervalsSet(plusTree, tolerance)), new SubLine(thisLine.copySelf(), new IntervalsSet(minusTree, tolerance))); } diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristic.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristic.java index 84be4ac39..2388db050 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristic.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristic.java @@ -84,7 +84,7 @@ public final class AklToussaintHeuristic { return points; } - final List reducedPoints = new ArrayList<>(quadrilateral); + final List reducedPoints = new ArrayList(quadrilateral); for (final Vector2D p : points) { // check all points if they are within the quadrilateral // in which case they can not be part of the convex hull @@ -103,7 +103,7 @@ public final class AklToussaintHeuristic { * @return the quadrilateral */ private static List buildQuadrilateral(final Vector2D... points) { - List quadrilateral = new ArrayList<>(); + List quadrilateral = new ArrayList(); for (Vector2D p : points) { if (!quadrilateral.contains(p)) { quadrilateral.add(p); diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java index 7356da12f..b973e13c3 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java @@ -163,7 +163,7 @@ public class ConvexHull2D implements ConvexHull, Serializ if (vertices.length < 3) { throw new InsufficientDataException(); } - final RegionFactory factory = new RegionFactory<>(); + final RegionFactory factory = new RegionFactory(); final Segment[] segments = retrieveLineSegments(); final Line[] lineArray = new Line[segments.length]; for (int i = 0; i < segments.length; i++) { diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java index 5746c7f17..39caa9935 100644 --- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java +++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java @@ -77,7 +77,7 @@ public class MonotoneChain extends AbstractConvexHullGenerator2D { @Override public Collection findHullVertices(final Collection points) { - final List pointsSortedByXAxis = new ArrayList<>(points); + final List pointsSortedByXAxis = new ArrayList(points); // sort the points in increasing order on the x-axis Collections.sort(pointsSortedByXAxis, new Comparator() { @@ -97,13 +97,13 @@ public class MonotoneChain extends AbstractConvexHullGenerator2D { }); // build lower hull - final List lowerHull = new ArrayList<>(); + final List lowerHull = new ArrayList(); for (Vector2D p : pointsSortedByXAxis) { updateHull(p, lowerHull); } // build upper hull - final List upperHull = new ArrayList<>(); + final List upperHull = new ArrayList(); for (int idx = pointsSortedByXAxis.size() - 1; idx >= 0; idx--) { final Vector2D p = pointsSortedByXAxis.get(idx); updateHull(p, upperHull); @@ -111,7 +111,7 @@ public class MonotoneChain extends AbstractConvexHullGenerator2D { // concatenate the lower and upper hulls // the last point of each list is omitted as it is repeated at the beginning of the other list - final List hullVertices = new ArrayList<>(lowerHull.size() + upperHull.size() - 2); + final List hullVertices = new ArrayList(lowerHull.size() + upperHull.size() - 2); for (int idx = 0; idx < lowerHull.size() - 1; idx++) { hullVertices.add(lowerHull.get(idx)); } diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractRegion.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractRegion.java index 9463bb832..57d2c648f 100644 --- a/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractRegion.java +++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractRegion.java @@ -53,7 +53,7 @@ public abstract class AbstractRegion implement * @param tolerance tolerance below which points are considered identical. */ protected AbstractRegion(final double tolerance) { - this.tree = new BSPTree<>(Boolean.TRUE); + this.tree = new BSPTree(Boolean.TRUE); this.tolerance = tolerance; } @@ -102,14 +102,14 @@ public abstract class AbstractRegion implement if (boundary.size() == 0) { // the tree represents the whole space - tree = new BSPTree<>(Boolean.TRUE); + tree = new BSPTree(Boolean.TRUE); } else { // sort the boundary elements in decreasing size order // (we don't want equal size elements to be removed, so // we use a trick to fool the TreeSet) - final TreeSet> ordered = new TreeSet<>(new Comparator>() { + final TreeSet> ordered = new TreeSet>(new Comparator>() { /** {@inheritDoc} */ @Override public int compare(final SubHyperplane o1, final SubHyperplane o2) { @@ -121,7 +121,7 @@ public abstract class AbstractRegion implement ordered.addAll(boundary); // build the tree top-down - tree = new BSPTree<>(); + tree = new BSPTree(); insertCuts(tree, ordered); // set up the inside/outside flags @@ -161,7 +161,7 @@ public abstract class AbstractRegion implement public AbstractRegion(final Hyperplane[] hyperplanes, final double tolerance) { this.tolerance = tolerance; if ((hyperplanes == null) || (hyperplanes.length == 0)) { - tree = new BSPTree<>(Boolean.FALSE); + tree = new BSPTree(Boolean.FALSE); } else { // use the first hyperplane to build the right class @@ -218,8 +218,8 @@ public abstract class AbstractRegion implement } // distribute the remaining edges in the two sub-trees - final ArrayList> plusList = new ArrayList<>(); - final ArrayList> minusList = new ArrayList<>(); + final ArrayList> plusList = new ArrayList>(); + final ArrayList> minusList = new ArrayList>(); while (iterator.hasNext()) { final SubHyperplane other = iterator.next(); final SubHyperplane.SplitSubHyperplane split = other.split(inserted); @@ -310,7 +310,7 @@ public abstract class AbstractRegion implement */ @Override public BoundaryProjection projectToBoundary(final Point point) { - final BoundaryProjector projector = new BoundaryProjector<>(point); + final BoundaryProjector projector = new BoundaryProjector(point); getTree(true).visit(projector); return projector.getProjection(); } @@ -376,7 +376,7 @@ public abstract class AbstractRegion implement /** {@inheritDoc} */ @Override public double getBoundarySize() { - final BoundarySizeVisitor visitor = new BoundarySizeVisitor<>(); + final BoundarySizeVisitor visitor = new BoundarySizeVisitor(); getTree(true).visit(visitor); return visitor.getSize(); } @@ -485,7 +485,7 @@ public abstract class AbstractRegion implement public AbstractRegion applyTransform(final Transform transform) { // transform the tree, except for boundary attribute splitters - final Map, BSPTree> map = new HashMap<>(); + final Map, BSPTree> map = new HashMap, BSPTree>(); final BSPTree transformedTree = recurseTransform(getTree(false), transform, map); // set up the boundary attributes splitters @@ -519,7 +519,7 @@ public abstract class AbstractRegion implement final BSPTree transformedNode; if (node.getCut() == null) { - transformedNode = new BSPTree<>(node.getAttribute()); + transformedNode = new BSPTree(node.getAttribute()); } else { final SubHyperplane sub = node.getCut(); @@ -531,10 +531,10 @@ public abstract class AbstractRegion implement final SubHyperplane tPI = (attribute.getPlusInside() == null) ? null : ((AbstractSubHyperplane) attribute.getPlusInside()).applyTransform(transform); // we start with an empty list of splitters, it will be filled in out of recursion - attribute = new BoundaryAttribute<>(tPO, tPI, new NodesSet()); + attribute = new BoundaryAttribute(tPO, tPI, new NodesSet()); } - transformedNode = new BSPTree<>(tSub, + transformedNode = new BSPTree(tSub, recurseTransform(node.getPlus(), transform, map), recurseTransform(node.getMinus(), transform, map), attribute); diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractSubHyperplane.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractSubHyperplane.java index 275269e74..76c925c57 100644 --- a/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractSubHyperplane.java +++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractSubHyperplane.java @@ -116,7 +116,7 @@ public abstract class AbstractSubHyperplane final Hyperplane tHyperplane = transform.apply(hyperplane); // transform the tree, except for boundary attribute splitters - final Map, BSPTree> map = new HashMap<>(); + final Map, BSPTree> map = new HashMap, BSPTree>(); final BSPTree tTree = recurseTransform(remainingRegion.getTree(false), tHyperplane, transform, map); @@ -153,7 +153,7 @@ public abstract class AbstractSubHyperplane final BSPTree transformedNode; if (node.getCut() == null) { - transformedNode = new BSPTree<>(node.getAttribute()); + transformedNode = new BSPTree(node.getAttribute()); } else { @SuppressWarnings("unchecked") @@ -164,10 +164,10 @@ public abstract class AbstractSubHyperplane final SubHyperplane tPI = (attribute.getPlusInside() == null) ? null : transform.apply(attribute.getPlusInside(), hyperplane, transformed); // we start with an empty list of splitters, it will be filled in out of recursion - attribute = new BoundaryAttribute<>(tPO, tPI, new NodesSet()); + attribute = new BoundaryAttribute(tPO, tPI, new NodesSet()); } - transformedNode = new BSPTree<>(transform.apply(node.getCut(), hyperplane, transformed), + transformedNode = new BSPTree(transform.apply(node.getCut(), hyperplane, transformed), recurseTransform(node.getPlus(), transformed, transform, map), recurseTransform(node.getMinus(), transformed, transform, map), attribute); diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTree.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTree.java index 0599d8923..16548ddbc 100644 --- a/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTree.java +++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTree.java @@ -163,9 +163,9 @@ public class BSPTree { } cut = chopped; - plus = new BSPTree<>(); + plus = new BSPTree(); plus.parent = this; - minus = new BSPTree<>(); + minus = new BSPTree(); minus.parent = this; return true; @@ -181,10 +181,10 @@ public class BSPTree { public BSPTree copySelf() { if (cut == null) { - return new BSPTree<>(attribute); + return new BSPTree(attribute); } - return new BSPTree<>(cut.copySelf(), plus.copySelf(), minus.copySelf(), + return new BSPTree(cut.copySelf(), plus.copySelf(), minus.copySelf(), attribute); } @@ -340,7 +340,7 @@ public class BSPTree { * than maxOffset from the point) */ public List> getCloseCuts(final Point point, final double maxOffset) { - final List> close = new ArrayList<>(); + final List> close = new ArrayList>(); recurseCloseCuts(point, maxOffset, close); return close; } @@ -554,7 +554,7 @@ public class BSPTree { public BSPTree split(final SubHyperplane sub) { if (cut == null) { - return new BSPTree<>(sub, copySelf(), new BSPTree(attribute), null); + return new BSPTree(sub, copySelf(), new BSPTree(attribute), null); } final Hyperplane cHyperplane = cut.getHyperplane(); @@ -566,12 +566,12 @@ public class BSPTree { final BSPTree split = plus.split(sub); if (cut.split(sHyperplane).getSide() == Side.PLUS) { split.plus = - new BSPTree<>(cut.copySelf(), split.plus, minus.copySelf(), attribute); + new BSPTree(cut.copySelf(), split.plus, minus.copySelf(), attribute); split.plus.condense(); split.plus.parent = split; } else { split.minus = - new BSPTree<>(cut.copySelf(), split.minus, minus.copySelf(), attribute); + new BSPTree(cut.copySelf(), split.minus, minus.copySelf(), attribute); split.minus.condense(); split.minus.parent = split; } @@ -582,12 +582,12 @@ public class BSPTree { final BSPTree split = minus.split(sub); if (cut.split(sHyperplane).getSide() == Side.PLUS) { split.plus = - new BSPTree<>(cut.copySelf(), plus.copySelf(), split.plus, attribute); + new BSPTree(cut.copySelf(), plus.copySelf(), split.plus, attribute); split.plus.condense(); split.plus.parent = split; } else { split.minus = - new BSPTree<>(cut.copySelf(), plus.copySelf(), split.minus, attribute); + new BSPTree(cut.copySelf(), plus.copySelf(), split.minus, attribute); split.minus.condense(); split.minus.parent = split; } @@ -597,7 +597,7 @@ public class BSPTree { { final SubHyperplane.SplitSubHyperplane cutParts = cut.split(sHyperplane); final BSPTree split = - new BSPTree<>(sub, plus.split(subParts.getPlus()), minus.split(subParts.getMinus()), + new BSPTree(sub, plus.split(subParts.getPlus()), minus.split(subParts.getMinus()), null); split.plus.cut = cutParts.getPlus(); split.minus.cut = cutParts.getMinus(); @@ -612,8 +612,8 @@ public class BSPTree { } default : return cHyperplane.sameOrientationAs(sHyperplane) ? - new BSPTree<>(sub, plus.copySelf(), minus.copySelf(), attribute) : - new BSPTree<>(sub, minus.copySelf(), plus.copySelf(), attribute); + new BSPTree(sub, plus.copySelf(), minus.copySelf(), attribute) : + new BSPTree(sub, minus.copySelf(), plus.copySelf(), attribute); } } @@ -710,16 +710,16 @@ public class BSPTree { final Object internalAttributes) { // build the current cell leaf - BSPTree tree = new BSPTree<>(cellAttribute); + BSPTree tree = new BSPTree(cellAttribute); // build the pruned tree bottom-up for (BSPTree current = this; current.parent != null; current = current.parent) { final SubHyperplane parentCut = current.parent.cut.copySelf(); - final BSPTree sibling = new BSPTree<>(otherLeafsAttributes); + final BSPTree sibling = new BSPTree(otherLeafsAttributes); if (current == current.parent.plus) { - tree = new BSPTree<>(parentCut, tree, sibling, internalAttributes); + tree = new BSPTree(parentCut, tree, sibling, internalAttributes); } else { - tree = new BSPTree<>(parentCut, sibling, tree, internalAttributes); + tree = new BSPTree(parentCut, sibling, tree, internalAttributes); } } diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryBuilder.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryBuilder.java index a28623550..2b35eb9a2 100644 --- a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryBuilder.java +++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryBuilder.java @@ -44,18 +44,18 @@ class BoundaryBuilder implements BSPTreeVisitor { // characterize the cut sub-hyperplane, // first with respect to the plus sub-tree - final Characterization plusChar = new Characterization<>(node.getPlus(), node.getCut().copySelf()); + final Characterization plusChar = new Characterization(node.getPlus(), node.getCut().copySelf()); if (plusChar.touchOutside()) { // plusChar.outsideTouching() corresponds to a subset of the cut sub-hyperplane // known to have outside cells on its plus side, we want to check if parts // of this subset do have inside cells on their minus side - final Characterization minusChar = new Characterization<>(node.getMinus(), plusChar.outsideTouching()); + final Characterization minusChar = new Characterization(node.getMinus(), plusChar.outsideTouching()); if (minusChar.touchInside()) { // this part belongs to the boundary, // it has the outside on its plus side and the inside on its minus side plusOutside = minusChar.insideTouching(); - splitters = new NodesSet<>(); + splitters = new NodesSet(); splitters.addAll(minusChar.getInsideSplitters()); splitters.addAll(plusChar.getOutsideSplitters()); } @@ -65,13 +65,13 @@ class BoundaryBuilder implements BSPTreeVisitor { // plusChar.insideTouching() corresponds to a subset of the cut sub-hyperplane // known to have inside cells on its plus side, we want to check if parts // of this subset do have outside cells on their minus side - final Characterization minusChar = new Characterization<>(node.getMinus(), plusChar.insideTouching()); + final Characterization minusChar = new Characterization(node.getMinus(), plusChar.insideTouching()); if (minusChar.touchOutside()) { // this part belongs to the boundary, // it has the inside on its plus side and the outside on its minus side plusInside = minusChar.outsideTouching(); if (splitters == null) { - splitters = new NodesSet<>(); + splitters = new NodesSet(); } splitters.addAll(minusChar.getOutsideSplitters()); splitters.addAll(plusChar.getInsideSplitters()); @@ -86,7 +86,7 @@ class BoundaryBuilder implements BSPTreeVisitor { } // set the boundary attribute at non-leaf nodes - node.setAttribute(new BoundaryAttribute<>(plusOutside, plusInside, splitters)); + node.setAttribute(new BoundaryAttribute(plusOutside, plusInside, splitters)); } diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjector.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjector.java index 212f624d0..afb88849a 100644 --- a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjector.java +++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjector.java @@ -130,7 +130,7 @@ class BoundaryProjector implements BSPTreeVisi // fix offset sign offset = FastMath.copySign(offset, (Boolean) leaf.getAttribute() ? -1 : +1); - return new BoundaryProjection<>(original, projected, offset); + return new BoundaryProjection(original, projected, offset); } @@ -140,7 +140,7 @@ class BoundaryProjector implements BSPTreeVisi */ private List> boundaryRegions(final BSPTree node) { - final List> regions = new ArrayList<>(2); + final List> regions = new ArrayList>(2); @SuppressWarnings("unchecked") final BoundaryAttribute ba = (BoundaryAttribute) node.getAttribute(); diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/Characterization.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/Characterization.java index 9eae3588f..69df9addd 100644 --- a/src/main/java/org/apache/commons/math4/geometry/partitioning/Characterization.java +++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/Characterization.java @@ -56,8 +56,8 @@ class Characterization { Characterization(final BSPTree node, final SubHyperplane sub) { outsideTouching = null; insideTouching = null; - outsideSplitters = new NodesSet<>(); - insideSplitters = new NodesSet<>(); + outsideSplitters = new NodesSet(); + insideSplitters = new NodesSet(); characterize(node, sub, new ArrayList>()); } diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/NodesSet.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/NodesSet.java index 1d55c5ba6..e7588e0aa 100644 --- a/src/main/java/org/apache/commons/math4/geometry/partitioning/NodesSet.java +++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/NodesSet.java @@ -35,7 +35,7 @@ public class NodesSet implements Iterable> { /** Simple constructor. */ public NodesSet() { - list = new ArrayList<>(); + list = new ArrayList>(); } /** Add a node if not already known. diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java index 3b0e7953f..6d4993989 100644 --- a/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java +++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java @@ -176,7 +176,7 @@ public class RegionFactory { private BSPTree recurseComplement(final BSPTree node) { // transform the tree, except for boundary attribute splitters - final Map, BSPTree> map = new HashMap<>(); + final Map, BSPTree> map = new HashMap, BSPTree>(); final BSPTree transformedTree = recurseComplement(node, map); // set up the boundary attributes splitters @@ -208,7 +208,7 @@ public class RegionFactory { final BSPTree transformedNode; if (node.getCut() == null) { - transformedNode = new BSPTree<>(((Boolean) node.getAttribute()) ? Boolean.FALSE : Boolean.TRUE); + transformedNode = new BSPTree(((Boolean) node.getAttribute()) ? Boolean.FALSE : Boolean.TRUE); } else { @SuppressWarnings("unchecked") @@ -219,10 +219,10 @@ public class RegionFactory { final SubHyperplane plusInside = (attribute.getPlusOutside() == null) ? null : attribute.getPlusOutside().copySelf(); // we start with an empty list of splitters, it will be filled in out of recursion - attribute = new BoundaryAttribute<>(plusOutside, plusInside, new NodesSet()); + attribute = new BoundaryAttribute(plusOutside, plusInside, new NodesSet()); } - transformedNode = new BSPTree<>(node.getCut().copySelf(), + transformedNode = new BSPTree(node.getCut().copySelf(), recurseComplement(node.getPlus(), map), recurseComplement(node.getMinus(), map), attribute); @@ -330,7 +330,7 @@ public class RegionFactory { final BSPTree cell = node.pruneAroundConvexCell(Boolean.TRUE, Boolean.FALSE, null); final Region r = region1.buildNew(cell); final Point p = r.getBarycenter(); - return new BSPTree<>(region1.checkPoint(p) == Location.INSIDE && + return new BSPTree(region1.checkPoint(p) == Location.INSIDE && region2.checkPoint(p) == Location.OUTSIDE); } @@ -376,10 +376,10 @@ public class RegionFactory { public BSPTree fixNode(final BSPTree node) { if (node.getPlus().getAttribute().equals(node.getMinus().getAttribute())) { // no ambiguity - return new BSPTree<>(node.getPlus().getAttribute()); + return new BSPTree(node.getPlus().getAttribute()); } else { // ambiguous node - return new BSPTree<>(inside); + return new BSPTree(inside); } } diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java index bc1e3905e..1436ce297 100644 --- a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java +++ b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java @@ -132,7 +132,7 @@ public class ArcsSet extends AbstractRegion implements Itera if (Precision.equals(lower, upper, 0) || (upper - lower) >= MathUtils.TWO_PI) { // the tree must cover the whole circle - return new BSPTree<>(Boolean.TRUE); + return new BSPTree(Boolean.TRUE); } else if (lower > upper) { throw new NumberIsTooLargeException(LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL, lower, upper, true); @@ -148,9 +148,9 @@ public class ArcsSet extends AbstractRegion implements Itera // simple arc starting after 0 and ending before 2 \pi final SubHyperplane upperCut = new LimitAngle(new S1Point(normalizedUpper), true, tolerance).wholeHyperplane(); - return new BSPTree<>(lowerCut, + return new BSPTree(lowerCut, new BSPTree(Boolean.FALSE), - new BSPTree<>(upperCut, + new BSPTree(upperCut, new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null), @@ -159,8 +159,8 @@ public class ArcsSet extends AbstractRegion implements Itera // arc wrapping around 2 \pi final SubHyperplane upperCut = new LimitAngle(new S1Point(normalizedUpper - MathUtils.TWO_PI), true, tolerance).wholeHyperplane(); - return new BSPTree<>(lowerCut, - new BSPTree<>(upperCut, + return new BSPTree(lowerCut, + new BSPTree(upperCut, new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null), @@ -504,9 +504,9 @@ public class ArcsSet extends AbstractRegion implements Itera final double previousOffset = alpha - previous; final double currentOffset = a[0] - alpha; if (previousOffset < currentOffset) { - return new BoundaryProjection<>(point, new S1Point(previous), previousOffset); + return new BoundaryProjection(point, new S1Point(previous), previousOffset); } else { - return new BoundaryProjection<>(point, new S1Point(a[0]), currentOffset); + return new BoundaryProjection(point, new S1Point(a[0]), currentOffset); } } } else if (alpha <= a[1]) { @@ -515,9 +515,9 @@ public class ArcsSet extends AbstractRegion implements Itera final double offset0 = a[0] - alpha; final double offset1 = alpha - a[1]; if (offset0 < offset1) { - return new BoundaryProjection<>(point, new S1Point(a[1]), offset1); + return new BoundaryProjection(point, new S1Point(a[1]), offset1); } else { - return new BoundaryProjection<>(point, new S1Point(a[0]), offset0); + return new BoundaryProjection(point, new S1Point(a[0]), offset0); } } } @@ -527,7 +527,7 @@ public class ArcsSet extends AbstractRegion implements Itera if (Double.isNaN(previous)) { // there are no points at all in the arcs set - return new BoundaryProjection<>(point, null, MathUtils.TWO_PI); + return new BoundaryProjection(point, null, MathUtils.TWO_PI); } else { @@ -538,18 +538,18 @@ public class ArcsSet extends AbstractRegion implements Itera final double previousOffset = alpha - (previous - MathUtils.TWO_PI); final double currentOffset = first - alpha; if (previousOffset < currentOffset) { - return new BoundaryProjection<>(point, new S1Point(previous), previousOffset); + return new BoundaryProjection(point, new S1Point(previous), previousOffset); } else { - return new BoundaryProjection<>(point, new S1Point(first), currentOffset); + return new BoundaryProjection(point, new S1Point(first), currentOffset); } } else { // the test point is between last and 2\pi final double previousOffset = alpha - previous; final double currentOffset = first + MathUtils.TWO_PI - alpha; if (previousOffset < currentOffset) { - return new BoundaryProjection<>(point, new S1Point(previous), previousOffset); + return new BoundaryProjection(point, new S1Point(previous), previousOffset); } else { - return new BoundaryProjection<>(point, new S1Point(first), currentOffset); + return new BoundaryProjection(point, new S1Point(first), currentOffset); } } @@ -565,7 +565,7 @@ public class ArcsSet extends AbstractRegion implements Itera * @return a new ordered list containing {@link Arc Arc} elements */ public List asList() { - final List list = new ArrayList<>(); + final List list = new ArrayList(); for (final double[] a : this) { list.add(new Arc(a[0], a[1], getTolerance())); } @@ -724,8 +724,8 @@ public class ArcsSet extends AbstractRegion implements Itera */ public Split split(final Arc arc) { - final List minus = new ArrayList<>(); - final List plus = new ArrayList<>(); + final List minus = new ArrayList(); + final List plus = new ArrayList(); final double reference = FastMath.PI + arc.getInf(); final double arcLength = arc.getSup() - arc.getInf(); @@ -861,7 +861,7 @@ public class ArcsSet extends AbstractRegion implements Itera } // build the tree by adding all angular sectors - BSPTree tree = new BSPTree<>(Boolean.FALSE); + BSPTree tree = new BSPTree(Boolean.FALSE); for (int i = 0; i < limits.size() - 1; i += 2) { addArcLimit(tree, limits.get(i), true); addArcLimit(tree, limits.get(i + 1), false); diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/SubLimitAngle.java b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/SubLimitAngle.java index 37a6de8b7..31f79fd88 100644 --- a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/SubLimitAngle.java +++ b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/SubLimitAngle.java @@ -59,8 +59,8 @@ public class SubLimitAngle extends AbstractSubHyperplane { public SplitSubHyperplane split(final Hyperplane hyperplane) { final double global = hyperplane.getOffset(((LimitAngle) getHyperplane()).getLocation()); return (global < -1.0e-10) ? - new SplitSubHyperplane<>(null, this) : - new SplitSubHyperplane<>(this, null); + new SplitSubHyperplane(null, this) : + new SplitSubHyperplane(this, null); } } diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/EdgesBuilder.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/EdgesBuilder.java index 86f12c617..002d42ce5 100644 --- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/EdgesBuilder.java +++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/EdgesBuilder.java @@ -55,8 +55,8 @@ class EdgesBuilder implements BSPTreeVisitor { EdgesBuilder(final BSPTree root, final double tolerance) { this.root = root; this.tolerance = tolerance; - this.edgeToNode = new IdentityHashMap<>(); - this.nodeToEdgesList = new IdentityHashMap<>(); + this.edgeToNode = new IdentityHashMap>(); + this.nodeToEdgesList = new IdentityHashMap, List>(); } /** {@inheritDoc} */ @@ -165,7 +165,7 @@ class EdgesBuilder implements BSPTreeVisitor { previous.setNextEdge(getFollowingEdge(previous)); } - return new ArrayList<>(edgeToNode.keySet()); + return new ArrayList(edgeToNode.keySet()); } diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/PropertiesComputer.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/PropertiesComputer.java index b7bcbf03b..eadc2231e 100644 --- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/PropertiesComputer.java +++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/PropertiesComputer.java @@ -50,7 +50,7 @@ class PropertiesComputer implements BSPTreeVisitor { this.tolerance = tolerance; this.summedArea = 0; this.summedBarycenter = Vector3D.ZERO; - this.convexCellsInsidePoints = new ArrayList<>(); + this.convexCellsInsidePoints = new ArrayList(); } /** {@inheritDoc} */ diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java index 6d4d980a5..e84bf581a 100644 --- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java +++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java @@ -59,7 +59,7 @@ public class SphericalPolygonsSet extends AbstractRegion { * @param tolerance below which points are consider to be identical */ public SphericalPolygonsSet(final Vector3D pole, final double tolerance) { - super(new BSPTree<>(new Circle(pole, tolerance).wholeHyperplane(), + super(new BSPTree(new Circle(pole, tolerance).wholeHyperplane(), new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null), @@ -198,7 +198,7 @@ public class SphericalPolygonsSet extends AbstractRegion { final int n = vertices.length; if (n == 0) { // the tree represents the whole space - return new BSPTree<>(Boolean.TRUE); + return new BSPTree(Boolean.TRUE); } // build the vertices @@ -208,7 +208,7 @@ public class SphericalPolygonsSet extends AbstractRegion { } // build the edges - List edges = new ArrayList<>(n); + List edges = new ArrayList(n); Vertex end = vArray[n - 1]; for (int i = 0; i < n; ++i) { @@ -241,7 +241,7 @@ public class SphericalPolygonsSet extends AbstractRegion { } // build the tree top-down - final BSPTree tree = new BSPTree<>(); + final BSPTree tree = new BSPTree(); insertEdges(hyperplaneThickness, tree, edges); return tree; @@ -284,8 +284,8 @@ public class SphericalPolygonsSet extends AbstractRegion { // we have split the node by inserting an edge as a cut sub-hyperplane // distribute the remaining edges in the two sub-trees - final List outsideList = new ArrayList<>(); - final List insideList = new ArrayList<>(); + final List outsideList = new ArrayList(); + final List insideList = new ArrayList(); for (final Edge edge : edges) { if (edge != inserted) { edge.split(inserted.getCircle(), outsideList, insideList); @@ -384,7 +384,7 @@ public class SphericalPolygonsSet extends AbstractRegion { // convert the list of all edges into a list of start vertices - loops = new ArrayList<>(); + loops = new ArrayList(); while (!edges.isEmpty()) { // this is an edge belonging to a new loop, store it @@ -468,10 +468,10 @@ public class SphericalPolygonsSet extends AbstractRegion { // handle special cases first if (isEmpty()) { - return new EnclosingBall<>(S2Point.PLUS_K, Double.NEGATIVE_INFINITY); + return new EnclosingBall(S2Point.PLUS_K, Double.NEGATIVE_INFINITY); } if (isFull()) { - return new EnclosingBall<>(S2Point.PLUS_K, Double.POSITIVE_INFINITY); + return new EnclosingBall(S2Point.PLUS_K, Double.POSITIVE_INFINITY); } // as the polygons is neither empty nor full, it has some boundaries and cut hyperplanes @@ -479,13 +479,13 @@ public class SphericalPolygonsSet extends AbstractRegion { if (isEmpty(root.getMinus()) && isFull(root.getPlus())) { // the polygon covers an hemisphere, and its boundary is one 2Ï€ long edge final Circle circle = (Circle) root.getCut().getHyperplane(); - return new EnclosingBall<>(new S2Point(circle.getPole()).negate(), + return new EnclosingBall(new S2Point(circle.getPole()).negate(), 0.5 * FastMath.PI); } if (isFull(root.getMinus()) && isEmpty(root.getPlus())) { // the polygon covers an hemisphere, and its boundary is one 2Ï€ long edge final Circle circle = (Circle) root.getCut().getHyperplane(); - return new EnclosingBall<>(new S2Point(circle.getPole()), + return new EnclosingBall(new S2Point(circle.getPole()), 0.5 * FastMath.PI); } @@ -505,7 +505,7 @@ public class SphericalPolygonsSet extends AbstractRegion { // find the smallest enclosing 3D sphere final SphereGenerator generator = new SphereGenerator(); final WelzlEncloser encloser = - new WelzlEncloser<>(getTolerance(), generator); + new WelzlEncloser(getTolerance(), generator); EnclosingBall enclosing3D = encloser.enclose(points); final Vector3D[] support3D = enclosing3D.getSupport(); @@ -516,12 +516,12 @@ public class SphericalPolygonsSet extends AbstractRegion { // the 3D sphere is centered on the unit sphere and covers it // fall back to a crude approximation, based only on outside convex cells EnclosingBall enclosingS2 = - new EnclosingBall<>(S2Point.PLUS_K, Double.POSITIVE_INFINITY); + new EnclosingBall(S2Point.PLUS_K, Double.POSITIVE_INFINITY); for (Vector3D outsidePoint : getOutsidePoints()) { final S2Point outsideS2 = new S2Point(outsidePoint); final BoundaryProjection projection = projectToBoundary(outsideS2); if (FastMath.PI - projection.getOffset() < enclosingS2.getRadius()) { - enclosingS2 = new EnclosingBall<>(outsideS2.negate(), + enclosingS2 = new EnclosingBall(outsideS2.negate(), FastMath.PI - projection.getOffset(), (S2Point) projection.getProjected()); } @@ -534,7 +534,7 @@ public class SphericalPolygonsSet extends AbstractRegion { } final EnclosingBall enclosingS2 = - new EnclosingBall<>(new S2Point(enclosing3D.getCenter()), + new EnclosingBall(new S2Point(enclosing3D.getCenter()), FastMath.acos((1 + h * h - r * r) / (2 * h)), support); diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java index ba74b52b4..837c953f4 100644 --- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java +++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java @@ -56,14 +56,14 @@ public class SubCircle extends AbstractSubHyperplane { if (angle < thisCircle.getTolerance() || angle > FastMath.PI - thisCircle.getTolerance()) { // the two circles are aligned or opposite - return new SplitSubHyperplane<>(null, null); + return new SplitSubHyperplane(null, null); } else { // the two circles intersect each other final Arc arc = thisCircle.getInsideArc(otherCircle); final ArcsSet.Split split = ((ArcsSet) getRemainingRegion()).split(arc); final ArcsSet plus = split.getPlus(); final ArcsSet minus = split.getMinus(); - return new SplitSubHyperplane<>(plus == null ? null : new SubCircle(thisCircle.copySelf(), plus), + return new SplitSubHyperplane(plus == null ? null : new SubCircle(thisCircle.copySelf(), plus), minus == null ? null : new SubCircle(thisCircle.copySelf(), minus)); } diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java index a8b1db288..d3102c15a 100644 --- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java +++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java @@ -45,7 +45,7 @@ public class Vertex { this.location = location; this.incoming = null; this.outgoing = null; - this.circles = new ArrayList<>(); + this.circles = new ArrayList(); } /** Get Vertex location. diff --git a/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java index a182e49a9..23c496934 100644 --- a/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java +++ b/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java @@ -270,7 +270,7 @@ public abstract class AbstractFieldMatrix> final char[] binaryRepresentation = Integer.toBinaryString(power) .toCharArray(); - final ArrayList nonZeroPositions = new ArrayList<>(); + final ArrayList nonZeroPositions = new ArrayList(); for (int i = 0; i < binaryRepresentation.length; ++i) { if (binaryRepresentation[i] == '1') { @@ -279,7 +279,7 @@ public abstract class AbstractFieldMatrix> } } - ArrayList> results = new ArrayList<>( + ArrayList> results = new ArrayList>( binaryRepresentation.length); results.add(0, this.copy()); @@ -537,7 +537,7 @@ public abstract class AbstractFieldMatrix> @Override public FieldVector getRowVector(final int row) throws OutOfRangeException { - return new ArrayFieldVector<>(field, getRow(row), false); + return new ArrayFieldVector(field, getRow(row), false); } /** {@inheritDoc} */ @@ -560,7 +560,7 @@ public abstract class AbstractFieldMatrix> @Override public FieldVector getColumnVector(final int column) throws OutOfRangeException { - return new ArrayFieldVector<>(field, getColumn(column), false); + return new ArrayFieldVector(field, getColumn(column), false); } /** {@inheritDoc} */ @@ -726,7 +726,7 @@ public abstract class AbstractFieldMatrix> public FieldVector operate(final FieldVector v) throws DimensionMismatchException { try { - return new ArrayFieldVector<>(field, operate(((ArrayFieldVector) v).getDataRef()), false); + return new ArrayFieldVector(field, operate(((ArrayFieldVector) v).getDataRef()), false); } catch (ClassCastException cce) { final int nRows = getRowDimension(); final int nCols = getColumnDimension(); @@ -743,7 +743,7 @@ public abstract class AbstractFieldMatrix> out[row] = sum; } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } } @@ -774,7 +774,7 @@ public abstract class AbstractFieldMatrix> public FieldVector preMultiply(final FieldVector v) throws DimensionMismatchException { try { - return new ArrayFieldVector<>(field, preMultiply(((ArrayFieldVector) v).getDataRef()), false); + return new ArrayFieldVector(field, preMultiply(((ArrayFieldVector) v).getDataRef()), false); } catch (ClassCastException cce) { final int nRows = getRowDimension(); final int nCols = getColumnDimension(); @@ -791,7 +791,7 @@ public abstract class AbstractFieldMatrix> out[col] = sum; } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } } diff --git a/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java b/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java index 76ef1cb89..4dcf64070 100644 --- a/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java +++ b/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java @@ -198,7 +198,7 @@ public abstract class AbstractRealMatrix */ final char[] binaryRepresentation = Integer.toBinaryString(power).toCharArray(); - final ArrayList nonZeroPositions = new ArrayList<>(); + final ArrayList nonZeroPositions = new ArrayList(); int maxI = -1; for (int i = 0; i < binaryRepresentation.length; ++i) { diff --git a/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java index 7a7093190..70d789486 100644 --- a/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java +++ b/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java @@ -208,13 +208,13 @@ public class Array2DRowFieldMatrix> public FieldMatrix createMatrix(final int rowDimension, final int columnDimension) throws NotStrictlyPositiveException { - return new Array2DRowFieldMatrix<>(getField(), rowDimension, columnDimension); + return new Array2DRowFieldMatrix(getField(), rowDimension, columnDimension); } /** {@inheritDoc} */ @Override public FieldMatrix copy() { - return new Array2DRowFieldMatrix<>(getField(), copyOut(), false); + return new Array2DRowFieldMatrix(getField(), copyOut(), false); } /** @@ -242,7 +242,7 @@ public class Array2DRowFieldMatrix> } } - return new Array2DRowFieldMatrix<>(getField(), outData, false); + return new Array2DRowFieldMatrix(getField(), outData, false); } /** @@ -270,7 +270,7 @@ public class Array2DRowFieldMatrix> } } - return new Array2DRowFieldMatrix<>(getField(), outData, false); + return new Array2DRowFieldMatrix(getField(), outData, false); } @@ -303,7 +303,7 @@ public class Array2DRowFieldMatrix> } } - return new Array2DRowFieldMatrix<>(getField(), outData, false); + return new Array2DRowFieldMatrix(getField(), outData, false); } diff --git a/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java b/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java index b468bb7d1..b2240e6c9 100644 --- a/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java +++ b/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java @@ -388,7 +388,7 @@ public class ArrayFieldVector> implements FieldVector< /** {@inheritDoc} */ @Override public FieldVector copy() { - return new ArrayFieldVector<>(this, true); + return new ArrayFieldVector(this, true); } /** {@inheritDoc} */ @@ -403,7 +403,7 @@ public class ArrayFieldVector> implements FieldVector< for (int i = 0; i < data.length; i++) { out[i] = data[i].add(v.getEntry(i)); } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } } @@ -421,7 +421,7 @@ public class ArrayFieldVector> implements FieldVector< for (int i = 0; i < data.length; i++) { out[i] = data[i].add(v.data[i]); } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } /** {@inheritDoc} */ @@ -436,7 +436,7 @@ public class ArrayFieldVector> implements FieldVector< for (int i = 0; i < data.length; i++) { out[i] = data[i].subtract(v.getEntry(i)); } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } } @@ -454,7 +454,7 @@ public class ArrayFieldVector> implements FieldVector< for (int i = 0; i < data.length; i++) { out[i] = data[i].subtract(v.data[i]); } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } /** {@inheritDoc} */ @@ -464,7 +464,7 @@ public class ArrayFieldVector> implements FieldVector< for (int i = 0; i < data.length; i++) { out[i] = data[i].add(d); } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } /** {@inheritDoc} */ @@ -483,7 +483,7 @@ public class ArrayFieldVector> implements FieldVector< for (int i = 0; i < data.length; i++) { out[i] = data[i].subtract(d); } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } /** {@inheritDoc} */ @@ -502,7 +502,7 @@ public class ArrayFieldVector> implements FieldVector< for (int i = 0; i < data.length; i++) { out[i] = data[i].multiply(d); } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } /** {@inheritDoc} */ @@ -523,7 +523,7 @@ public class ArrayFieldVector> implements FieldVector< for (int i = 0; i < data.length; i++) { out[i] = data[i].divide(d); } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } /** {@inheritDoc} */ @@ -549,7 +549,7 @@ public class ArrayFieldVector> implements FieldVector< throw new MathArithmeticException(LocalizedFormats.INDEX, i); } } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } /** {@inheritDoc} */ @@ -578,7 +578,7 @@ public class ArrayFieldVector> implements FieldVector< for (int i = 0; i < data.length; i++) { out[i] = data[i].multiply(v.getEntry(i)); } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } } @@ -596,7 +596,7 @@ public class ArrayFieldVector> implements FieldVector< for (int i = 0; i < data.length; i++) { out[i] = data[i].multiply(v.data[i]); } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } /** {@inheritDoc} */ @@ -615,7 +615,7 @@ public class ArrayFieldVector> implements FieldVector< throw new MathArithmeticException(LocalizedFormats.INDEX, i); } } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } } @@ -638,7 +638,7 @@ public class ArrayFieldVector> implements FieldVector< throw new MathArithmeticException(LocalizedFormats.INDEX, i); } } - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } /** @@ -710,7 +710,7 @@ public class ArrayFieldVector> implements FieldVector< } catch (ClassCastException cce) { final int m = data.length; final int n = v.getDimension(); - final FieldMatrix out = new Array2DRowFieldMatrix<>(field, m, n); + final FieldMatrix out = new Array2DRowFieldMatrix(field, m, n); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { out.setEntry(i, j, data[i].multiply(v.getEntry(j))); @@ -728,7 +728,7 @@ public class ArrayFieldVector> implements FieldVector< public FieldMatrix outerProduct(ArrayFieldVector v) { final int m = data.length; final int n = v.data.length; - final FieldMatrix out = new Array2DRowFieldMatrix<>(field, m, n); + final FieldMatrix out = new Array2DRowFieldMatrix(field, m, n); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { out.setEntry(i, j, data[i].multiply(v.data[j])); @@ -755,7 +755,7 @@ public class ArrayFieldVector> implements FieldVector< try { return append((ArrayFieldVector) v); } catch (ClassCastException cce) { - return new ArrayFieldVector<>(this,new ArrayFieldVector<>(v)); + return new ArrayFieldVector(this,new ArrayFieldVector(v)); } } @@ -765,7 +765,7 @@ public class ArrayFieldVector> implements FieldVector< * @return a new vector */ public ArrayFieldVector append(ArrayFieldVector v) { - return new ArrayFieldVector<>(this, v); + return new ArrayFieldVector(this, v); } /** {@inheritDoc} */ @@ -774,7 +774,7 @@ public class ArrayFieldVector> implements FieldVector< final T[] out = MathArrays.buildArray(field, data.length + 1); System.arraycopy(data, 0, out, 0, data.length); out[data.length] = in; - return new ArrayFieldVector<>(field, out, false); + return new ArrayFieldVector(field, out, false); } /** {@inheritDoc} */ @@ -784,7 +784,7 @@ public class ArrayFieldVector> implements FieldVector< if (n < 0) { throw new NotPositiveException(LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE, n); } - ArrayFieldVector out = new ArrayFieldVector<>(field, n); + ArrayFieldVector out = new ArrayFieldVector(field, n); try { System.arraycopy(data, index, out.data, 0, n); } catch (IndexOutOfBoundsException e) { diff --git a/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java index 74c6fe8d3..e5294f2c6 100644 --- a/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java +++ b/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java @@ -294,7 +294,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa public FieldMatrix createMatrix(final int rowDimension, final int columnDimension) throws NotStrictlyPositiveException { - return new BlockFieldMatrix<>(getField(), rowDimension, + return new BlockFieldMatrix(getField(), rowDimension, columnDimension); } @@ -303,7 +303,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa public FieldMatrix copy() { // create an empty matrix - BlockFieldMatrix copied = new BlockFieldMatrix<>(getField(), rows, columns); + BlockFieldMatrix copied = new BlockFieldMatrix(getField(), rows, columns); // copy the blocks for (int i = 0; i < blocks.length; ++i) { @@ -324,7 +324,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa // safety check checkAdditionCompatible(m); - final BlockFieldMatrix out = new BlockFieldMatrix<>(getField(), rows, columns); + final BlockFieldMatrix out = new BlockFieldMatrix(getField(), rows, columns); // perform addition block-wise, to ensure good cache behavior int blockIndex = 0; @@ -370,7 +370,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa // safety check checkAdditionCompatible(m); - final BlockFieldMatrix out = new BlockFieldMatrix<>(getField(), rows, columns); + final BlockFieldMatrix out = new BlockFieldMatrix(getField(), rows, columns); // perform addition block-wise, to ensure good cache behavior for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) { @@ -396,7 +396,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa // safety check checkSubtractionCompatible(m); - final BlockFieldMatrix out = new BlockFieldMatrix<>(getField(), rows, columns); + final BlockFieldMatrix out = new BlockFieldMatrix(getField(), rows, columns); // perform subtraction block-wise, to ensure good cache behavior int blockIndex = 0; @@ -440,7 +440,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa // safety check checkSubtractionCompatible(m); - final BlockFieldMatrix out = new BlockFieldMatrix<>(getField(), rows, columns); + final BlockFieldMatrix out = new BlockFieldMatrix(getField(), rows, columns); // perform subtraction block-wise, to ensure good cache behavior for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) { @@ -458,7 +458,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa /** {@inheritDoc} */ @Override public FieldMatrix scalarAdd(final T d) { - final BlockFieldMatrix out = new BlockFieldMatrix<>(getField(), rows, columns); + final BlockFieldMatrix out = new BlockFieldMatrix(getField(), rows, columns); // perform subtraction block-wise, to ensure good cache behavior for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) { @@ -476,7 +476,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa @Override public FieldMatrix scalarMultiply(final T d) { - final BlockFieldMatrix out = new BlockFieldMatrix<>(getField(), rows, columns); + final BlockFieldMatrix out = new BlockFieldMatrix(getField(), rows, columns); // perform subtraction block-wise, to ensure good cache behavior for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) { @@ -501,7 +501,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa // safety check checkMultiplicationCompatible(m); - final BlockFieldMatrix out = new BlockFieldMatrix<>(getField(), rows, m.getColumnDimension()); + final BlockFieldMatrix out = new BlockFieldMatrix(getField(), rows, m.getColumnDimension()); final T zero = getField().getZero(); // perform multiplication block-wise, to ensure good cache behavior @@ -564,7 +564,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa // safety check checkMultiplicationCompatible(m); - final BlockFieldMatrix out = new BlockFieldMatrix<>(getField(), rows, m.columns); + final BlockFieldMatrix out = new BlockFieldMatrix(getField(), rows, m.columns); final T zero = getField().getZero(); // perform multiplication block-wise, to ensure good cache behavior @@ -663,7 +663,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa // create the output matrix final BlockFieldMatrix out = - new BlockFieldMatrix<>(getField(), endRow - startRow + 1, endColumn - startColumn + 1); + new BlockFieldMatrix(getField(), endRow - startRow + 1, endColumn - startColumn + 1); // compute blocks shifts final int blockStartRow = startRow / BLOCK_SIZE; @@ -836,7 +836,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa public FieldMatrix getRowMatrix(final int row) throws OutOfRangeException { checkRowIndex(row); - final BlockFieldMatrix out = new BlockFieldMatrix<>(getField(), 1, columns); + final BlockFieldMatrix out = new BlockFieldMatrix(getField(), 1, columns); // perform copy block-wise, to ensure good cache behavior final int iBlock = row / BLOCK_SIZE; @@ -922,7 +922,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa public FieldMatrix getColumnMatrix(final int column) throws OutOfRangeException { checkColumnIndex(column); - final BlockFieldMatrix out = new BlockFieldMatrix<>(getField(), rows, 1); + final BlockFieldMatrix out = new BlockFieldMatrix(getField(), rows, 1); // perform copy block-wise, to ensure good cache behavior final int jBlock = column / BLOCK_SIZE; @@ -1017,7 +1017,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa outIndex += jWidth; } - return new ArrayFieldVector<>(getField(), outData, false); + return new ArrayFieldVector(getField(), outData, false); } /** {@inheritDoc} */ @@ -1051,7 +1051,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa } } - return new ArrayFieldVector<>(getField(), outData, false); + return new ArrayFieldVector(getField(), outData, false); } /** {@inheritDoc} */ @@ -1220,7 +1220,7 @@ public class BlockFieldMatrix> extends AbstractFieldMa public FieldMatrix transpose() { final int nRows = getRowDimension(); final int nCols = getColumnDimension(); - final BlockFieldMatrix out = new BlockFieldMatrix<>(getField(), nCols, nRows); + final BlockFieldMatrix out = new BlockFieldMatrix(getField(), nCols, nRows); // perform transpose block-wise, to ensure good cache behavior int blockIndex = 0; diff --git a/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java b/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java index e733f42bf..1e4c47317 100644 --- a/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java +++ b/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java @@ -171,7 +171,7 @@ public class FieldLUDecomposition> { public FieldMatrix getL() { if ((cachedL == null) && !singular) { final int m = pivot.length; - cachedL = new Array2DRowFieldMatrix<>(field, m, m); + cachedL = new Array2DRowFieldMatrix(field, m, m); for (int i = 0; i < m; ++i) { final T[] luI = lu[i]; for (int j = 0; j < i; ++j) { @@ -191,7 +191,7 @@ public class FieldLUDecomposition> { public FieldMatrix getU() { if ((cachedU == null) && !singular) { final int m = pivot.length; - cachedU = new Array2DRowFieldMatrix<>(field, m, m); + cachedU = new Array2DRowFieldMatrix(field, m, m); for (int i = 0; i < m; ++i) { final T[] luI = lu[i]; for (int j = i; j < m; ++j) { @@ -214,7 +214,7 @@ public class FieldLUDecomposition> { public FieldMatrix getP() { if ((cachedP == null) && !singular) { final int m = pivot.length; - cachedP = new Array2DRowFieldMatrix<>(field, m, m); + cachedP = new Array2DRowFieldMatrix(field, m, m); for (int i = 0; i < m; ++i) { cachedP.setEntry(i, pivot[i], field.getOne()); } @@ -253,7 +253,7 @@ public class FieldLUDecomposition> { * @return a solver */ public FieldDecompositionSolver getSolver() { - return new Solver<>(field, lu, pivot, singular); + return new Solver(field, lu, pivot, singular); } /** Specialized solver. @@ -332,7 +332,7 @@ public class FieldLUDecomposition> { } } - return new ArrayFieldVector<>(field, bp, false); + return new ArrayFieldVector(field, bp, false); } } @@ -377,7 +377,7 @@ public class FieldLUDecomposition> { } } - return new ArrayFieldVector<>(bp, false); + return new ArrayFieldVector(bp, false); } /** {@inheritDoc} */ @@ -431,7 +431,7 @@ public class FieldLUDecomposition> { } } - return new Array2DRowFieldMatrix<>(field, bp, false); + return new Array2DRowFieldMatrix(field, bp, false); } @@ -440,7 +440,7 @@ public class FieldLUDecomposition> { public FieldMatrix getInverse() { final int m = pivot.length; final T one = field.getOne(); - FieldMatrix identity = new Array2DRowFieldMatrix<>(field, m, m); + FieldMatrix identity = new Array2DRowFieldMatrix(field, m, m); for (int i = 0; i < m; ++i) { identity.setEntry(i, i, one); } diff --git a/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java b/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java index a18c01504..19ff724fa 100644 --- a/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java +++ b/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java @@ -101,7 +101,7 @@ public class MatrixUtils { final int rows, final int columns) { return (rows * columns <= 4096) ? - new Array2DRowFieldMatrix<>(field, rows, columns) : new BlockFieldMatrix<>(field, rows, columns); + new Array2DRowFieldMatrix(field, rows, columns) : new BlockFieldMatrix(field, rows, columns); } /** @@ -161,7 +161,7 @@ public class MatrixUtils { throw new NullArgumentException(); } return (data.length * data[0].length <= 4096) ? - new Array2DRowFieldMatrix<>(data) : new BlockFieldMatrix<>(data); + new Array2DRowFieldMatrix(data) : new BlockFieldMatrix(data); } /** @@ -200,7 +200,7 @@ public class MatrixUtils { Arrays.fill(dRow, zero); dRow[row] = one; } - return new Array2DRowFieldMatrix<>(field, d, false); + return new Array2DRowFieldMatrix(field, d, false); } /** @@ -272,7 +272,7 @@ public class MatrixUtils { if (data.length == 0) { throw new ZeroException(LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT); } - return new ArrayFieldVector<>(data[0].getField(), data, true); + return new ArrayFieldVector(data[0].getField(), data, true); } /** diff --git a/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java b/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java index 34c0b0e9c..860149096 100644 --- a/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java +++ b/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java @@ -315,8 +315,8 @@ public class RealMatrixFormat { } // parse components - List> matrix = new ArrayList<>(); - List rowComponents = new ArrayList<>(); + List> matrix = new ArrayList>(); + List rowComponents = new ArrayList(); for (boolean loop = true; loop;){ if (!rowComponents.isEmpty()) { @@ -329,7 +329,7 @@ public class RealMatrixFormat { CompositeFormat.parseAndIgnoreWhitespace(source, pos); if (CompositeFormat.parseFixedstring(source, trimmedRowSeparator, pos)) { matrix.add(rowComponents); - rowComponents = new ArrayList<>(); + rowComponents = new ArrayList(); continue; } else { loop = false; diff --git a/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java b/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java index 2ffb37865..49de55dd7 100644 --- a/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java +++ b/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java @@ -247,7 +247,7 @@ public class RealVectorFormat { } // parse components - List components = new ArrayList<>(); + List components = new ArrayList(); for (boolean loop = true; loop;){ if (!components.isEmpty()) { diff --git a/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java index 70d599908..b48970c21 100644 --- a/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java +++ b/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java @@ -51,7 +51,7 @@ public class SparseFieldMatrix> extends AbstractFieldM super(field); rows = 0; columns= 0; - entries = new OpenIntToFieldHashMap<>(field); + entries = new OpenIntToFieldHashMap(field); } /** @@ -69,7 +69,7 @@ public class SparseFieldMatrix> extends AbstractFieldM super(field, rowDimension, columnDimension); this.rows = rowDimension; this.columns = columnDimension; - entries = new OpenIntToFieldHashMap<>(field); + entries = new OpenIntToFieldHashMap(field); } /** @@ -81,7 +81,7 @@ public class SparseFieldMatrix> extends AbstractFieldM super(other.getField(), other.getRowDimension(), other.getColumnDimension()); rows = other.getRowDimension(); columns = other.getColumnDimension(); - entries = new OpenIntToFieldHashMap<>(other.entries); + entries = new OpenIntToFieldHashMap(other.entries); } /** @@ -93,7 +93,7 @@ public class SparseFieldMatrix> extends AbstractFieldM super(other.getField(), other.getRowDimension(), other.getColumnDimension()); rows = other.getRowDimension(); columns = other.getColumnDimension(); - entries = new OpenIntToFieldHashMap<>(getField()); + entries = new OpenIntToFieldHashMap(getField()); for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { setEntry(i, j, other.getEntry(i, j)); @@ -118,13 +118,13 @@ public class SparseFieldMatrix> extends AbstractFieldM /** {@inheritDoc} */ @Override public FieldMatrix copy() { - return new SparseFieldMatrix<>(this); + return new SparseFieldMatrix(this); } /** {@inheritDoc} */ @Override public FieldMatrix createMatrix(int rowDimension, int columnDimension) { - return new SparseFieldMatrix<>(getField(), rowDimension, columnDimension); + return new SparseFieldMatrix(getField(), rowDimension, columnDimension); } /** {@inheritDoc} */ diff --git a/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java b/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java index 1bf041dc6..7065f1090 100644 --- a/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java +++ b/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java @@ -77,7 +77,7 @@ public class SparseFieldVector> implements FieldVector public SparseFieldVector(Field field, int dimension) { this.field = field; virtualSize = dimension; - entries = new OpenIntToFieldHashMap<>(field); + entries = new OpenIntToFieldHashMap(field); } /** @@ -89,7 +89,7 @@ public class SparseFieldVector> implements FieldVector protected SparseFieldVector(SparseFieldVector v, int resize) { field = v.field; virtualSize = v.getDimension() + resize; - entries = new OpenIntToFieldHashMap<>(v.entries); + entries = new OpenIntToFieldHashMap(v.entries); } @@ -103,7 +103,7 @@ public class SparseFieldVector> implements FieldVector public SparseFieldVector(Field field, int dimension, int expectedSize) { this.field = field; virtualSize = dimension; - entries = new OpenIntToFieldHashMap<>(field,expectedSize); + entries = new OpenIntToFieldHashMap(field,expectedSize); } /** @@ -118,7 +118,7 @@ public class SparseFieldVector> implements FieldVector MathUtils.checkNotNull(values); this.field = field; virtualSize = values.length; - entries = new OpenIntToFieldHashMap<>(field); + entries = new OpenIntToFieldHashMap(field); for (int key = 0; key < values.length; key++) { T value = values[key]; entries.put(key, value); @@ -133,7 +133,7 @@ public class SparseFieldVector> implements FieldVector public SparseFieldVector(SparseFieldVector v) { field = v.field; virtualSize = v.getDimension(); - entries = new OpenIntToFieldHashMap<>(v.getEntries()); + entries = new OpenIntToFieldHashMap(v.getEntries()); } /** @@ -179,7 +179,7 @@ public class SparseFieldVector> implements FieldVector * @return a new vector. */ public FieldVector append(SparseFieldVector v) { - SparseFieldVector res = new SparseFieldVector<>(this, v.getDimension()); + SparseFieldVector res = new SparseFieldVector(this, v.getDimension()); OpenIntToFieldHashMap.Iterator iter = v.entries.iterator(); while (iter.hasNext()) { iter.advance(); @@ -195,7 +195,7 @@ public class SparseFieldVector> implements FieldVector return append((SparseFieldVector) v); } else { final int n = v.getDimension(); - FieldVector res = new SparseFieldVector<>(this, n); + FieldVector res = new SparseFieldVector(this, n); for (int i = 0; i < n; i++) { res.setEntry(i + virtualSize, v.getEntry(i)); } @@ -209,7 +209,7 @@ public class SparseFieldVector> implements FieldVector @Override public FieldVector append(T d) throws NullArgumentException { MathUtils.checkNotNull(d); - FieldVector res = new SparseFieldVector<>(this, 1); + FieldVector res = new SparseFieldVector(this, 1); res.setEntry(virtualSize, d); return res; } @@ -217,7 +217,7 @@ public class SparseFieldVector> implements FieldVector /** {@inheritDoc} */ @Override public FieldVector copy() { - return new SparseFieldVector<>(this); + return new SparseFieldVector(this); } /** {@inheritDoc} */ @@ -238,7 +238,7 @@ public class SparseFieldVector> implements FieldVector public FieldVector ebeDivide(FieldVector v) throws DimensionMismatchException, MathArithmeticException { checkVectorDimensions(v.getDimension()); - SparseFieldVector res = new SparseFieldVector<>(this); + SparseFieldVector res = new SparseFieldVector(this); OpenIntToFieldHashMap.Iterator iter = res.entries.iterator(); while (iter.hasNext()) { iter.advance(); @@ -252,7 +252,7 @@ public class SparseFieldVector> implements FieldVector public FieldVector ebeMultiply(FieldVector v) throws DimensionMismatchException { checkVectorDimensions(v.getDimension()); - SparseFieldVector res = new SparseFieldVector<>(this); + SparseFieldVector res = new SparseFieldVector(this); OpenIntToFieldHashMap.Iterator iter = res.entries.iterator(); while (iter.hasNext()) { iter.advance(); @@ -289,7 +289,7 @@ public class SparseFieldVector> implements FieldVector } checkIndex(index); checkIndex(index + n - 1); - SparseFieldVector res = new SparseFieldVector<>(field,n); + SparseFieldVector res = new SparseFieldVector(field,n); int end = index + n; OpenIntToFieldHashMap.Iterator iter = entries.iterator(); while (iter.hasNext()) { @@ -387,7 +387,7 @@ public class SparseFieldVector> implements FieldVector */ public FieldMatrix outerProduct(SparseFieldVector v) { final int n = v.getDimension(); - SparseFieldMatrix res = new SparseFieldMatrix<>(field, virtualSize, n); + SparseFieldMatrix res = new SparseFieldMatrix(field, virtualSize, n); OpenIntToFieldHashMap.Iterator iter = entries.iterator(); while (iter.hasNext()) { iter.advance(); @@ -407,7 +407,7 @@ public class SparseFieldVector> implements FieldVector return outerProduct((SparseFieldVector)v); } else { final int n = v.getDimension(); - FieldMatrix res = new SparseFieldMatrix<>(field, virtualSize, n); + FieldMatrix res = new SparseFieldMatrix(field, virtualSize, n); OpenIntToFieldHashMap.Iterator iter = entries.iterator(); while (iter.hasNext()) { iter.advance(); @@ -495,7 +495,7 @@ public class SparseFieldVector> implements FieldVector } else { final int n = v.getDimension(); checkVectorDimensions(n); - SparseFieldVector res = new SparseFieldVector<>(this); + SparseFieldVector res = new SparseFieldVector(this); for (int i = 0; i < n; i++) { if (entries.containsKey(i)) { res.setEntry(i, entries.get(i).subtract(v.getEntry(i))); @@ -578,7 +578,7 @@ public class SparseFieldVector> implements FieldVector } else { final int n = v.getDimension(); checkVectorDimensions(n); - SparseFieldVector res = new SparseFieldVector<>(field, + SparseFieldVector res = new SparseFieldVector(field, getDimension()); for (int i = 0; i < n; i++) { res.setEntry(i, v.getEntry(i).add(getEntry(i))); diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java b/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java index f655065a7..bd264bb1e 100644 --- a/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java +++ b/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java @@ -38,7 +38,7 @@ public class Cluster implements Serializable { * Build a cluster centered at a specified point. */ public Cluster() { - points = new ArrayList<>(); + points = new ArrayList(); } /** diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java index a5614337e..1223be84f 100644 --- a/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java +++ b/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java @@ -136,8 +136,8 @@ public class DBSCANClusterer extends Clusterer { // sanity checks MathUtils.checkNotNull(points); - final List> clusters = new ArrayList<>(); - final Map visited = new HashMap<>(); + final List> clusters = new ArrayList>(); + final Map visited = new HashMap(); for (final T point : points) { if (visited.get(point) != null) { @@ -146,7 +146,7 @@ public class DBSCANClusterer extends Clusterer { final List neighbors = getNeighbors(point, points); if (neighbors.size() >= minPts) { // DBSCAN does not care about center points - final Cluster cluster = new Cluster<>(); + final Cluster cluster = new Cluster(); clusters.add(expandCluster(cluster, point, neighbors, points, visited)); } else { visited.put(point, PointStatus.NOISE); @@ -174,7 +174,7 @@ public class DBSCANClusterer extends Clusterer { cluster.addPoint(point); visited.put(point, PointStatus.PART_OF_CLUSTER); - List seeds = new ArrayList<>(neighbors); + List seeds = new ArrayList(neighbors); int index = 0; while (index < seeds.size()) { final T current = seeds.get(index); @@ -205,7 +205,7 @@ public class DBSCANClusterer extends Clusterer { * @return the List of neighbors */ private List getNeighbors(final T point, final Collection points) { - final List neighbors = new ArrayList<>(); + final List neighbors = new ArrayList(); for (final T neighbor : points) { if (point != neighbor && distance(neighbor, point) <= eps) { neighbors.add(neighbor); @@ -222,7 +222,7 @@ public class DBSCANClusterer extends Clusterer { * @return merged lists */ private List merge(final List one, final List two) { - final Set oneSet = new HashSet<>(one); + final Set oneSet = new HashSet(one); for (T item : two) { if (!oneSet.contains(item)) { one.add(item); diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java index 7ef632f52..e57697f37 100644 --- a/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java +++ b/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java @@ -279,8 +279,8 @@ public class FuzzyKMeansClusterer extends Clusterer { } // copy the input collection to an unmodifiable list with indexed access - points = Collections.unmodifiableList(new ArrayList<>(dataPoints)); - clusters = new ArrayList<>(); + points = Collections.unmodifiableList(new ArrayList(dataPoints)); + clusters = new ArrayList>(); membershipMatrix = new double[size][k]; final double[][] oldMatrix = new double[size][k]; @@ -316,7 +316,7 @@ public class FuzzyKMeansClusterer extends Clusterer { */ private void updateClusterCenters() { int j = 0; - final List> newClusters = new ArrayList<>(k); + final List> newClusters = new ArrayList>(k); for (final CentroidCluster cluster : clusters) { final Clusterable center = cluster.getCenter(); int i = 0; diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java index 79dca8e16..1901013d0 100644 --- a/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java +++ b/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java @@ -216,7 +216,7 @@ public class KMeansPlusPlusClusterer extends Clusterer final int max = (maxIterations < 0) ? Integer.MAX_VALUE : maxIterations; for (int count = 0; count < max; count++) { boolean emptyCluster = false; - List> newClusters = new ArrayList<>(); + List> newClusters = new ArrayList>(); for (final CentroidCluster cluster : clusters) { final Clusterable newCenter; if (cluster.getPoints().isEmpty()) { @@ -288,7 +288,7 @@ public class KMeansPlusPlusClusterer extends Clusterer // Convert to list for indexed access. Make it unmodifiable, since removal of items // would screw up the logic of this method. - final List pointList = Collections.unmodifiableList(new ArrayList<> (points)); + final List pointList = Collections.unmodifiableList(new ArrayList (points)); // The number of points in the list. final int numPoints = pointList.size(); @@ -298,7 +298,7 @@ public class KMeansPlusPlusClusterer extends Clusterer final boolean[] taken = new boolean[numPoints]; // The resulting list of initial centers. - final List> resultSet = new ArrayList<>(); + final List> resultSet = new ArrayList>(); // Choose one center uniformly at random from among the data points. final int firstPointIndex = random.nextInt(numPoints); diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java index a793fa0ac..d097edd39 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java @@ -105,7 +105,7 @@ public class MapUtils { } } - return new Pair<>(best[0], best[1]); + return new Pair(best[0], best[1]); } /** @@ -130,7 +130,7 @@ public class MapUtils { public static Neuron[] sort(double[] features, Iterable neurons, DistanceMeasure distance) { - final List list = new ArrayList<>(); + final List list = new ArrayList(); for (final Neuron n : neurons) { final double d = distance.compute(n.getFeatures(), features); @@ -196,7 +196,7 @@ public class MapUtils { public static int[][] computeHitHistogram(Iterable data, NeuronSquareMesh2D map, DistanceMeasure distance) { - final HashMap hit = new HashMap<>(); + final HashMap hit = new HashMap(); final Network net = map.getNetwork(); for (double[] f : data) { diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java index 6da635ea0..6dcd729b7 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java @@ -51,14 +51,14 @@ public class Network private static final long serialVersionUID = 20130207L; /** Neurons. */ private final ConcurrentHashMap neuronMap - = new ConcurrentHashMap<>(); + = new ConcurrentHashMap(); /** Next available neuron identifier. */ private final AtomicLong nextId; /** Neuron's features set size. */ private final int featureSize; /** Links. */ private final ConcurrentHashMap> linkMap - = new ConcurrentHashMap<>(); + = new ConcurrentHashMap>(); /** * Comparator that prescribes an order of the neurons according @@ -155,7 +155,7 @@ public class Network } for (Map.Entry> e : linkMap.entrySet()) { - copy.linkMap.put(e.getKey(), new HashSet<>(e.getValue())); + copy.linkMap.put(e.getKey(), new HashSet(e.getValue())); } return copy; @@ -178,7 +178,7 @@ public class Network * @see NeuronIdentifierComparator */ public Collection getNeurons(Comparator comparator) { - final List neurons = new ArrayList<>(); + final List neurons = new ArrayList(); neurons.addAll(neuronMap.values()); Collections.sort(neurons, comparator); @@ -356,7 +356,7 @@ public class Network */ public Collection getNeighbours(Iterable neurons, Iterable exclude) { - final Set idList = new HashSet<>(); + final Set idList = new HashSet(); for (Neuron n : neurons) { idList.addAll(linkMap.get(n.getIdentifier())); @@ -367,7 +367,7 @@ public class Network } } - final List neuronList = new ArrayList<>(); + final List neuronList = new ArrayList(); for (Long id : idList) { neuronList.add(getNeuron(id)); } @@ -403,7 +403,7 @@ public class Network } } - final List neuronList = new ArrayList<>(); + final List neuronList = new ArrayList(); for (Long id : idList) { neuronList.add(getNeuron(id)); } diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java index 61b3aa192..56f19768a 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java @@ -63,7 +63,7 @@ public class Neuron implements Serializable { double[] features) { this.identifier = identifier; this.size = features.length; - this.features = new AtomicReference<>(features.clone()); + this.features = new AtomicReference(features.clone()); } /** diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java index 1c49d0638..87e1bbca2 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java @@ -111,10 +111,10 @@ public class KohonenUpdateAction implements UpdateAction { if (currentNeighbourhood > 0) { // Initial set of neurons only contains the winning neuron. - Collection neighbours = new HashSet<>(); + Collection neighbours = new HashSet(); neighbours.add(best); // Winning neuron must be excluded from the neighbours. - final HashSet exclude = new HashSet<>(); + final HashSet exclude = new HashSet(); exclude.add(best); int radius = 1; diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java index e42491d63..38bd60846 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java @@ -423,7 +423,7 @@ public class NeuronSquareMesh2D */ private void createLinks() { // "linkEnd" will store the identifiers of the "neighbours". - final List linkEnd = new ArrayList<>(); + final List linkEnd = new ArrayList(); final int iLast = numberOfRows - 1; final int jLast = numberOfColumns - 1; for (int i = 0; i < numberOfRows; i++) { diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/util/LocationFinder.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/util/LocationFinder.java index 7785f7b5d..fa02e3aac 100644 --- a/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/util/LocationFinder.java +++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/util/LocationFinder.java @@ -29,7 +29,7 @@ import org.apache.commons.math4.exception.MathIllegalStateException; */ public class LocationFinder { /** Identifier to location mapping. */ - private final Map locations = new HashMap<>(); + private final Map locations = new HashMap(); /** * Container holding a (row, column) pair. diff --git a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java index 2475a482a..c61da98a1 100644 --- a/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/AbstractFieldIntegrator.java @@ -95,10 +95,10 @@ public abstract class AbstractFieldIntegrator> imp protected AbstractFieldIntegrator(final Field field, final String name) { this.field = field; this.name = name; - stepHandlers = new ArrayList<>(); + stepHandlers = new ArrayList>(); stepStart = null; stepSize = null; - eventsStates = new ArrayList<>(); + eventsStates = new ArrayList>(); statesInitialized = false; evaluations = IntegerSequence.Incrementor.create().withMaximalCount(Integer.MAX_VALUE); } @@ -142,7 +142,7 @@ public abstract class AbstractFieldIntegrator> imp final int maxIterationCount) { addEventHandler(handler, maxCheckInterval, convergence, maxIterationCount, - new FieldBracketingNthOrderBrentSolver<>(field.getZero().add(DEFAULT_RELATIVE_ACCURACY), + new FieldBracketingNthOrderBrentSolver(field.getZero().add(DEFAULT_RELATIVE_ACCURACY), field.getZero().add(convergence), field.getZero().add(DEFAULT_FUNCTION_VALUE_ACCURACY), 5)); @@ -155,14 +155,14 @@ public abstract class AbstractFieldIntegrator> imp final double convergence, final int maxIterationCount, final BracketedRealFieldUnivariateSolver solver) { - eventsStates.add(new FieldEventState<>(handler, maxCheckInterval, field.getZero().add(convergence), + eventsStates.add(new FieldEventState(handler, maxCheckInterval, field.getZero().add(convergence), maxIterationCount, solver)); } /** {@inheritDoc} */ @Override public Collection> getEventHandlers() { - final List> list = new ArrayList<>(eventsStates.size()); + final List> list = new ArrayList>(eventsStates.size()); for (FieldEventState state : eventsStates) { list.add(state.getEventHandler()); } @@ -223,7 +223,7 @@ public abstract class AbstractFieldIntegrator> imp // set up derivatives of initial state final T[] y0Dot = computeDerivatives(t0, y0); - final FieldODEStateAndDerivative state0 = new FieldODEStateAndDerivative<>(t0, y0, y0Dot); + final FieldODEStateAndDerivative state0 = new FieldODEStateAndDerivative(t0, y0, y0Dot); // initialize event handlers for (final FieldEventState state : eventsStates) { @@ -307,7 +307,7 @@ public abstract class AbstractFieldIntegrator> imp // search for next events that may occur during the step final int orderingSign = interpolator.isForward() ? +1 : -1; - SortedSet> occurringEvents = new TreeSet<>(new Comparator>() { + SortedSet> occurringEvents = new TreeSet>(new Comparator>() { /** {@inheritDoc} */ @Override diff --git a/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java b/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java index e4dd02f9e..072889a00 100644 --- a/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java @@ -82,10 +82,10 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator { */ public AbstractIntegrator(final String name) { this.name = name; - stepHandlers = new ArrayList<>(); + stepHandlers = new ArrayList(); stepStart = Double.NaN; stepSize = Double.NaN; - eventsStates = new ArrayList<>(); + eventsStates = new ArrayList(); statesInitialized = false; evaluations = IntegerSequence.Incrementor.create().withMaximalCount(Integer.MAX_VALUE); } @@ -145,7 +145,7 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator { /** {@inheritDoc} */ @Override public Collection getEventHandlers() { - final List list = new ArrayList<>(eventsStates.size()); + final List list = new ArrayList(eventsStates.size()); for (EventState state : eventsStates) { list.add(state.getEventHandler()); } @@ -341,7 +341,7 @@ public abstract class AbstractIntegrator implements FirstOrderIntegrator { // search for next events that may occur during the step final int orderingSign = interpolator.isForward() ? +1 : -1; - SortedSet occurringEvents = new TreeSet<>(new Comparator() { + SortedSet occurringEvents = new TreeSet(new Comparator() { /** {@inheritDoc} */ @Override diff --git a/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java b/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java index c21365d64..5b4aea718 100644 --- a/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java +++ b/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java @@ -33,7 +33,7 @@ public abstract class AbstractParameterizable implements Parameterizable { * @param names names of the supported parameters */ protected AbstractParameterizable(final String ... names) { - parametersNames = new ArrayList<>(); + parametersNames = new ArrayList(); for (final String name : names) { parametersNames.add(name); } @@ -43,7 +43,7 @@ public abstract class AbstractParameterizable implements Parameterizable { * @param names names of the supported parameters */ protected AbstractParameterizable(final Collection names) { - parametersNames = new ArrayList<>(); + parametersNames = new ArrayList(); parametersNames.addAll(names); } diff --git a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java index b1d8be215..e8b96a1a7 100644 --- a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java +++ b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputFieldModel.java @@ -100,7 +100,7 @@ public class ContinuousOutputFieldModel> * Build an empty continuous output model. */ public ContinuousOutputFieldModel() { - steps = new ArrayList<>(); + steps = new ArrayList>(); initialTime = null; finalTime = null; forward = true; diff --git a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java index 8f6384769..e48dff934 100644 --- a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java +++ b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java @@ -111,7 +111,7 @@ public class ContinuousOutputModel * Build an empty continuous output model. */ public ContinuousOutputModel() { - steps = new ArrayList<>(); + steps = new ArrayList(); initialTime = Double.NaN; finalTime = Double.NaN; forward = true; diff --git a/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java b/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java index 476b9ffb6..77e50bcf8 100644 --- a/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java +++ b/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java @@ -76,7 +76,7 @@ public class ExpandableStatefulODE { this.time = Double.NaN; this.primaryState = new double[n]; this.primaryStateDot = new double[n]; - this.components = new ArrayList<>(); + this.components = new ArrayList(); } /** Get the primary set of differential equations. @@ -138,7 +138,7 @@ public class ExpandableStatefulODE { final int firstIndex; if (components.isEmpty()) { // lazy creation of the components list - components = new ArrayList<>(); + components = new ArrayList(); firstIndex = primary.getDimension(); } else { final SecondaryComponent last = components.get(components.size() - 1); diff --git a/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java b/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java index cafdd662b..1febe7d83 100644 --- a/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java +++ b/src/main/java/org/apache/commons/math4/ode/FieldEquationsMapper.java @@ -130,7 +130,7 @@ public class FieldEquationsMapper> implements Seri final T[] state = extractEquationData(index, y); final T[] derivative = extractEquationData(index, yDot); if (n < 2) { - return new FieldODEStateAndDerivative<>(t, state, derivative); + return new FieldODEStateAndDerivative(t, state, derivative); } else { final T[][] secondaryState = MathArrays.buildArray(t.getField(), n - 1, -1); final T[][] secondaryDerivative = MathArrays.buildArray(t.getField(), n - 1, -1); @@ -138,7 +138,7 @@ public class FieldEquationsMapper> implements Seri secondaryState[index - 1] = extractEquationData(index, y); secondaryDerivative[index - 1] = extractEquationData(index, yDot); } - return new FieldODEStateAndDerivative<>(t, state, derivative, secondaryState, secondaryDerivative); + return new FieldODEStateAndDerivative(t, state, derivative, secondaryState, secondaryDerivative); } } 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 8dddaad83..e5dd205db 100644 --- a/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java +++ b/src/main/java/org/apache/commons/math4/ode/FieldExpandableODE.java @@ -65,8 +65,8 @@ public class FieldExpandableODE> { */ public FieldExpandableODE(final FirstOrderFieldDifferentialEquations primary) { this.primary = primary; - this.components = new ArrayList<>(); - this.mapper = new FieldEquationsMapper<>(null, primary.getDimension()); + this.components = new ArrayList>(); + this.mapper = new FieldEquationsMapper(null, primary.getDimension()); } /** Get the mapper for the set of equations. @@ -86,7 +86,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(); diff --git a/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java b/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java index 2efed92c6..129662032 100644 --- a/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java +++ b/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java @@ -141,7 +141,7 @@ public class JacobianMatrices { } this.dirtyParameter = false; - this.jacobianProviders = new ArrayList<>(); + this.jacobianProviders = new ArrayList(); // set the default initial state Jacobian to the identity // and the default initial parameters Jacobian to the null matrix diff --git a/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java index edd65e261..fdb1d907c 100644 --- a/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/MultistepFieldIntegrator.java @@ -130,7 +130,7 @@ public abstract class MultistepFieldIntegrator> nSteps, 2, true); } - starter = new DormandPrince853FieldIntegrator<>(field, minStep, maxStep, + starter = new DormandPrince853FieldIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); this.nSteps = nSteps; @@ -170,7 +170,7 @@ public abstract class MultistepFieldIntegrator> final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance) { super(field, name, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); - starter = new DormandPrince853FieldIntegrator<>(field, minStep, maxStep, + starter = new DormandPrince853FieldIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); this.nSteps = nSteps; diff --git a/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java b/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java index e28c185e7..d555aa471 100644 --- a/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java +++ b/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java @@ -51,7 +51,7 @@ class ParameterJacobianWrapper implements ParameterJacobianProvider { final ParameterConfiguration[] paramsAndSteps) { this.fode = fode; this.pode = pode; - this.hParam = new HashMap<>(); + this.hParam = new HashMap(); // set up parameters for jacobian computation for (final ParameterConfiguration param : paramsAndSteps) { diff --git a/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java b/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java index 0d2521d6f..c306ec875 100644 --- a/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java +++ b/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java @@ -61,7 +61,7 @@ class ParameterizedWrapper implements ParameterizedODE { /** {@inheritDoc} */ @Override public Collection getParametersNames() { - return new ArrayList<>(); + return new ArrayList(); } /** {@inheritDoc} */ diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java index ebb31f0aa..977573e3f 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegrator.java @@ -301,7 +301,7 @@ public class AdamsBashforthFieldIntegrator> extend } // discrete events handling - setStepStart(acceptStep(new AdamsFieldStepInterpolator<>(getStepSize(), stepEnd, + setStepStart(acceptStep(new AdamsFieldStepInterpolator(getStepSize(), stepEnd, predictedScaled, predictedNordsieck, forward, getStepStart(), stepEnd, equations.getMapper()), diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldStepInterpolator.java index feac005cf..b4b5357c4 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldStepInterpolator.java @@ -103,7 +103,7 @@ class AdamsFieldStepInterpolator> extends Abstract this.scalingH = stepSize; this.reference = reference; this.scaled = scaled.clone(); - this.nordsieck = new Array2DRowFieldMatrix<>(nordsieck.getData(), false); + this.nordsieck = new Array2DRowFieldMatrix(nordsieck.getData(), false); } /** Create a new instance. @@ -121,7 +121,7 @@ class AdamsFieldStepInterpolator> extends Abstract FieldODEStateAndDerivative newSoftPreviousState, FieldODEStateAndDerivative newSoftCurrentState, FieldEquationsMapper newMapper) { - return new AdamsFieldStepInterpolator<>(scalingH, reference, scaled, nordsieck, + return new AdamsFieldStepInterpolator(scalingH, reference, scaled, nordsieck, newForward, newGlobalPreviousState, newGlobalCurrentState, newSoftPreviousState, newSoftCurrentState, @@ -181,7 +181,7 @@ class AdamsFieldStepInterpolator> extends Abstract estimatedDerivatives[j].add(scaled[j].multiply(normalizedAbscissa)).divide(x); } - return new FieldODEStateAndDerivative<>(time, estimatedState, estimatedDerivatives); + return new FieldODEStateAndDerivative(time, estimatedState, estimatedDerivatives); } diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegrator.java index 72d4de225..c659cc003 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegrator.java @@ -284,8 +284,8 @@ public class AdamsMoultonFieldIntegrator> extends updateHighOrderDerivativesPhase2(predictedScaled, correctedScaled, predictedNordsieck); // discrete events handling - stepEnd = new FieldODEStateAndDerivative<>(stepEnd.getTime(), predictedY, correctedYDot); - setStepStart(acceptStep(new AdamsFieldStepInterpolator<>(getStepSize(), stepEnd, + stepEnd = new FieldODEStateAndDerivative(stepEnd.getTime(), predictedY, correctedYDot); + setStepStart(acceptStep(new AdamsFieldStepInterpolator(getStepSize(), stepEnd, correctedScaled, predictedNordsieck, forward, getStepStart(), stepEnd, equations.getMapper()), diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckFieldTransformer.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckFieldTransformer.java index 7c2b872f7..c1e5beea5 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckFieldTransformer.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckFieldTransformer.java @@ -137,7 +137,8 @@ public class AdamsNordsieckFieldTransformer> { private static final Map>, AdamsNordsieckFieldTransformer>>> CACHE = - new HashMap<>(); + new HashMap>, + AdamsNordsieckFieldTransformer>>>(); /** Field to which the time and state vector elements belong. */ private final Field field; @@ -161,11 +162,11 @@ public class AdamsNordsieckFieldTransformer> { // compute coefficients FieldMatrix bigP = buildP(rows); FieldDecompositionSolver pSolver = - new FieldLUDecomposition<>(bigP).getSolver(); + new FieldLUDecomposition(bigP).getSolver(); T[] u = MathArrays.buildArray(field, rows); Arrays.fill(u, field.getOne()); - c1 = pSolver.solve(new ArrayFieldVector<>(u, false)).toArray(); + c1 = pSolver.solve(new ArrayFieldVector(u, false)).toArray(); // update coefficients are computed by combining transform from // Nordsieck to multistep, then shifting rows to represent step advance @@ -177,7 +178,7 @@ public class AdamsNordsieckFieldTransformer> { } shiftedP[0] = MathArrays.buildArray(field, rows); Arrays.fill(shiftedP[0], field.getZero()); - update = new Array2DRowFieldMatrix<>(pSolver.solve(new Array2DRowFieldMatrix<>(shiftedP, false)).getData()); + update = new Array2DRowFieldMatrix(pSolver.solve(new Array2DRowFieldMatrix(shiftedP, false)).getData()); } @@ -194,13 +195,14 @@ public class AdamsNordsieckFieldTransformer> { Map>, AdamsNordsieckFieldTransformer>> map = CACHE.get(nSteps); if (map == null) { - map = new HashMap<>(); + map = new HashMap>, + AdamsNordsieckFieldTransformer>>(); CACHE.put(nSteps, map); } @SuppressWarnings("unchecked") AdamsNordsieckFieldTransformer t = (AdamsNordsieckFieldTransformer) map.get(field); if (t == null) { - t = new AdamsNordsieckFieldTransformer<>(field, nSteps); + t = new AdamsNordsieckFieldTransformer(field, nSteps); map.put(field, t); } return t; @@ -237,7 +239,7 @@ public class AdamsNordsieckFieldTransformer> { } } - return new Array2DRowFieldMatrix<>(pData, false); + return new Array2DRowFieldMatrix(pData, false); } @@ -301,12 +303,12 @@ public class AdamsNordsieckFieldTransformer> { // solve the linear system to get the best estimate of the Nordsieck vector [s2 ... sk], // with the additional terms s(k+1) and c grabbing the parts after the truncated Taylor expansion - final FieldLUDecomposition decomposition = new FieldLUDecomposition<>(new Array2DRowFieldMatrix<>(a, false)); - final FieldMatrix x = decomposition.getSolver().solve(new Array2DRowFieldMatrix<>(b, false)); + final FieldLUDecomposition decomposition = new FieldLUDecomposition(new Array2DRowFieldMatrix(a, false)); + final FieldMatrix x = decomposition.getSolver().solve(new Array2DRowFieldMatrix(b, false)); // extract just the Nordsieck vector [s2 ... sk] final Array2DRowFieldMatrix truncatedX = - new Array2DRowFieldMatrix<>(field, x.getRowDimension() - 1, x.getColumnDimension()); + new Array2DRowFieldMatrix(field, x.getRowDimension() - 1, x.getColumnDimension()); for (int i = 0; i < truncatedX.getRowDimension(); ++i) { for (int j = 0; j < truncatedX.getColumnDimension(); ++j) { truncatedX.setEntry(i, j, x.getEntry(i, j)); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckTransformer.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckTransformer.java index f38e61af8..86bc87106 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckTransformer.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckTransformer.java @@ -136,7 +136,7 @@ public class AdamsNordsieckTransformer { /** Cache for already computed coefficients. */ private static final Map CACHE = - new HashMap<>(); + new HashMap(); /** Update matrix for the higher order derivatives h2/2 y'', h3/6 y''' ... */ private final Array2DRowRealMatrix update; @@ -155,11 +155,11 @@ public class AdamsNordsieckTransformer { // compute exact coefficients FieldMatrix bigP = buildP(rows); FieldDecompositionSolver pSolver = - new FieldLUDecomposition<>(bigP).getSolver(); + new FieldLUDecomposition(bigP).getSolver(); BigFraction[] u = new BigFraction[rows]; Arrays.fill(u, BigFraction.ONE); - BigFraction[] bigC1 = pSolver.solve(new ArrayFieldVector<>(u, false)).toArray(); + BigFraction[] bigC1 = pSolver.solve(new ArrayFieldVector(u, false)).toArray(); // update coefficients are computed by combining transform from // Nordsieck to multistep, then shifting rows to represent step advance @@ -172,7 +172,7 @@ public class AdamsNordsieckTransformer { shiftedP[0] = new BigFraction[rows]; Arrays.fill(shiftedP[0], BigFraction.ZERO); FieldMatrix bigMSupdate = - pSolver.solve(new Array2DRowFieldMatrix<>(shiftedP, false)); + pSolver.solve(new Array2DRowFieldMatrix(shiftedP, false)); // convert coefficients to double update = MatrixUtils.bigFractionMatrixToRealMatrix(bigMSupdate); @@ -239,7 +239,7 @@ public class AdamsNordsieckTransformer { } } - return new Array2DRowFieldMatrix<>(pData, false); + return new Array2DRowFieldMatrix(pData, false); } diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java index 56add60de..315924a90 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegrator.java @@ -105,7 +105,7 @@ public class ClassicalRungeKuttaFieldIntegrator> final FieldODEStateAndDerivative globalPreviousState, final FieldODEStateAndDerivative globalCurrentState, final FieldEquationsMapper mapper) { - return new ClassicalRungeKuttaFieldStepInterpolator<>(getField(), forward, yDotK, + return new ClassicalRungeKuttaFieldStepInterpolator(getField(), forward, yDotK, globalPreviousState, globalCurrentState, globalPreviousState, globalCurrentState, mapper); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java index c4d1263fd..522530b51 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldStepInterpolator.java @@ -89,7 +89,7 @@ class ClassicalRungeKuttaFieldStepInterpolator> final FieldODEStateAndDerivative newSoftPreviousState, final FieldODEStateAndDerivative newSoftCurrentState, final FieldEquationsMapper newMapper) { - return new ClassicalRungeKuttaFieldStepInterpolator<>(newField, newForward, newYDotK, + return new ClassicalRungeKuttaFieldStepInterpolator(newField, newForward, newYDotK, newGlobalPreviousState, newGlobalCurrentState, newSoftPreviousState, newSoftCurrentState, newMapper); @@ -129,7 +129,7 @@ class ClassicalRungeKuttaFieldStepInterpolator> interpolatedDerivatives = derivativeLinearCombination(coeffDot1, coeffDot23, coeffDot23, coeffDot4); } - return new FieldODEStateAndDerivative<>(time, interpolatedState, interpolatedDerivatives); + return new FieldODEStateAndDerivative(time, interpolatedState, interpolatedDerivatives); } diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java index 12d7a6475..b8ec110e8 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegrator.java @@ -193,7 +193,7 @@ public class DormandPrince54FieldIntegrator> createInterpolator(final boolean forward, T[][] yDotK, final FieldODEStateAndDerivative globalPreviousState, final FieldODEStateAndDerivative globalCurrentState, final FieldEquationsMapper mapper) { - return new DormandPrince54FieldStepInterpolator<>(getField(), forward, yDotK, + return new DormandPrince54FieldStepInterpolator(getField(), forward, yDotK, globalPreviousState, globalCurrentState, globalPreviousState, globalCurrentState, mapper); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldStepInterpolator.java index 61548ce76..16a2fe415 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldStepInterpolator.java @@ -114,7 +114,7 @@ class DormandPrince54FieldStepInterpolator> final FieldODEStateAndDerivative newSoftPreviousState, final FieldODEStateAndDerivative newSoftCurrentState, final FieldEquationsMapper newMapper) { - return new DormandPrince54FieldStepInterpolator<>(newField, newForward, newYDotK, + return new DormandPrince54FieldStepInterpolator(newField, newForward, newYDotK, newGlobalPreviousState, newGlobalCurrentState, newSoftPreviousState, newSoftCurrentState, newMapper); @@ -242,7 +242,7 @@ class DormandPrince54FieldStepInterpolator> interpolatedDerivatives = derivativeLinearCombination(coeffDot0, coeffDot1, coeffDot2, coeffDot3, coeffDot4, coeffDot5, coeffDot6); } - return new FieldODEStateAndDerivative<>(time, interpolatedState, interpolatedDerivatives); + return new FieldODEStateAndDerivative(time, interpolatedState, interpolatedDerivatives); } diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegrator.java index b40eb5088..171b46524 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegrator.java @@ -399,7 +399,7 @@ public class DormandPrince853FieldIntegrator> createInterpolator(final boolean forward, T[][] yDotK, final FieldODEStateAndDerivative globalPreviousState, final FieldODEStateAndDerivative globalCurrentState, final FieldEquationsMapper mapper) { - return new DormandPrince853FieldStepInterpolator<>(getField(), forward, yDotK, + return new DormandPrince853FieldStepInterpolator(getField(), forward, yDotK, globalPreviousState, globalCurrentState, globalPreviousState, globalCurrentState, mapper); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolator.java index 5228dd211..e4d7ee526 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolator.java @@ -195,7 +195,7 @@ class DormandPrince853FieldStepInterpolator> final FieldODEStateAndDerivative newSoftPreviousState, final FieldODEStateAndDerivative newSoftCurrentState, final FieldEquationsMapper newMapper) { - return new DormandPrince853FieldStepInterpolator<>(newField, newForward, newYDotK, + return new DormandPrince853FieldStepInterpolator(newField, newForward, newYDotK, newGlobalPreviousState, newGlobalCurrentState, newSoftPreviousState, newSoftCurrentState, newMapper); @@ -295,7 +295,7 @@ class DormandPrince853FieldStepInterpolator> q[8], q[9], q[10], q[11], q[12], q[13], q[14], q[15]); } - return new FieldODEStateAndDerivative<>(time, interpolatedState, interpolatedDerivatives); + return new FieldODEStateAndDerivative(time, interpolatedState, interpolatedDerivatives); } diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java index 6238953fb..acba7a513 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegrator.java @@ -309,7 +309,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegrator= 0) ? yDotK[fsal] : computeDerivatives(stepEnd, yTmp); - final FieldODEStateAndDerivative stateTmp = new FieldODEStateAndDerivative<>(stepEnd, yTmp, yDotTmp); + final FieldODEStateAndDerivative stateTmp = new FieldODEStateAndDerivative(stepEnd, yTmp, yDotTmp); // local error is small enough: accept the step, trigger events and step handlers System.arraycopy(yTmp, 0, y, 0, y0.length); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegrator.java index 503231c2a..ce8743111 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegrator.java @@ -90,7 +90,7 @@ public class EulerFieldIntegrator> extends RungeKu final FieldODEStateAndDerivative globalPreviousState, final FieldODEStateAndDerivative globalCurrentState, final FieldEquationsMapper mapper) { - return new EulerFieldStepInterpolator<>(getField(), forward, yDotK, + return new EulerFieldStepInterpolator(getField(), forward, yDotK, globalPreviousState, globalCurrentState, globalPreviousState, globalCurrentState, mapper); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolator.java index 43b8a5377..e57865ac8 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolator.java @@ -79,7 +79,7 @@ class EulerFieldStepInterpolator> final FieldODEStateAndDerivative newSoftPreviousState, final FieldODEStateAndDerivative newSoftCurrentState, final FieldEquationsMapper newMapper) { - return new EulerFieldStepInterpolator<>(newField, newForward, newYDotK, + return new EulerFieldStepInterpolator(newField, newForward, newYDotK, newGlobalPreviousState, newGlobalCurrentState, newSoftPreviousState, newSoftCurrentState, newMapper); @@ -101,7 +101,7 @@ class EulerFieldStepInterpolator> interpolatedDerivatives = derivativeLinearCombination(time.getField().getOne()); } - return new FieldODEStateAndDerivative<>(time, interpolatedState, interpolatedDerivatives); + return new FieldODEStateAndDerivative(time, interpolatedState, interpolatedDerivatives); } diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/GillFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/GillFieldIntegrator.java index 0ee8b5ded..1fc66887c 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/GillFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/GillFieldIntegrator.java @@ -115,7 +115,7 @@ public class GillFieldIntegrator> final FieldODEStateAndDerivative globalPreviousState, final FieldODEStateAndDerivative globalCurrentState, final FieldEquationsMapper mapper) { - return new GillFieldStepInterpolator<>(getField(), forward, yDotK, + return new GillFieldStepInterpolator(getField(), forward, yDotK, globalPreviousState, globalCurrentState, globalPreviousState, globalCurrentState, mapper); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/GillFieldStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/GillFieldStepInterpolator.java index df474308e..bb00d04d6 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/GillFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/GillFieldStepInterpolator.java @@ -97,7 +97,7 @@ class GillFieldStepInterpolator> final FieldODEStateAndDerivative newSoftPreviousState, final FieldODEStateAndDerivative newSoftCurrentState, final FieldEquationsMapper newMapper) { - return new GillFieldStepInterpolator<>(newField, newForward, newYDotK, + return new GillFieldStepInterpolator(newField, newForward, newYDotK, newGlobalPreviousState, newGlobalCurrentState, newSoftPreviousState, newSoftCurrentState, newMapper); @@ -141,7 +141,7 @@ class GillFieldStepInterpolator> interpolatedDerivatives = derivativeLinearCombination(coeffDot1, coeffDot2, coeffDot3, coeffDot4); } - return new FieldODEStateAndDerivative<>(time, interpolatedState, interpolatedDerivatives); + return new FieldODEStateAndDerivative(time, interpolatedState, interpolatedDerivatives); } diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegrator.java index e88467e95..0f8353af4 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegrator.java @@ -168,7 +168,7 @@ public class HighamHall54FieldIntegrator> createInterpolator(final boolean forward, T[][] yDotK, final FieldODEStateAndDerivative globalPreviousState, final FieldODEStateAndDerivative globalCurrentState, final FieldEquationsMapper mapper) { - return new HighamHall54FieldStepInterpolator<>(getField(), forward, yDotK, + return new HighamHall54FieldStepInterpolator(getField(), forward, yDotK, globalPreviousState, globalCurrentState, globalPreviousState, globalCurrentState, mapper); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolator.java index fd8f5cff2..a915e2648 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolator.java @@ -65,7 +65,7 @@ class HighamHall54FieldStepInterpolator> final FieldODEStateAndDerivative newSoftPreviousState, final FieldODEStateAndDerivative newSoftCurrentState, final FieldEquationsMapper newMapper) { - return new HighamHall54FieldStepInterpolator<>(newField, newForward, newYDotK, + return new HighamHall54FieldStepInterpolator(newField, newForward, newYDotK, newGlobalPreviousState, newGlobalCurrentState, newSoftPreviousState, newSoftCurrentState, newMapper); @@ -109,7 +109,7 @@ class HighamHall54FieldStepInterpolator> interpolatedDerivatives = derivativeLinearCombination(bDot0, bDot1, bDot2, bDot3, bDot4, bDot5); } - return new FieldODEStateAndDerivative<>(time, interpolatedState, interpolatedDerivatives); + return new FieldODEStateAndDerivative(time, interpolatedState, interpolatedDerivatives); } diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegrator.java index b3c142442..1c3301c8b 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegrator.java @@ -140,7 +140,7 @@ public class LutherFieldIntegrator> final FieldODEStateAndDerivative globalPreviousState, final FieldODEStateAndDerivative globalCurrentState, final FieldEquationsMapper mapper) { - return new LutherFieldStepInterpolator<>(getField(), forward, yDotK, + return new LutherFieldStepInterpolator(getField(), forward, yDotK, globalPreviousState, globalCurrentState, globalPreviousState, globalCurrentState, mapper); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolator.java index df5ea6a25..438e09e41 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolator.java @@ -125,7 +125,7 @@ class LutherFieldStepInterpolator> final FieldODEStateAndDerivative newSoftPreviousState, final FieldODEStateAndDerivative newSoftCurrentState, final FieldEquationsMapper newMapper) { - return new LutherFieldStepInterpolator<>(newField, newForward, newYDotK, + return new LutherFieldStepInterpolator(newField, newForward, newYDotK, newGlobalPreviousState, newGlobalCurrentState, newSoftPreviousState, newSoftCurrentState, newMapper); @@ -217,7 +217,7 @@ class LutherFieldStepInterpolator> interpolatedDerivatives = derivativeLinearCombination(coeffDot1, coeffDot2, coeffDot3, coeffDot4, coeffDot5, coeffDot6, coeffDot7); } - return new FieldODEStateAndDerivative<>(time, interpolatedState, interpolatedDerivatives); + return new FieldODEStateAndDerivative(time, interpolatedState, interpolatedDerivatives); } diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegrator.java index 3b604e37f..af5a867f3 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegrator.java @@ -90,7 +90,7 @@ public class MidpointFieldIntegrator> extends Rung final FieldODEStateAndDerivative globalPreviousState, final FieldODEStateAndDerivative globalCurrentState, final FieldEquationsMapper mapper) { - return new MidpointFieldStepInterpolator<>(getField(), forward, yDotK, + return new MidpointFieldStepInterpolator(getField(), forward, yDotK, globalPreviousState, globalCurrentState, globalPreviousState, globalCurrentState, mapper); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldStepInterpolator.java index f64012eab..03bd70d84 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldStepInterpolator.java @@ -81,7 +81,7 @@ class MidpointFieldStepInterpolator> final FieldODEStateAndDerivative newSoftPreviousState, final FieldODEStateAndDerivative newSoftCurrentState, final FieldEquationsMapper newMapper) { - return new MidpointFieldStepInterpolator<>(newField, newForward, newYDotK, + return new MidpointFieldStepInterpolator(newField, newForward, newYDotK, newGlobalPreviousState, newGlobalCurrentState, newSoftPreviousState, newSoftCurrentState, newMapper); @@ -111,7 +111,7 @@ class MidpointFieldStepInterpolator> interpolatedDerivatives = derivativeLinearCombination(coeffDot1, coeffDot2); } - return new FieldODEStateAndDerivative<>(time, interpolatedState, interpolatedDerivatives); + return new FieldODEStateAndDerivative(time, interpolatedState, interpolatedDerivatives); } diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegrator.java index f07bbae73..8956fa4e2 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegrator.java @@ -177,7 +177,7 @@ public abstract class RungeKuttaFieldIntegrator> } final T stepEnd = getStepStart().getTime().add(getStepSize()); final T[] yDotTmp = computeDerivatives(stepEnd, yTmp); - final FieldODEStateAndDerivative stateTmp = new FieldODEStateAndDerivative<>(stepEnd, yTmp, yDotTmp); + final FieldODEStateAndDerivative stateTmp = new FieldODEStateAndDerivative(stepEnd, yTmp, yDotTmp); // discrete events handling System.arraycopy(yTmp, 0, y, 0, y0.length); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldIntegrator.java index 8169d7539..4a786f55e 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldIntegrator.java @@ -104,7 +104,7 @@ public class ThreeEighthesFieldIntegrator> final FieldODEStateAndDerivative globalPreviousState, final FieldODEStateAndDerivative globalCurrentState, final FieldEquationsMapper mapper) { - return new ThreeEighthesFieldStepInterpolator<>(getField(), forward, yDotK, + return new ThreeEighthesFieldStepInterpolator(getField(), forward, yDotK, globalPreviousState, globalCurrentState, globalPreviousState, globalCurrentState, mapper); diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java index b41f91a55..69df7f805 100644 --- a/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldStepInterpolator.java @@ -91,7 +91,7 @@ class ThreeEighthesFieldStepInterpolator> final FieldODEStateAndDerivative newSoftPreviousState, final FieldODEStateAndDerivative newSoftCurrentState, final FieldEquationsMapper newMapper) { - return new ThreeEighthesFieldStepInterpolator<>(newField, newForward, newYDotK, + return new ThreeEighthesFieldStepInterpolator(newField, newForward, newYDotK, newGlobalPreviousState, newGlobalCurrentState, newSoftPreviousState, newSoftCurrentState, newMapper); @@ -132,7 +132,7 @@ class ThreeEighthesFieldStepInterpolator> interpolatedDerivatives = derivativeLinearCombination(coeffDot1, coeffDot2, coeffDot3, coeffDot4); } - return new FieldODEStateAndDerivative<>(time, interpolatedState, interpolatedDerivatives); + return new FieldODEStateAndDerivative(time, interpolatedState, interpolatedDerivatives); } diff --git a/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraintSet.java b/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraintSet.java index 3dcc2a1af..7a3169871 100644 --- a/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraintSet.java +++ b/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraintSet.java @@ -30,7 +30,7 @@ import org.apache.commons.math4.optim.OptimizationData; */ public class LinearConstraintSet implements OptimizationData { /** Set of constraints. */ - private final Set linearConstraints = new LinkedHashSet<>(); + private final Set linearConstraints = new LinkedHashSet(); /** * Creates a set containing the given constraints. diff --git a/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java b/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java index 04b6ab94d..a835765ea 100644 --- a/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java +++ b/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java @@ -247,7 +247,7 @@ public class SimplexSolver extends LinearOptimizer { */ private Integer getPivotRow(SimplexTableau tableau, final int col) { // create a list of all the rows that tie for the lowest score in the minimum ratio test - List minRatioPositions = new ArrayList<>(); + List minRatioPositions = new ArrayList(); double minRatio = Double.MAX_VALUE; for (int i = tableau.getNumObjectiveFunctions(); i < tableau.getHeight(); i++) { final double rhs = tableau.getEntry(i, tableau.getWidth() - 1); diff --git a/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java b/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java index 02ee6641d..7d6c8f003 100644 --- a/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java +++ b/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java @@ -78,7 +78,7 @@ class SimplexTableau implements Serializable { private final boolean restrictToNonNegative; /** The variables each column represents */ - private final List columnLabels = new ArrayList<>(); + private final List columnLabels = new ArrayList(); /** Simple tableau. */ private transient Array2DRowRealMatrix tableau; @@ -272,7 +272,7 @@ class SimplexTableau implements Serializable { * @return new versions of the constraints */ public List normalizeConstraints(Collection originalConstraints) { - List normalized = new ArrayList<>(originalConstraints.size()); + List normalized = new ArrayList(originalConstraints.size()); for (LinearConstraint constraint : originalConstraints) { normalized.add(normalize(constraint)); } @@ -395,7 +395,7 @@ class SimplexTableau implements Serializable { return; } - final Set columnsToDrop = new TreeSet<>(); + final Set columnsToDrop = new TreeSet(); columnsToDrop.add(0); // positive cost non-artificial variables @@ -469,7 +469,7 @@ class SimplexTableau implements Serializable { Integer negativeVarBasicRow = negativeVarColumn > 0 ? getBasicRow(negativeVarColumn) : null; double mostNegative = negativeVarBasicRow == null ? 0 : getEntry(negativeVarBasicRow, getRhsOffset()); - final Set usedBasicRows = new HashSet<>(); + final Set usedBasicRows = new HashSet(); final double[] coefficients = new double[getOriginalNumDecisionVariables()]; for (int i = 0; i < coefficients.length; i++) { int colIndex = columnLabels.indexOf("x" + i); diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java index 49bf465c8..d05986831 100644 --- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java +++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java @@ -41,7 +41,7 @@ public class MultiStartMultivariateOptimizer /** Underlying optimizer. */ private final MultivariateOptimizer optimizer; /** Found optima. */ - private final List optima = new ArrayList<>(); + private final List optima = new ArrayList(); /** * Create a multi-start optimizer from a single-start optimizer. diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java index 2a6260965..727fd1848 100644 --- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java +++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java @@ -199,13 +199,13 @@ public class CMAESOptimizer private final RandomGenerator random; /** History of sigma values. */ - private final List statisticsSigmaHistory = new ArrayList<>(); + private final List statisticsSigmaHistory = new ArrayList(); /** History of mean matrix. */ - private final List statisticsMeanHistory = new ArrayList<>(); + private final List statisticsMeanHistory = new ArrayList(); /** History of fitness values. */ - private final List statisticsFitnessHistory = new ArrayList<>(); + private final List statisticsFitnessHistory = new ArrayList(); /** History of D matrix. */ - private final List statisticsDHistory = new ArrayList<>(); + private final List statisticsDHistory = new ArrayList(); /** * @param maxIterations Maximal number of iterations. diff --git a/src/main/java/org/apache/commons/math4/primes/SmallPrimes.java b/src/main/java/org/apache/commons/math4/primes/SmallPrimes.java index 6f329e3c4..0738cd249 100644 --- a/src/main/java/org/apache/commons/math4/primes/SmallPrimes.java +++ b/src/main/java/org/apache/commons/math4/primes/SmallPrimes.java @@ -125,7 +125,7 @@ class SmallPrimes { * @return the list of prime factors of n */ public static List trialDivision(int n){ - final List factors = new ArrayList<>(32); + final List factors = new ArrayList(32); n = smallTrialDivision(n, factors); if (1 == n) { return factors; diff --git a/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java b/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java index f774ce386..6d2722e13 100644 --- a/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java +++ b/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java @@ -195,7 +195,7 @@ public class EmpiricalDistribution extends AbstractRealDistribution { } this.binCount = binCount; this.randomData = randomData; - binStats = new ArrayList<>(); + binStats = new ArrayList(); } /** diff --git a/src/main/java/org/apache/commons/math4/stat/Frequency.java b/src/main/java/org/apache/commons/math4/stat/Frequency.java index f6767200b..d032c75dd 100644 --- a/src/main/java/org/apache/commons/math4/stat/Frequency.java +++ b/src/main/java/org/apache/commons/math4/stat/Frequency.java @@ -74,7 +74,7 @@ public class Frequency implements Serializable { * Default constructor. */ public Frequency() { - freqTable = new TreeMap<>(); + freqTable = new TreeMap, Long>(); } /** @@ -84,7 +84,7 @@ public class Frequency implements Serializable { */ @SuppressWarnings("unchecked") // TODO is the cast OK? public Frequency(Comparator comparator) { - freqTable = new TreeMap<>((Comparator>) comparator); + freqTable = new TreeMap, Long>((Comparator>) comparator); } /** @@ -574,7 +574,7 @@ public class Frequency implements Serializable { } } - List> modeList = new ArrayList<>(); + List> modeList = new ArrayList>(); for (Entry, Long> ent : freqTable.entrySet()) { long frequency = ent.getValue().longValue(); if (frequency == mostPopular) { diff --git a/src/main/java/org/apache/commons/math4/stat/correlation/KendallsCorrelation.java b/src/main/java/org/apache/commons/math4/stat/correlation/KendallsCorrelation.java index 32ed6d01f..8df17eabb 100644 --- a/src/main/java/org/apache/commons/math4/stat/correlation/KendallsCorrelation.java +++ b/src/main/java/org/apache/commons/math4/stat/correlation/KendallsCorrelation.java @@ -164,7 +164,7 @@ public class KendallsCorrelation { @SuppressWarnings("unchecked") Pair[] pairs = new Pair[n]; for (int i = 0; i < n; i++) { - pairs[i] = new Pair<>(xArray[i], yArray[i]); + pairs[i] = new Pair(xArray[i], yArray[i]); } Arrays.sort(pairs, new Comparator>() { diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java index c81a4d151..7ba2d16ae 100644 --- a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java +++ b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java @@ -81,7 +81,7 @@ public class PSquarePercentile extends AbstractStorelessUnivariateStatistic * Initial list of 5 numbers corresponding to 5 markers. NOTE:watch * out for the add methods that are overloaded */ - private final List initialFive = new FixedCapacityList<>(PSQUARE_CONSTANT); + private final List initialFive = new FixedCapacityList(PSQUARE_CONSTANT); /** * The quantile needed should be in range of 0-1. The constructor diff --git a/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java b/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java index b331ff5c8..04296a301 100644 --- a/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java +++ b/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java @@ -821,7 +821,7 @@ public class KolmogorovSmirnovTest { } } } - return new Array2DRowFieldMatrix<>(BigFractionField.getInstance(), Hdata); + return new Array2DRowFieldMatrix(BigFractionField.getInstance(), Hdata); } /*** @@ -1181,7 +1181,7 @@ public class KolmogorovSmirnovTest { * @return true if x and y together contain ties */ private static boolean hasTies(double[] x, double[] y) { - final HashSet values = new HashSet<>(); + final HashSet values = new HashSet(); for (int i = 0; i < x.length; i++) { if (!values.add(x[i])) { return true; diff --git a/src/main/java/org/apache/commons/math4/stat/inference/OneWayAnova.java b/src/main/java/org/apache/commons/math4/stat/inference/OneWayAnova.java index 5afaa4a70..90f4e9680 100644 --- a/src/main/java/org/apache/commons/math4/stat/inference/OneWayAnova.java +++ b/src/main/java/org/apache/commons/math4/stat/inference/OneWayAnova.java @@ -195,7 +195,7 @@ public class OneWayAnova { MathUtils.checkNotNull(categoryData); final Collection categoryDataSummaryStatistics = - new ArrayList<>(categoryData.size()); + new ArrayList(categoryData.size()); // convert arrays to SummaryStatistics for (final double[] data : categoryData) { diff --git a/src/main/java/org/apache/commons/math4/stat/ranking/NaturalRanking.java b/src/main/java/org/apache/commons/math4/stat/ranking/NaturalRanking.java index e30195988..d6efc09e6 100644 --- a/src/main/java/org/apache/commons/math4/stat/ranking/NaturalRanking.java +++ b/src/main/java/org/apache/commons/math4/stat/ranking/NaturalRanking.java @@ -230,7 +230,7 @@ public class NaturalRanking implements RankingAlgorithm { double[] out = new double[ranks.length]; int pos = 1; // position in sorted array out[ranks[0].getPosition()] = pos; - List tiesTrace = new ArrayList<>(); + List tiesTrace = new ArrayList(); tiesTrace.add(ranks[0].getPosition()); for (int i = 1; i < ranks.length; i++) { if (Double.compare(ranks[i].getValue(), ranks[i - 1].getValue()) > 0) { @@ -239,7 +239,7 @@ public class NaturalRanking implements RankingAlgorithm { if (tiesTrace.size() > 1) { // if seq is nontrivial, resolve resolveTie(out, tiesTrace); } - tiesTrace = new ArrayList<>(); + tiesTrace = new ArrayList(); tiesTrace.add(ranks[i].getPosition()); } else { // tie sequence continues @@ -410,7 +410,7 @@ public class NaturalRanking implements RankingAlgorithm { * @return list of indexes i such that ranks[i] = NaN */ private List getNanPositions(IntDoublePair[] ranks) { - ArrayList out = new ArrayList<>(); + ArrayList out = new ArrayList(); for (int i = 0; i < ranks.length; i++) { if (Double.isNaN(ranks[i].getValue())) { out.add(Integer.valueOf(i)); diff --git a/src/main/java/org/apache/commons/math4/util/CombinatoricsUtils.java b/src/main/java/org/apache/commons/math4/util/CombinatoricsUtils.java index 0594deef5..08a9829cb 100644 --- a/src/main/java/org/apache/commons/math4/util/CombinatoricsUtils.java +++ b/src/main/java/org/apache/commons/math4/util/CombinatoricsUtils.java @@ -43,7 +43,7 @@ public final class CombinatoricsUtils { 6402373705728000l, 121645100408832000l, 2432902008176640000l }; /** Stirling numbers of the second kind. */ - static final AtomicReference STIRLING_S2 = new AtomicReference<> (null); + static final AtomicReference STIRLING_S2 = new AtomicReference (null); /** * Default implementation of {@link #factorialLog(int)} method: diff --git a/src/main/java/org/apache/commons/math4/util/IterationManager.java b/src/main/java/org/apache/commons/math4/util/IterationManager.java index 550bd2582..4437a8f1a 100644 --- a/src/main/java/org/apache/commons/math4/util/IterationManager.java +++ b/src/main/java/org/apache/commons/math4/util/IterationManager.java @@ -43,7 +43,7 @@ public class IterationManager { */ public IterationManager(final int maxIterations) { this.iterations = new Incrementor(maxIterations); - this.listeners = new CopyOnWriteArrayList<>(); + this.listeners = new CopyOnWriteArrayList(); } /** @@ -58,7 +58,7 @@ public class IterationManager { public IterationManager(final int maxIterations, final Incrementor.MaxCountExceededCallback callBack) { this.iterations = new Incrementor(maxIterations, callBack); - this.listeners = new CopyOnWriteArrayList<>(); + this.listeners = new CopyOnWriteArrayList(); } /** diff --git a/src/main/java/org/apache/commons/math4/util/MathArrays.java b/src/main/java/org/apache/commons/math4/util/MathArrays.java index 8c850db11..c50f44c25 100644 --- a/src/main/java/org/apache/commons/math4/util/MathArrays.java +++ b/src/main/java/org/apache/commons/math4/util/MathArrays.java @@ -844,7 +844,7 @@ public class MathArrays { // Associate each abscissa "x[i]" with its index "i". final List list - = new ArrayList<>(len); + = new ArrayList(len); for (int i = 0; i < len; i++) { list.add(new PairDoubleInteger(x[i], i)); } @@ -1921,7 +1921,7 @@ public class MathArrays { * @since 3.6 */ public static double[] unique(double[] data) { - TreeSet values = new TreeSet<>(); + TreeSet values = new TreeSet(); for (int i = 0; i < data.length; i++) { values.add(data[i]); } diff --git a/src/main/java/org/apache/commons/math4/util/Pair.java b/src/main/java/org/apache/commons/math4/util/Pair.java index f56de9b95..487cdced6 100644 --- a/src/main/java/org/apache/commons/math4/util/Pair.java +++ b/src/main/java/org/apache/commons/math4/util/Pair.java @@ -151,6 +151,6 @@ public class Pair { * @since 3.3 */ public static Pair create(K k, V v) { - return new Pair<>(k, v); + return new Pair(k, v); } } diff --git a/src/main/java/org/apache/commons/math4/util/TransformerMap.java b/src/main/java/org/apache/commons/math4/util/TransformerMap.java index 78bb86c65..374b9f6f2 100644 --- a/src/main/java/org/apache/commons/math4/util/TransformerMap.java +++ b/src/main/java/org/apache/commons/math4/util/TransformerMap.java @@ -49,7 +49,7 @@ public class TransformerMap implements NumberTransformer, Serializable { * Build a map containing only the default transformer. */ public TransformerMap() { - map = new HashMap<>(); + map = new HashMap, NumberTransformer>(); defaultTransformer = new DefaultTransformer(); } diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/DSCompilerTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/DSCompilerTest.java index 428450541..e54d7a3e0 100644 --- a/src/test/java/org/apache/commons/math4/analysis/differentiation/DSCompilerTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/DSCompilerTest.java @@ -155,7 +155,7 @@ public class DSCompilerTest { @Test public void testMultiplicationRules() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { - Map referenceRules = new HashMap<>(); + Map referenceRules = new HashMap(); referenceRules.put("(f*g)", "f * g"); referenceRules.put("d(f*g)/dx", "f * dg/dx + df/dx * g"); referenceRules.put("d(f*g)/dy", referenceRules.get("d(f*g)/dx").replaceAll("x", "y")); @@ -246,7 +246,7 @@ public class DSCompilerTest { // the following reference rules have all been computed independently from the library, // using only pencil and paper and some search and replace to handle symmetries - Map referenceRules = new HashMap<>(); + Map referenceRules = new HashMap(); referenceRules.put("(f(g))", "(f(g))"); referenceRules.put("d(f(g))/dx", "d(f(g))/dg * dg/dx"); referenceRules.put("d(f(g))/dy", referenceRules.get("d(f(g))/dx").replaceAll("x", "y")); diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactoryTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactoryTest.java index 6eda1615c..89c05de3b 100644 --- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactoryTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactoryTest.java @@ -51,7 +51,7 @@ public class BaseRuleFactoryTest { new ArrayBlockingQueue(2)); final List>> results - = new ArrayList<>(); + = new ArrayList>>(); for (int i = 0; i < numTasks; i++) { results.add(exec.submit(new RuleBuilder())); } @@ -103,7 +103,7 @@ class DummyRuleFactory extends BaseRuleFactory { p[i] = new Double(i); w[i] = new Double(i); } - return new Pair<>(p, w); + return new Pair(p, w); } public int getNumberOfCalls() { diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorTest.java index 07e067582..8270d3b1e 100644 --- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorTest.java @@ -34,7 +34,7 @@ public class GaussIntegratorTest { final double[] weights = { 9.8, 7.6, 5.4 }; final GaussIntegrator integrator - = new GaussIntegrator(new Pair<>(points, weights)); + = new GaussIntegrator(new Pair(points, weights)); Assert.assertEquals(weights.length, integrator.getNumberOfPoints()); @@ -49,7 +49,7 @@ public class GaussIntegratorTest { final double[] weights = { 9.8, 7.6, 5.4 }; final GaussIntegrator integrator - = new GaussIntegrator(new Pair<>(points, weights)); + = new GaussIntegrator(new Pair(points, weights)); Assert.assertEquals(points.length, integrator.getNumberOfPoints()); @@ -64,7 +64,7 @@ public class GaussIntegratorTest { final double[] weights = { 1, 1, 1, 1, 1, 1 }; final GaussIntegrator integrator - = new GaussIntegrator(new Pair<>(points, weights)); + = new GaussIntegrator(new Pair(points, weights)); final double val = 123.456; final UnivariateFunction c = new Constant(val); diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteParametricTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteParametricTest.java index 5bba84e86..8eb304fdb 100644 --- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteParametricTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteParametricTest.java @@ -72,7 +72,7 @@ public class HermiteParametricTest extends GaussianQuadratureAbstractTest { @SuppressWarnings("boxing") // OK here @Parameters public static Collection getParameters() { - final ArrayList parameters = new ArrayList<>(); + final ArrayList parameters = new ArrayList(); for (int k = 1; k <= MAX_NUM_POINTS; k++) { parameters.add(new Object[] { k, 2 * k - 1, Math.ulp(1d), 195 }); } diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionParametricTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionParametricTest.java index 896f8e09b..976488fd3 100644 --- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionParametricTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionParametricTest.java @@ -70,7 +70,7 @@ public class LegendreHighPrecisionParametricTest extends GaussianQuadratureAbstr @SuppressWarnings("boxing") // OK here @Parameters public static Collection getParameters() { - final ArrayList parameters = new ArrayList<>(); + final ArrayList parameters = new ArrayList(); for (int k = 1; k <= MAX_NUM_POINTS; k++) { parameters.add(new Object[] { k, 2 * k - 1, Math.ulp(1d), 13d }); } diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreParametricTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreParametricTest.java index 812611194..3f0fc6395 100644 --- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreParametricTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreParametricTest.java @@ -70,7 +70,7 @@ public class LegendreParametricTest extends GaussianQuadratureAbstractTest { @SuppressWarnings("boxing") // OK here @Parameters public static Collection getParameters() { - final ArrayList parameters = new ArrayList<>(); + final ArrayList parameters = new ArrayList(); for (int k = 1; k <= MAX_NUM_POINTS; k++) { parameters.add(new Object[] { k, 2 * k - 1, Math.ulp(1d), 91d }); } diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolatorTest.java index 33fab5de9..1e5b031f8 100644 --- a/src/test/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolatorTest.java @@ -33,7 +33,7 @@ public class FieldHermiteInterpolatorTest { @Test public void testZero() { - FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator<>(); + FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator(); interpolator.addSamplePoint(new BigFraction(0), new BigFraction[] { new BigFraction(0) }); for (int x = -10; x < 10; x++) { BigFraction y = interpolator.value(new BigFraction(x))[0]; @@ -46,7 +46,7 @@ public class FieldHermiteInterpolatorTest { @Test public void testQuadratic() { - FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator<>(); + FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator(); interpolator.addSamplePoint(new BigFraction(0), new BigFraction[] { new BigFraction(2) }); interpolator.addSamplePoint(new BigFraction(1), new BigFraction[] { new BigFraction(0) }); interpolator.addSamplePoint(new BigFraction(2), new BigFraction[] { new BigFraction(0) }); @@ -63,7 +63,7 @@ public class FieldHermiteInterpolatorTest { @Test public void testMixedDerivatives() { - FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator<>(); + FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator(); interpolator.addSamplePoint(new BigFraction(0), new BigFraction[] { new BigFraction(1) }, new BigFraction[] { new BigFraction(2) }); interpolator.addSamplePoint(new BigFraction(1), new BigFraction[] { new BigFraction(4) }); interpolator.addSamplePoint(new BigFraction(2), new BigFraction[] { new BigFraction(5) }, new BigFraction[] { new BigFraction(2) }); @@ -107,7 +107,7 @@ public class FieldHermiteInterpolatorTest { DfpField field = new DfpField(30); Dfp step = field.getOne().divide(field.newDfp(10)); - FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator<>(); + FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator(); for (int j = 0; j < 1 + maxDegree; ++j) { Dfp x = field.newDfp(j).multiply(step); Dfp[] values = new Dfp[p.length]; @@ -151,7 +151,7 @@ public class FieldHermiteInterpolatorTest { DfpField field = new DfpField(30); Dfp step = field.getOne().divide(field.newDfp(10)); - FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator<>(); + FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator(); for (int j = 0; j < 1 + maxDegree / 2; ++j) { Dfp x = field.newDfp(j).multiply(step); Dfp[] values = new Dfp[p.length]; @@ -186,7 +186,7 @@ public class FieldHermiteInterpolatorTest { @Test public void testSine() { DfpField field = new DfpField(30); - FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator<>(); + FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator(); for (Dfp x = field.getZero(); x.getReal() < FastMath.PI; x = x.add(0.5)) { interpolator.addSamplePoint(x, new Dfp[] { x.sin() }); } @@ -199,7 +199,7 @@ public class FieldHermiteInterpolatorTest { @Test public void testSquareRoot() { DfpField field = new DfpField(30); - FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator<>(); + FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator(); for (Dfp x = field.getOne(); x.getReal() < 3.6; x = x.add(0.5)) { interpolator.addSamplePoint(x, new Dfp[] { x.sqrt() }); } @@ -213,7 +213,7 @@ public class FieldHermiteInterpolatorTest { public void testWikipedia() { // this test corresponds to the example from Wikipedia page: // http://en.wikipedia.org/wiki/Hermite_interpolation - FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator<>(); + FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator(); interpolator.addSamplePoint(new BigFraction(-1), new BigFraction[] { new BigFraction( 2) }, new BigFraction[] { new BigFraction(-8) }, @@ -237,7 +237,7 @@ public class FieldHermiteInterpolatorTest { @Test public void testOnePointParabola() { - FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator<>(); + FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator(); interpolator.addSamplePoint(new BigFraction(0), new BigFraction[] { new BigFraction(1) }, new BigFraction[] { new BigFraction(1) }, @@ -268,7 +268,7 @@ public class FieldHermiteInterpolatorTest { @Test(expected=MathIllegalArgumentException.class) public void testDuplicatedAbscissa() { - FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator<>(); + FieldHermiteInterpolator interpolator = new FieldHermiteInterpolator(); interpolator.addSamplePoint(new BigFraction(1), new BigFraction[] { new BigFraction(0) }); interpolator.addSamplePoint(new BigFraction(1), new BigFraction[] { new BigFraction(1) }); } diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/FieldBracketingNthOrderBrentSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/FieldBracketingNthOrderBrentSolverTest.java index d50e06c07..a1d5587f7 100644 --- a/src/test/java/org/apache/commons/math4/analysis/solvers/FieldBracketingNthOrderBrentSolverTest.java +++ b/src/test/java/org/apache/commons/math4/analysis/solvers/FieldBracketingNthOrderBrentSolverTest.java @@ -36,14 +36,14 @@ public final class FieldBracketingNthOrderBrentSolverTest { @Test(expected=NumberIsTooSmallException.class) public void testInsufficientOrder3() { - new FieldBracketingNthOrderBrentSolver<>(relativeAccuracy, absoluteAccuracy, + new FieldBracketingNthOrderBrentSolver(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, 1); } @Test public void testConstructorOK() { FieldBracketingNthOrderBrentSolver solver = - new FieldBracketingNthOrderBrentSolver<>(relativeAccuracy, absoluteAccuracy, + new FieldBracketingNthOrderBrentSolver(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, 2); Assert.assertEquals(2, solver.getMaximalOrder()); } @@ -51,7 +51,7 @@ public final class FieldBracketingNthOrderBrentSolverTest { @Test public void testConvergenceOnFunctionAccuracy() { FieldBracketingNthOrderBrentSolver solver = - new FieldBracketingNthOrderBrentSolver<>(relativeAccuracy, absoluteAccuracy, + new FieldBracketingNthOrderBrentSolver(relativeAccuracy, absoluteAccuracy, field.newDfp(1.0e-20), 20); RealFieldUnivariateFunction f = new RealFieldUnivariateFunction() { public Dfp value(Dfp x) { @@ -127,7 +127,7 @@ public final class FieldBracketingNthOrderBrentSolverTest { private void check(RealFieldUnivariateFunction f, int maxEval, double min, double max, AllowedSolution allowedSolution) { FieldBracketingNthOrderBrentSolver solver = - new FieldBracketingNthOrderBrentSolver<>(relativeAccuracy, absoluteAccuracy, + new FieldBracketingNthOrderBrentSolver(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, 20); Dfp xResult = solver.solve(maxEval, f, field.newDfp(min), field.newDfp(max), allowedSolution); diff --git a/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java index f903cbc3f..f1cf6521d 100644 --- a/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java @@ -192,10 +192,10 @@ public class EnumeratedRealDistributionTest { @Test public void testIssue942() { - List> list = new ArrayList<>(); + List> list = new ArrayList>(); list.add(new Pair(new Object() {}, new Double(0))); list.add(new Pair(new Object() {}, new Double(1))); - Assert.assertEquals(1, new EnumeratedDistribution<>(list).sample(1).length); + Assert.assertEquals(1, new EnumeratedDistribution(list).sample(1).length); } @Test diff --git a/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalMixtureModelDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalMixtureModelDistributionTest.java index aedaba0e7..8bed77000 100644 --- a/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalMixtureModelDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalMixtureModelDistributionTest.java @@ -151,12 +151,12 @@ public class MultivariateNormalMixtureModelDistributionTest { double[][] means, double[][][] covariances) { final List> mvns - = new ArrayList<>(); + = new ArrayList>(); for (int i = 0; i < weights.length; i++) { final MultivariateNormalDistribution dist = new MultivariateNormalDistribution(means[i], covariances[i]); - mvns.add(new Pair<>(weights[i], dist)); + mvns.add(new Pair(weights[i], dist)); } return new MultivariateNormalMixtureModelDistribution(mvns); diff --git a/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java b/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java index 1a5e2109f..9fffeaf6a 100644 --- a/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java @@ -357,7 +357,7 @@ public abstract class RealDistributionAbstractTest { return distribution.density(x); } }; - final ArrayList integrationTestPoints = new ArrayList<>(); + final ArrayList integrationTestPoints = new ArrayList(); for (int i = 0; i < cumulativeTestPoints.length; i++) { if (Double.isNaN(cumulativeTestValues[i]) || cumulativeTestValues[i] < 1.0e-5 || diff --git a/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java b/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java index f31f4c80d..cb6860357 100644 --- a/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java +++ b/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java @@ -129,10 +129,10 @@ public class MultivariateNormalMixtureExpectationMaximizationTest { // Create components and mixture List> components = - new ArrayList<>(); - components.add(new Pair<>( + new ArrayList>(); + components.add(new Pair( weights[0], mvns[0])); - components.add(new Pair<>( + components.add(new Pair( weights[1], mvns[1])); MixtureMultivariateNormalDistribution badInitialMix diff --git a/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java b/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java index e7fddf692..46ed1893c 100644 --- a/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java +++ b/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java @@ -30,7 +30,7 @@ import org.junit.Test; public class ArgUtilsTest { @Test public void testFlatten() { - final List orig = new ArrayList<>(); + final List orig = new ArrayList(); final Object[] struct = new Object[] { new Object[] { diff --git a/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java index e3b195947..17097f56d 100644 --- a/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java +++ b/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java @@ -170,7 +170,7 @@ public class HarmonicCurveFitterTest { 0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 3, 2, 1, 0 }; - final List points = new ArrayList<>(); + final List points = new ArrayList(); for (int i = 0; i < y.length; i++) { points.add(new WeightedObservedPoint(1, i, y[i])); } diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java index 016bf8bc0..377726d7e 100644 --- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java +++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java @@ -57,7 +57,7 @@ class CircleProblem { public CircleProblem(double xError, double yError, int searchResolution) { - points = new ArrayList<>(); + points = new ArrayList(); xSigma = xError; ySigma = yError; resolution = searchResolution; diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java index 87a2b6f84..3c88431fd 100644 --- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java +++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java @@ -29,7 +29,7 @@ class CircleVectorial { private ArrayList points; public CircleVectorial() { - points = new ArrayList<>(); + points = new ArrayList(); } public void addPoint(double px, double py) { diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java index bffb95b8e..b34dcafe2 100644 --- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java +++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java @@ -262,7 +262,7 @@ public class EvaluationTest { // "MultivariateJacobianFunction". final MultivariateJacobianFunction m1 = new MultivariateJacobianFunction() { public Pair value(RealVector notUsed) { - return new Pair<>(null, null); + return new Pair(null, null); } }; @@ -276,7 +276,7 @@ public class EvaluationTest { final MultivariateJacobianFunction m2 = new ValueAndJacobianFunction() { public Pair value(RealVector notUsed) { - return new Pair<>(null, null); + return new Pair(null, null); } public RealVector computeValue(final double[] params) { return null; diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTestValidation.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTestValidation.java index 3c637aeb3..664285427 100644 --- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTestValidation.java +++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTestValidation.java @@ -232,7 +232,7 @@ public class EvaluationTestValidation { // Index 0 = slope // Index 1 = offset // Index 2 = normalized chi2 - final List paramsAndChi2 = new ArrayList<>(gridSize * gridSize); + final List paramsAndChi2 = new ArrayList(gridSize * gridSize); final double slopeRange = 10 * sigma.getEntry(0); final double offsetRange = 10 * sigma.getEntry(1); diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java index 9b9c55d26..6198eb71c 100644 --- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java +++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java @@ -360,8 +360,8 @@ public class LevenbergMarquardtOptimizerTest private List count; public BevingtonProblem() { - time = new ArrayList<>(); - count = new ArrayList<>(); + time = new ArrayList(); + count = new ArrayList(); } public void addPoint(double t, double c) { diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDataset.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDataset.java index 08c60f708..f78b318d2 100644 --- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDataset.java +++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDataset.java @@ -68,7 +68,7 @@ public abstract class StatisticalReferenceDataset { public StatisticalReferenceDataset(final BufferedReader in) throws IOException { - final ArrayList lines = new ArrayList<>(); + final ArrayList lines = new ArrayList(); for (String line = in.readLine(); line != null; line = in.readLine()) { lines.add(line); } diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/StraightLineProblem.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/StraightLineProblem.java index 7ce8323c6..b59e703be 100644 --- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/StraightLineProblem.java +++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/StraightLineProblem.java @@ -46,7 +46,7 @@ class StraightLineProblem { * @param error Assumed error for the y-coordinate. */ public StraightLineProblem(double error) { - points = new ArrayList<>(); + points = new ArrayList(); sigma = error; } diff --git a/src/test/java/org/apache/commons/math4/genetics/ChromosomeTest.java b/src/test/java/org/apache/commons/math4/genetics/ChromosomeTest.java index 3c1a6edb2..126d5c398 100644 --- a/src/test/java/org/apache/commons/math4/genetics/ChromosomeTest.java +++ b/src/test/java/org/apache/commons/math4/genetics/ChromosomeTest.java @@ -92,7 +92,7 @@ public class ChromosomeTest { } }; - List popChr = new ArrayList<>(); + List popChr = new ArrayList(); popChr.add(c1); popChr.add(c2); popChr.add(c3); diff --git a/src/test/java/org/apache/commons/math4/genetics/FitnessCachingTest.java b/src/test/java/org/apache/commons/math4/genetics/FitnessCachingTest.java index 0903c4979..71ae818bd 100644 --- a/src/test/java/org/apache/commons/math4/genetics/FitnessCachingTest.java +++ b/src/test/java/org/apache/commons/math4/genetics/FitnessCachingTest.java @@ -81,7 +81,7 @@ public class FitnessCachingTest { * Initializes a random population. */ private static ElitisticListPopulation randomPopulation() { - List popList = new LinkedList<>(); + List popList = new LinkedList(); for (int i=0; i popList = new LinkedList<>(); + List popList = new LinkedList(); for (int i=0; i sequence = new ArrayList<>(); + private static final List sequence = new ArrayList(); static { for (int i=0; i popList = new ArrayList<>(); + List popList = new ArrayList(); for (int i=0; i chromosomes = new ArrayList<> (); + ArrayList chromosomes = new ArrayList (); chromosomes.add(c1); chromosomes.add(c2); chromosomes.add(c3); @@ -67,7 +67,7 @@ public class ListPopulationTest { @Test public void testChromosomes() { - final ArrayList chromosomes = new ArrayList<> (); + final ArrayList chromosomes = new ArrayList (); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); @@ -112,7 +112,7 @@ public class ListPopulationTest { @Test(expected = NotPositiveException.class) public void testChromosomeListConstructorPopulationLimitNotPositive() { - final ArrayList chromosomes = new ArrayList<> (); + final ArrayList chromosomes = new ArrayList (); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); new ListPopulation(chromosomes, -10) { public Population nextGeneration() { @@ -124,7 +124,7 @@ public class ListPopulationTest { @Test(expected = NumberIsTooLargeException.class) public void testConstructorListOfChromosomesBiggerThanPopulationSize() { - final ArrayList chromosomes = new ArrayList<> (); + final ArrayList chromosomes = new ArrayList (); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); @@ -138,7 +138,7 @@ public class ListPopulationTest { @Test(expected=NumberIsTooLargeException.class) public void testAddTooManyChromosomes() { - final ArrayList chromosomes = new ArrayList<> (); + final ArrayList chromosomes = new ArrayList (); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); @@ -170,7 +170,7 @@ public class ListPopulationTest { @Test(expected = UnsupportedOperationException.class) public void testIterator() { - final ArrayList chromosomes = new ArrayList<>(); + final ArrayList chromosomes = new ArrayList(); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); @@ -193,7 +193,7 @@ public class ListPopulationTest { @Test(expected=NumberIsTooSmallException.class) public void testSetPopulationLimitTooSmall() { - final ArrayList chromosomes = new ArrayList<> (); + final ArrayList chromosomes = new ArrayList (); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); diff --git a/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java b/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java index 2a1231f2e..4f05d81b3 100644 --- a/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java +++ b/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java @@ -94,7 +94,7 @@ public class NPointCrossoverTest { BinaryChromosome p2c = new DummyBinaryChromosome(p2); final int order = 3; - NPointCrossover npc = new NPointCrossover<>(order); + NPointCrossover npc = new NPointCrossover(order); // the two parent chromosomes are different at each position, so it is easy to detect // the number of crossovers that happened for each child diff --git a/src/test/java/org/apache/commons/math4/genetics/OnePointCrossoverTest.java b/src/test/java/org/apache/commons/math4/genetics/OnePointCrossoverTest.java index 482aad007..6f431e2cf 100644 --- a/src/test/java/org/apache/commons/math4/genetics/OnePointCrossoverTest.java +++ b/src/test/java/org/apache/commons/math4/genetics/OnePointCrossoverTest.java @@ -34,7 +34,7 @@ public class OnePointCrossoverTest { BinaryChromosome p1c = new DummyBinaryChromosome(p1); BinaryChromosome p2c = new DummyBinaryChromosome(p2); - OnePointCrossover opc = new OnePointCrossover<>(); + OnePointCrossover opc = new OnePointCrossover(); // how to test a stochastic method? for (int i=0; i<20; i++) { diff --git a/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java b/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java index 2290fabdb..9379da1ce 100644 --- a/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java +++ b/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java @@ -42,8 +42,8 @@ public class OrderedCrossoverTest { final CrossoverPolicy cp = new OrderedCrossover(); for (int i = 0; i < 20; i++) { - final Set parentSet1 = new HashSet<>(Arrays.asList(p1)); - final Set parentSet2 = new HashSet<>(Arrays.asList(p2)); + final Set parentSet1 = new HashSet(Arrays.asList(p1)); + final Set parentSet2 = new HashSet(Arrays.asList(p2)); final ChromosomePair pair = cp.crossover(p1c, p2c); diff --git a/src/test/java/org/apache/commons/math4/genetics/UniformCrossoverTest.java b/src/test/java/org/apache/commons/math4/genetics/UniformCrossoverTest.java index 73c6052dc..45e2a2b29 100644 --- a/src/test/java/org/apache/commons/math4/genetics/UniformCrossoverTest.java +++ b/src/test/java/org/apache/commons/math4/genetics/UniformCrossoverTest.java @@ -33,8 +33,8 @@ import org.junit.Test; public class UniformCrossoverTest { private static final int LEN = 10000; - private static final List p1 = new ArrayList<>(LEN); - private static final List p2 = new ArrayList<>(LEN); + private static final List p1 = new ArrayList(LEN); + private static final List p2 = new ArrayList(LEN); @SuppressWarnings("boxing") @BeforeClass diff --git a/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java b/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java index f0daa4cfe..3729574e6 100644 --- a/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java @@ -37,7 +37,7 @@ public class WelzlEncloser2DTest { public void testNullList() { DiskGenerator generator = new DiskGenerator(); WelzlEncloser encloser = - new WelzlEncloser<>(1.0e-10, generator); + new WelzlEncloser(1.0e-10, generator); EnclosingBall ball = encloser.enclose(null); Assert.assertTrue(ball.getRadius() < 0); } @@ -46,7 +46,7 @@ public class WelzlEncloser2DTest { public void testNoPoints() { DiskGenerator generator = new DiskGenerator(); WelzlEncloser encloser = - new WelzlEncloser<>(1.0e-10, generator); + new WelzlEncloser(1.0e-10, generator); EnclosingBall ball = encloser.enclose(new ArrayList()); Assert.assertTrue(ball.getRadius() < 0); } @@ -87,7 +87,7 @@ public class WelzlEncloser2DTest { RandomGenerator random = new Well1024a(0xa2a63cad12c01fb2l); for (int k = 0; k < 100; ++k) { int nbPoints = random.nextInt(10000); - List points = new ArrayList<>(); + List points = new ArrayList(); for (int i = 0; i < nbPoints; ++i) { double x = random.nextDouble(); double y = random.nextDouble(); @@ -98,7 +98,7 @@ public class WelzlEncloser2DTest { } private List buildList(final double ... coordinates) { - List list = new ArrayList<>(coordinates.length / 2); + List list = new ArrayList(coordinates.length / 2); for (int i = 0; i < coordinates.length; i += 2) { list.add(new Vector2D(coordinates[i], coordinates[i + 1])); } @@ -129,7 +129,7 @@ public class WelzlEncloser2DTest { // check removing any point of the support disk fails to enclose the point for (int i = 0; i < disk.getSupportSize(); ++i) { - List reducedSupport = new ArrayList<>(); + List reducedSupport = new ArrayList(); int count = 0; for (Vector2D s : disk.getSupport()) { if (count++ != i) { @@ -151,7 +151,7 @@ public class WelzlEncloser2DTest { private EnclosingBall checkDisk(List points) { WelzlEncloser encloser = - new WelzlEncloser<>(1.0e-10, new DiskGenerator()); + new WelzlEncloser(1.0e-10, new DiskGenerator()); EnclosingBall disk = encloser.enclose(points); // all points are enclosed diff --git a/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser3DTest.java b/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser3DTest.java index f8ef012f1..aaa4c4346 100644 --- a/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser3DTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser3DTest.java @@ -39,7 +39,7 @@ public class WelzlEncloser3DTest { public void testNullList() { SphereGenerator generator = new SphereGenerator(); WelzlEncloser encloser = - new WelzlEncloser<>(1.0e-10, generator); + new WelzlEncloser(1.0e-10, generator); EnclosingBall ball = encloser.enclose(null); Assert.assertTrue(ball.getRadius() < 0); } @@ -48,7 +48,7 @@ public class WelzlEncloser3DTest { public void testNoPoints() { SphereGenerator generator = new SphereGenerator(); WelzlEncloser encloser = - new WelzlEncloser<>(1.0e-10, generator); + new WelzlEncloser(1.0e-10, generator); EnclosingBall ball = encloser.enclose(new ArrayList()); Assert.assertTrue(ball.getRadius() < 0); } @@ -68,7 +68,7 @@ public class WelzlEncloser3DTest { new Vector3D(-7.140322188726825, -16.574152894557717, 11.710305611121410), new Vector3D(-7.141116131477088, -16.574061164624560, 11.712938509321699)); WelzlEncloser encloser = - new WelzlEncloser<>(1.0e-10, new SphereGenerator()); + new WelzlEncloser(1.0e-10, new SphereGenerator()); EnclosingBall ball = encloser.enclose(list); Assert.assertTrue(ball.getRadius() > 0); } @@ -97,7 +97,7 @@ public class WelzlEncloser3DTest { new Vector3D( -0.98034899533935820, -3.34004481162763960, 13.03245014017556800)); WelzlEncloser encloser = - new WelzlEncloser<>(1.0e-10, new SphereGenerator()); + new WelzlEncloser(1.0e-10, new SphereGenerator()); EnclosingBall ball = encloser.enclose(list); Assert.assertTrue(ball.getRadius() > 0); } @@ -114,7 +114,7 @@ public class WelzlEncloser3DTest { Vector3D refCenter = new Vector3D(d, new Vector3D(sr.nextVector())); // set up a large sample inside the reference sphere int nbPoints = random.nextInt(1000); - List points = new ArrayList<>(); + List points = new ArrayList(); for (int i = 0; i < nbPoints; ++i) { double r = refRadius * random.nextDouble(); points.add(new Vector3D(1.0, refCenter, r, new Vector3D(sr.nextVector()))); @@ -135,7 +135,7 @@ public class WelzlEncloser3DTest { // check removing any point of the support Sphere fails to enclose the point for (int i = 0; i < sphere.getSupportSize(); ++i) { - List reducedSupport = new ArrayList<>(); + List reducedSupport = new ArrayList(); int count = 0; for (Vector3D s : sphere.getSupport()) { if (count++ != i) { @@ -158,7 +158,7 @@ public class WelzlEncloser3DTest { private EnclosingBall checkSphere(List points) { WelzlEncloser encloser = - new WelzlEncloser<>(1.0e-10, new SphereGenerator()); + new WelzlEncloser(1.0e-10, new SphereGenerator()); EnclosingBall Sphere = encloser.enclose(points); // all points are enclosed diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java index b7c839913..a8b00dcaf 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java @@ -66,7 +66,7 @@ public class IntervalsSetTest { @Test public void testMultiple() { - RegionFactory factory = new RegionFactory<>(); + RegionFactory factory = new RegionFactory(); IntervalsSet set = (IntervalsSet) factory.intersection(factory.union(factory.difference(new IntervalsSet(1.0, 6.0, 1.0e-10), new IntervalsSet(3.0, 5.0, 1.0e-10)), diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDSTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDSTest.java index d9308fdf2..5b352eb17 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDSTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDSTest.java @@ -66,7 +66,7 @@ public class FieldRotationDSTest { @Deprecated public void testAxisAngleDeprecated() throws MathIllegalArgumentException { - FieldRotation r = new FieldRotation<>(createAxis(10, 10, 10), createAngle(2 * FastMath.PI / 3)); + FieldRotation r = new FieldRotation(createAxis(10, 10, 10), createAngle(2 * FastMath.PI / 3)); checkVector(r.applyTo(createVector(1, 0, 0)), createVector(0, 1, 0)); checkVector(r.applyTo(createVector(0, 1, 0)), createVector(0, 0, 1)); checkVector(r.applyTo(createVector(0, 0, 1)), createVector(1, 0, 0)); @@ -75,16 +75,16 @@ public class FieldRotationDSTest { checkAngle(r.getAngle(), 2 * FastMath.PI / 3); try { - new FieldRotation<>(createAxis(0, 0, 0), createAngle(2 * FastMath.PI / 3)); + new FieldRotation(createAxis(0, 0, 0), createAngle(2 * FastMath.PI / 3)); Assert.fail("an exception should have been thrown"); } catch (MathIllegalArgumentException e) { } - r = new FieldRotation<>(createAxis(0, 0, 1), createAngle(1.5 * FastMath.PI)); + r = new FieldRotation(createAxis(0, 0, 1), createAngle(1.5 * FastMath.PI)); checkVector(r.getAxis(), createVector(0, 0, -1)); checkAngle(r.getAngle(), 0.5 * FastMath.PI); - r = new FieldRotation<>(createAxis(0, 1, 0), createAngle(FastMath.PI)); + r = new FieldRotation(createAxis(0, 1, 0), createAngle(FastMath.PI)); checkVector(r.getAxis(), createVector(0, 1, 0)); checkAngle(r.getAngle(), FastMath.PI); @@ -95,7 +95,7 @@ public class FieldRotationDSTest { @Test public void testAxisAngleVectorOperator() throws MathIllegalArgumentException { - FieldRotation r = new FieldRotation<>(createAxis(10, 10, 10), + FieldRotation r = new FieldRotation(createAxis(10, 10, 10), createAngle(2 * FastMath.PI / 3) , RotationConvention.VECTOR_OPERATOR); checkVector(r.applyTo(createVector(1, 0, 0)), createVector(0, 1, 0)); @@ -107,21 +107,21 @@ public class FieldRotationDSTest { checkAngle(r.getAngle(), 2 * FastMath.PI / 3); try { - new FieldRotation<>(createAxis(0, 0, 0), + new FieldRotation(createAxis(0, 0, 0), createAngle(2 * FastMath.PI / 3), RotationConvention.VECTOR_OPERATOR); Assert.fail("an exception should have been thrown"); } catch (MathIllegalArgumentException e) { } - r = new FieldRotation<>(createAxis(0, 0, 1), + r = new FieldRotation(createAxis(0, 0, 1), createAngle(1.5 * FastMath.PI), RotationConvention.VECTOR_OPERATOR); checkVector(r.getAxis(RotationConvention.VECTOR_OPERATOR), createVector(0, 0, -1)); checkVector(r.getAxis(RotationConvention.FRAME_TRANSFORM), createVector(0, 0, +1)); checkAngle(r.getAngle(), 0.5 * FastMath.PI); - r = new FieldRotation<>(createAxis(0, 1, 0), + r = new FieldRotation(createAxis(0, 1, 0), createAngle(FastMath.PI), RotationConvention.VECTOR_OPERATOR); checkVector(r.getAxis(RotationConvention.VECTOR_OPERATOR), createVector(0, +1, 0)); @@ -136,7 +136,7 @@ public class FieldRotationDSTest { @Test public void testAxisAngleFrameTransform() throws MathIllegalArgumentException { - FieldRotation r = new FieldRotation<>(createAxis(10, 10, 10), + FieldRotation r = new FieldRotation(createAxis(10, 10, 10), createAngle(2 * FastMath.PI / 3) , RotationConvention.FRAME_TRANSFORM); checkVector(r.applyTo(createVector(1, 0, 0)), createVector(0, 0, 1)); @@ -148,21 +148,21 @@ public class FieldRotationDSTest { checkAngle(r.getAngle(), 2 * FastMath.PI / 3); try { - new FieldRotation<>(createAxis(0, 0, 0), + new FieldRotation(createAxis(0, 0, 0), createAngle(2 * FastMath.PI / 3), RotationConvention.FRAME_TRANSFORM); Assert.fail("an exception should have been thrown"); } catch (MathIllegalArgumentException e) { } - r = new FieldRotation<>(createAxis(0, 0, 1), + r = new FieldRotation(createAxis(0, 0, 1), createAngle(1.5 * FastMath.PI), RotationConvention.FRAME_TRANSFORM); checkVector(r.getAxis(RotationConvention.FRAME_TRANSFORM), createVector(0, 0, -1)); checkVector(r.getAxis(RotationConvention.VECTOR_OPERATOR), createVector(0, 0, +1)); checkAngle(r.getAngle(), 0.5 * FastMath.PI); - r = new FieldRotation<>(createAxis(0, 1, 0), + r = new FieldRotation(createAxis(0, 1, 0), createAngle(FastMath.PI), RotationConvention.FRAME_TRANSFORM); checkVector(r.getAxis(RotationConvention.FRAME_TRANSFORM), createVector(0, +1, 0)); @@ -395,13 +395,13 @@ public class FieldRotationDSTest { FieldVector3D u = createVector(3, 2, 1); FieldVector3D v = createVector(-4, 2, 2); - FieldRotation r = new FieldRotation<>(u, v); + FieldRotation r = new FieldRotation(u, v); checkVector(r.applyTo(u.scalarMultiply(v.getNorm())), v.scalarMultiply(u.getNorm())); - checkAngle(new FieldRotation<>(u, u.negate()).getAngle(), FastMath.PI); + checkAngle(new FieldRotation(u, u.negate()).getAngle(), FastMath.PI); try { - new FieldRotation<>(u, createVector(0, 0, 0)); + new FieldRotation(u, createVector(0, 0, 0)); Assert.fail("an exception should have been thrown"); } catch (MathArithmeticException e) { // expected behavior @@ -416,11 +416,11 @@ public class FieldRotationDSTest { FieldVector3D u2 = createVector(0, 5, 0); FieldVector3D v1 = createVector(0, 0, 2); FieldVector3D v2 = createVector(-2, 0, 2); - FieldRotation r = new FieldRotation<>(u1, u2, v1, v2); + FieldRotation r = new FieldRotation(u1, u2, v1, v2); checkVector(r.applyTo(createVector(1, 0, 0)), createVector(0, 0, 1)); checkVector(r.applyTo(createVector(0, 1, 0)), createVector(-1, 0, 0)); - r = new FieldRotation<>(u1, u2, u1.negate(), u2.negate()); + r = new FieldRotation(u1, u2, u1.negate(), u2.negate()); FieldVector3D axis = r.getAxis(RotationConvention.VECTOR_OPERATOR); if (FieldVector3D.dotProduct(axis, createVector(0, 0, 1)).getReal() > 0) { checkVector(axis, createVector(0, 0, 1)); @@ -430,18 +430,18 @@ public class FieldRotationDSTest { checkAngle(r.getAngle(), FastMath.PI); double sqrt = FastMath.sqrt(2) / 2; - r = new FieldRotation<>(createVector(1, 0, 0), createVector(0, 1, 0), + r = new FieldRotation(createVector(1, 0, 0), createVector(0, 1, 0), createVector(0.5, 0.5, sqrt), createVector(0.5, 0.5, -sqrt)); checkRotationDS(r, sqrt, 0.5, 0.5, 0); - r = new FieldRotation<>(u1, u2, u1, FieldVector3D.crossProduct(u1, u2)); + r = new FieldRotation(u1, u2, u1, FieldVector3D.crossProduct(u1, u2)); checkRotationDS(r, sqrt, -sqrt, 0, 0); - checkRotationDS(new FieldRotation<>(u1, u2, u1, u2), 1, 0, 0, 0); + checkRotationDS(new FieldRotation(u1, u2, u1, u2), 1, 0, 0, 0); try { - new FieldRotation<>(u1, u2, createVector(0, 0, 0), v2); + new FieldRotation(u1, u2, createVector(0, 0, 0), v2); Assert.fail("an exception should have been thrown"); } catch (MathArithmeticException e) { // expected behavior @@ -571,11 +571,11 @@ public class FieldRotationDSTest { } checkVector(r.applyTo(createVector(1, 0, 0)), - new FieldVector3D<>(m3[0][0], m3[1][0], m3[2][0])); + new FieldVector3D(m3[0][0], m3[1][0], m3[2][0])); checkVector(r.applyTo(createVector(0, 1, 0)), - new FieldVector3D<>(m3[0][1], m3[1][1], m3[2][1])); + new FieldVector3D(m3[0][1], m3[1][1], m3[2][1])); checkVector(r.applyTo(createVector(0, 0, 1)), - new FieldVector3D<>(m3[0][2], m3[1][2], m3[2][2])); + new FieldVector3D(m3[0][2], m3[1][2], m3[2][2])); double[][] m4 = { { 1.0, 0.0, 0.0 }, { 0.0, -1.0, 0.0 }, @@ -609,7 +609,7 @@ public class FieldRotationDSTest { for (double alpha1 = 0.1; alpha1 < 6.2; alpha1 += 0.3) { for (double alpha2 = -1.55; alpha2 < 1.55; alpha2 += 0.3) { for (double alpha3 = 0.1; alpha3 < 6.2; alpha3 += 0.3) { - FieldRotation r = new FieldRotation<>(CardanOrders[i], + FieldRotation r = new FieldRotation(CardanOrders[i], new DerivativeStructure(3, 1, 0, alpha1), new DerivativeStructure(3, 1, 1, alpha2), new DerivativeStructure(3, 1, 2, alpha3)); @@ -631,7 +631,7 @@ public class FieldRotationDSTest { for (double alpha1 = 0.1; alpha1 < 6.2; alpha1 += 0.3) { for (double alpha2 = 0.05; alpha2 < 3.1; alpha2 += 0.3) { for (double alpha3 = 0.1; alpha3 < 6.2; alpha3 += 0.3) { - FieldRotation r = new FieldRotation<>(EulerOrders[i], + FieldRotation r = new FieldRotation(EulerOrders[i], new DerivativeStructure(3, 1, 0, alpha1), new DerivativeStructure(3, 1, 1, alpha2), new DerivativeStructure(3, 1, 2, alpha3)); @@ -661,7 +661,7 @@ public class FieldRotationDSTest { for (double alpha2 = -1.55; alpha2 < 1.55; alpha2 += 0.3) { for (double alpha3 = 0.1; alpha3 < 6.2; alpha3 += 0.3) { FieldRotation r = - new FieldRotation<>(CardanOrders[i], + new FieldRotation(CardanOrders[i], convention, new DerivativeStructure(3, 1, 0, alpha1), new DerivativeStructure(3, 1, 1, alpha2), @@ -685,7 +685,7 @@ public class FieldRotationDSTest { for (double alpha2 = 0.05; alpha2 < 3.1; alpha2 += 0.3) { for (double alpha3 = 0.1; alpha3 < 6.2; alpha3 += 0.3) { FieldRotation r = - new FieldRotation<>(EulerOrders[i], + new FieldRotation(EulerOrders[i], convention, new DerivativeStructure(3, 1, 0, alpha1), new DerivativeStructure(3, 1, 1, alpha2), @@ -715,7 +715,7 @@ public class FieldRotationDSTest { for (int i = 0; i < CardanOrders.length; ++i) { for (int j = 0; j < singularCardanAngle.length; ++j) { FieldRotation r = - new FieldRotation<>(CardanOrders[i], + new FieldRotation(CardanOrders[i], convention, new DerivativeStructure(3, 1, 0, 0.1), new DerivativeStructure(3, 1, 1, singularCardanAngle[j]), @@ -738,7 +738,7 @@ public class FieldRotationDSTest { for (int i = 0; i < EulerOrders.length; ++i) { for (int j = 0; j < singularEulerAngle.length; ++j) { FieldRotation r = - new FieldRotation<>(EulerOrders[i], + new FieldRotation(EulerOrders[i], convention, new DerivativeStructure(3, 1, 0, 0.1), new DerivativeStructure(3, 1, 1, singularEulerAngle[j]), @@ -758,11 +758,11 @@ public class FieldRotationDSTest { @Test public void testQuaternion() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); double n = 23.5; - FieldRotation r2 = new FieldRotation<>(r1.getQ0().multiply(n), r1.getQ1().multiply(n), + FieldRotation r2 = new FieldRotation(r1.getQ0().multiply(n), r1.getQ1().multiply(n), r1.getQ2().multiply(n), r1.getQ3().multiply(n), true); for (double x = -0.9; x < 0.9; x += 0.2) { @@ -788,10 +788,10 @@ public class FieldRotationDSTest { @Test public void testApplyToRotation() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation r2 = new FieldRotation<>(createVector(-1, 3, 2), + FieldRotation r2 = new FieldRotation(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation r3 = r2.applyTo(r1); @@ -816,10 +816,10 @@ public class FieldRotationDSTest { @Test public void testComposeVectorOperator() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation r2 = new FieldRotation<>(createVector(-1, 3, 2), + FieldRotation r2 = new FieldRotation(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation r3 = r2.compose(r1, RotationConvention.VECTOR_OPERATOR); @@ -845,10 +845,10 @@ public class FieldRotationDSTest { @Test public void testComposeFrameTransform() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.FRAME_TRANSFORM); - FieldRotation r2 = new FieldRotation<>(createVector(-1, 3, 2), + FieldRotation r2 = new FieldRotation(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.FRAME_TRANSFORM); FieldRotation r3 = r2.compose(r1, RotationConvention.FRAME_TRANSFORM); @@ -874,10 +874,10 @@ public class FieldRotationDSTest { @Test public void testApplyInverseToRotation() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation r2 = new FieldRotation<>(createVector(-1, 3, 2), + FieldRotation r2 = new FieldRotation(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation r3 = r2.applyInverseTo(r1); @@ -902,10 +902,10 @@ public class FieldRotationDSTest { @Test public void testComposeInverseVectorOperator() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation r2 = new FieldRotation<>(createVector(-1, 3, 2), + FieldRotation r2 = new FieldRotation(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation r3 = r2.composeInverse(r1, RotationConvention.VECTOR_OPERATOR); @@ -931,10 +931,10 @@ public class FieldRotationDSTest { @Test public void testComposeInverseframeTransform() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.FRAME_TRANSFORM); - FieldRotation r2 = new FieldRotation<>(createVector(-1, 3, 2), + FieldRotation r2 = new FieldRotation(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.FRAME_TRANSFORM); FieldRotation r3 = r2.composeInverse(r1, RotationConvention.FRAME_TRANSFORM); @@ -964,7 +964,7 @@ public class FieldRotationDSTest { UnitSphereRandomVectorGenerator g = new UnitSphereRandomVectorGenerator(3, random); for (int i = 0; i < 10; ++i) { double[] unit = g.nextVector(); - FieldRotation r = new FieldRotation<>(createVector(unit[0], unit[1], unit[2]), + FieldRotation r = new FieldRotation(createVector(unit[0], unit[1], unit[2]), createAngle(random.nextDouble()), RotationConvention.VECTOR_OPERATOR); @@ -982,9 +982,9 @@ public class FieldRotationDSTest { DerivativeStructure[] rIuArray = new DerivativeStructure[3]; r.applyInverseTo(new double[] { x, y, z}, rIuArray); checkVector(ruds, ru); - checkVector(ruds, new FieldVector3D<>(ruArray)); + checkVector(ruds, new FieldVector3D(ruArray)); checkVector(rIuds, rIu); - checkVector(rIuds, new FieldVector3D<>(rIuArray)); + checkVector(rIuds, new FieldVector3D(rIuArray)); } } } @@ -1001,13 +1001,13 @@ public class FieldRotationDSTest { double[] unit1 = g.nextVector(); Rotation r1 = new Rotation(new Vector3D(unit1[0], unit1[1], unit1[2]), random.nextDouble(), RotationConvention.VECTOR_OPERATOR); - FieldRotation r1Prime = new FieldRotation<>(new DerivativeStructure(4, 1, 0, r1.getQ0()), + FieldRotation r1Prime = new FieldRotation(new DerivativeStructure(4, 1, 0, r1.getQ0()), new DerivativeStructure(4, 1, 1, r1.getQ1()), new DerivativeStructure(4, 1, 2, r1.getQ2()), new DerivativeStructure(4, 1, 3, r1.getQ3()), false); double[] unit2 = g.nextVector(); - FieldRotation r2 = new FieldRotation<>(createVector(unit2[0], unit2[1], unit2[2]), + FieldRotation r2 = new FieldRotation(createVector(unit2[0], unit2[1], unit2[2]), createAngle(random.nextDouble()), RotationConvention.VECTOR_OPERATOR); @@ -1047,7 +1047,7 @@ public class FieldRotationDSTest { double theta = 1.7; double cosTheta = FastMath.cos(theta); double sinTheta = FastMath.sin(theta); - FieldRotation r = new FieldRotation<>(createAxis(kx, ky, kz), + FieldRotation r = new FieldRotation(createAxis(kx, ky, kz), createAngle(theta), RotationConvention.VECTOR_OPERATOR); Vector3D a = new Vector3D(kx / n, ky / n, kz / n); @@ -1113,7 +1113,7 @@ public class FieldRotationDSTest { @Test public void testArray() throws MathIllegalArgumentException { - FieldRotation r = new FieldRotation<>(createAxis(2, -3, 5), + FieldRotation r = new FieldRotation(createAxis(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); @@ -1143,7 +1143,7 @@ public class FieldRotationDSTest { DerivativeStructure[] in = new DerivativeStructure[3]; DerivativeStructure[] out = new DerivativeStructure[3]; DerivativeStructure[] rebuilt = new DerivativeStructure[3]; - FieldRotation r = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); for (double lambda = 0; lambda < 6.2; lambda += 0.2) { @@ -1176,7 +1176,7 @@ public class FieldRotationDSTest { } } - r = new FieldRotation<>(createVector(0, 0, 1), + r = new FieldRotation(createVector(0, 0, 1), createAngle(FastMath.PI), RotationConvention.VECTOR_OPERATOR); for (double lambda = 0; lambda < 6.2; lambda += 0.2) { @@ -1199,7 +1199,7 @@ public class FieldRotationDSTest { FieldVector3D u2 =createVector( -5712344449280879.0 / 2097152.0, -2275058564560979.0 / 1048576.0, 4423475992255071.0 / 65536.0); - FieldRotation rot = new FieldRotation<>(u1, u2, createVector(1, 0, 0),createVector(0, 0, 1)); + FieldRotation rot = new FieldRotation(u1, u2, createVector(1, 0, 0),createVector(0, 0, 1)); Assert.assertEquals( 0.6228370359608200639829222, rot.getQ0().getReal(), 1.0e-15); Assert.assertEquals( 0.0257707621456498790029987, rot.getQ1().getReal(), 1.0e-15); Assert.assertEquals(-0.0000000002503012255839931, rot.getQ2().getReal(), 1.0e-15); @@ -1214,7 +1214,7 @@ public class FieldRotationDSTest { FieldVector3D v1 = createVector(0.9999999999999999, 0.0, 0.0); FieldVector3D v2 = createVector(0.0, 0.0, -1.0); - FieldRotation quat = new FieldRotation<>(u1, u2, v1, v2); + FieldRotation quat = new FieldRotation(u1, u2, v1, v2); double q2 = quat.getQ0().getReal() * quat.getQ0().getReal() + quat.getQ1().getReal() * quat.getQ1().getReal() + quat.getQ2().getReal() * quat.getQ2().getReal() + @@ -1236,7 +1236,7 @@ public class FieldRotationDSTest { private FieldRotation createRotation(double q0, double q1, double q2, double q3, boolean needsNormalization) { - return new FieldRotation<>(new DerivativeStructure(4, 1, 0, q0), + return new FieldRotation(new DerivativeStructure(4, 1, 0, q0), new DerivativeStructure(4, 1, 1, q1), new DerivativeStructure(4, 1, 2, q2), new DerivativeStructure(4, 1, 3, q3), @@ -1252,17 +1252,17 @@ public class FieldRotationDSTest { index = (index + 1) % 4; } } - return new FieldRotation<>(mds, threshold); + return new FieldRotation(mds, threshold); } private FieldVector3D createVector(double x, double y, double z) { - return new FieldVector3D<>(new DerivativeStructure(4, 1, x), + return new FieldVector3D(new DerivativeStructure(4, 1, x), new DerivativeStructure(4, 1, y), new DerivativeStructure(4, 1, z)); } private FieldVector3D createAxis(double x, double y, double z) { - return new FieldVector3D<>(new DerivativeStructure(4, 1, 0, x), + return new FieldVector3D(new DerivativeStructure(4, 1, 0, x), new DerivativeStructure(4, 1, 1, y), new DerivativeStructure(4, 1, 2, z)); } diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDfpTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDfpTest.java index 386e6432b..e7df1b0c6 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDfpTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDfpTest.java @@ -65,7 +65,7 @@ public class FieldRotationDfpTest { @Deprecated public void testAxisAngleDeprecated() throws MathIllegalArgumentException { - FieldRotation r = new FieldRotation<>(createAxis(10, 10, 10), createAngle(2 * FastMath.PI / 3)); + FieldRotation r = new FieldRotation(createAxis(10, 10, 10), createAngle(2 * FastMath.PI / 3)); checkVector(r.applyTo(createVector(1, 0, 0)), createVector(0, 1, 0)); checkVector(r.applyTo(createVector(0, 1, 0)), createVector(0, 0, 1)); checkVector(r.applyTo(createVector(0, 0, 1)), createVector(1, 0, 0)); @@ -74,16 +74,16 @@ public class FieldRotationDfpTest { checkAngle(r.getAngle(), 2 * FastMath.PI / 3); try { - new FieldRotation<>(createAxis(0, 0, 0), createAngle(2 * FastMath.PI / 3)); + new FieldRotation(createAxis(0, 0, 0), createAngle(2 * FastMath.PI / 3)); Assert.fail("an exception should have been thrown"); } catch (MathIllegalArgumentException e) { } - r = new FieldRotation<>(createAxis(0, 0, 1), createAngle(1.5 * FastMath.PI)); + r = new FieldRotation(createAxis(0, 0, 1), createAngle(1.5 * FastMath.PI)); checkVector(r.getAxis(), createVector(0, 0, -1)); checkAngle(r.getAngle(), 0.5 * FastMath.PI); - r = new FieldRotation<>(createAxis(0, 1, 0), createAngle(FastMath.PI)); + r = new FieldRotation(createAxis(0, 1, 0), createAngle(FastMath.PI)); checkVector(r.getAxis(), createVector(0, 1, 0)); checkAngle(r.getAngle(), FastMath.PI); @@ -94,7 +94,7 @@ public class FieldRotationDfpTest { @Test public void testAxisAngleVectorOperator() throws MathIllegalArgumentException { - FieldRotation r = new FieldRotation<>(createAxis(10, 10, 10), + FieldRotation r = new FieldRotation(createAxis(10, 10, 10), createAngle(2 * FastMath.PI / 3) , RotationConvention.VECTOR_OPERATOR); checkVector(r.applyTo(createVector(1, 0, 0)), createVector(0, 1, 0)); @@ -106,21 +106,21 @@ public class FieldRotationDfpTest { checkAngle(r.getAngle(), 2 * FastMath.PI / 3); try { - new FieldRotation<>(createAxis(0, 0, 0), + new FieldRotation(createAxis(0, 0, 0), createAngle(2 * FastMath.PI / 3), RotationConvention.VECTOR_OPERATOR); Assert.fail("an exception should have been thrown"); } catch (MathIllegalArgumentException e) { } - r = new FieldRotation<>(createAxis(0, 0, 1), + r = new FieldRotation(createAxis(0, 0, 1), createAngle(1.5 * FastMath.PI), RotationConvention.VECTOR_OPERATOR); checkVector(r.getAxis(RotationConvention.VECTOR_OPERATOR), createVector(0, 0, -1)); checkVector(r.getAxis(RotationConvention.FRAME_TRANSFORM), createVector(0, 0, +1)); checkAngle(r.getAngle(), 0.5 * FastMath.PI); - r = new FieldRotation<>(createAxis(0, 1, 0), + r = new FieldRotation(createAxis(0, 1, 0), createAngle(FastMath.PI), RotationConvention.VECTOR_OPERATOR); checkVector(r.getAxis(RotationConvention.VECTOR_OPERATOR), createVector(0, +1, 0)); @@ -135,7 +135,7 @@ public class FieldRotationDfpTest { @Test public void testAxisAngleFrameTransform() throws MathIllegalArgumentException { - FieldRotation r = new FieldRotation<>(createAxis(10, 10, 10), + FieldRotation r = new FieldRotation(createAxis(10, 10, 10), createAngle(2 * FastMath.PI / 3) , RotationConvention.FRAME_TRANSFORM); checkVector(r.applyTo(createVector(1, 0, 0)), createVector(0, 0, 1)); @@ -147,21 +147,21 @@ public class FieldRotationDfpTest { checkAngle(r.getAngle(), 2 * FastMath.PI / 3); try { - new FieldRotation<>(createAxis(0, 0, 0), + new FieldRotation(createAxis(0, 0, 0), createAngle(2 * FastMath.PI / 3), RotationConvention.FRAME_TRANSFORM); Assert.fail("an exception should have been thrown"); } catch (MathIllegalArgumentException e) { } - r = new FieldRotation<>(createAxis(0, 0, 1), + r = new FieldRotation(createAxis(0, 0, 1), createAngle(1.5 * FastMath.PI), RotationConvention.FRAME_TRANSFORM); checkVector(r.getAxis(RotationConvention.FRAME_TRANSFORM), createVector(0, 0, -1)); checkVector(r.getAxis(RotationConvention.VECTOR_OPERATOR), createVector(0, 0, +1)); checkAngle(r.getAngle(), 0.5 * FastMath.PI); - r = new FieldRotation<>(createAxis(0, 1, 0), + r = new FieldRotation(createAxis(0, 1, 0), createAngle(FastMath.PI), RotationConvention.FRAME_TRANSFORM); checkVector(r.getAxis(RotationConvention.FRAME_TRANSFORM), createVector(0, +1, 0)); @@ -235,13 +235,13 @@ public class FieldRotationDfpTest { FieldVector3D u = createVector(3, 2, 1); FieldVector3D v = createVector(-4, 2, 2); - FieldRotation r = new FieldRotation<>(u, v); + FieldRotation r = new FieldRotation(u, v); checkVector(r.applyTo(u.scalarMultiply(v.getNorm())), v.scalarMultiply(u.getNorm())); - checkAngle(new FieldRotation<>(u, u.negate()).getAngle(), FastMath.PI); + checkAngle(new FieldRotation(u, u.negate()).getAngle(), FastMath.PI); try { - new FieldRotation<>(u, createVector(0, 0, 0)); + new FieldRotation(u, createVector(0, 0, 0)); Assert.fail("an exception should have been thrown"); } catch (MathArithmeticException e) { // expected behavior @@ -256,11 +256,11 @@ public class FieldRotationDfpTest { FieldVector3D u2 = createVector(0, 5, 0); FieldVector3D v1 = createVector(0, 0, 2); FieldVector3D v2 = createVector(-2, 0, 2); - FieldRotation r = new FieldRotation<>(u1, u2, v1, v2); + FieldRotation r = new FieldRotation(u1, u2, v1, v2); checkVector(r.applyTo(createVector(1, 0, 0)), createVector(0, 0, 1)); checkVector(r.applyTo(createVector(0, 1, 0)), createVector(-1, 0, 0)); - r = new FieldRotation<>(u1, u2, u1.negate(), u2.negate()); + r = new FieldRotation(u1, u2, u1.negate(), u2.negate()); FieldVector3D axis = r.getAxis(RotationConvention.VECTOR_OPERATOR); if (FieldVector3D.dotProduct(axis, createVector(0, 0, 1)).getReal() > 0) { checkVector(axis, createVector(0, 0, 1)); @@ -270,18 +270,18 @@ public class FieldRotationDfpTest { checkAngle(r.getAngle(), FastMath.PI); double sqrt = FastMath.sqrt(2) / 2; - r = new FieldRotation<>(createVector(1, 0, 0), createVector(0, 1, 0), + r = new FieldRotation(createVector(1, 0, 0), createVector(0, 1, 0), createVector(0.5, 0.5, sqrt), createVector(0.5, 0.5, -sqrt)); checkRotationDS(r, sqrt, 0.5, 0.5, 0); - r = new FieldRotation<>(u1, u2, u1, FieldVector3D.crossProduct(u1, u2)); + r = new FieldRotation(u1, u2, u1, FieldVector3D.crossProduct(u1, u2)); checkRotationDS(r, sqrt, -sqrt, 0, 0); - checkRotationDS(new FieldRotation<>(u1, u2, u1, u2), 1, 0, 0, 0); + checkRotationDS(new FieldRotation(u1, u2, u1, u2), 1, 0, 0, 0); try { - new FieldRotation<>(u1, u2, createVector(0, 0, 0), v2); + new FieldRotation(u1, u2, createVector(0, 0, 0), v2); Assert.fail("an exception should have been thrown"); } catch (MathArithmeticException e) { // expected behavior @@ -411,11 +411,11 @@ public class FieldRotationDfpTest { } checkVector(r.applyTo(createVector(1, 0, 0)), - new FieldVector3D<>(m3[0][0], m3[1][0], m3[2][0])); + new FieldVector3D(m3[0][0], m3[1][0], m3[2][0])); checkVector(r.applyTo(createVector(0, 1, 0)), - new FieldVector3D<>(m3[0][1], m3[1][1], m3[2][1])); + new FieldVector3D(m3[0][1], m3[1][1], m3[2][1])); checkVector(r.applyTo(createVector(0, 0, 1)), - new FieldVector3D<>(m3[0][2], m3[1][2], m3[2][2])); + new FieldVector3D(m3[0][2], m3[1][2], m3[2][2])); double[][] m4 = { { 1.0, 0.0, 0.0 }, { 0.0, -1.0, 0.0 }, @@ -451,7 +451,7 @@ public class FieldRotationDfpTest { for (double alpha1 = 0.1; alpha1 < 6.2; alpha1 += 2.0) { for (double alpha2 = -1.55; alpha2 < 1.55; alpha2 += 0.8) { for (double alpha3 = 0.1; alpha3 < 6.2; alpha3 += 2.0) { - FieldRotation r = new FieldRotation<>(CardanOrders[i], + FieldRotation r = new FieldRotation(CardanOrders[i], field.newDfp(alpha1), field.newDfp(alpha2), field.newDfp(alpha3)); @@ -473,7 +473,7 @@ public class FieldRotationDfpTest { for (double alpha1 = 0.1; alpha1 < 6.2; alpha1 += 2.0) { for (double alpha2 = 0.05; alpha2 < 3.1; alpha2 += 0.8) { for (double alpha3 = 0.1; alpha3 < 6.2; alpha3 += 2.0) { - FieldRotation r = new FieldRotation<>(EulerOrders[i], + FieldRotation r = new FieldRotation(EulerOrders[i], field.newDfp(alpha1), field.newDfp(alpha2), field.newDfp(alpha3)); @@ -504,7 +504,7 @@ public class FieldRotationDfpTest { for (double alpha1 = 0.1; alpha1 < 6.2; alpha1 += 2.0) { for (double alpha2 = -1.55; alpha2 < 1.55; alpha2 += 0.8) { for (double alpha3 = 0.1; alpha3 < 6.2; alpha3 += 2.0) { - FieldRotation r = new FieldRotation<>(CardanOrders[i], + FieldRotation r = new FieldRotation(CardanOrders[i], convention, field.newDfp(alpha1), field.newDfp(alpha2), @@ -527,7 +527,7 @@ public class FieldRotationDfpTest { for (double alpha1 = 0.1; alpha1 < 6.2; alpha1 += 2.0) { for (double alpha2 = 0.05; alpha2 < 3.1; alpha2 += 0.8) { for (double alpha3 = 0.1; alpha3 < 6.2; alpha3 += 2.0) { - FieldRotation r = new FieldRotation<>(EulerOrders[i], + FieldRotation r = new FieldRotation(EulerOrders[i], convention, field.newDfp(alpha1), field.newDfp(alpha2), @@ -557,7 +557,7 @@ public class FieldRotationDfpTest { double[] singularCardanAngle = { FastMath.PI / 2, -FastMath.PI / 2 }; for (int i = 0; i < CardanOrders.length; ++i) { for (int j = 0; j < singularCardanAngle.length; ++j) { - FieldRotation r = new FieldRotation<>(CardanOrders[i], + FieldRotation r = new FieldRotation(CardanOrders[i], convention, field.newDfp(0.1), field.newDfp(singularCardanAngle[j]), @@ -579,7 +579,7 @@ public class FieldRotationDfpTest { double[] singularEulerAngle = { 0, FastMath.PI }; for (int i = 0; i < EulerOrders.length; ++i) { for (int j = 0; j < singularEulerAngle.length; ++j) { - FieldRotation r = new FieldRotation<>(EulerOrders[i], + FieldRotation r = new FieldRotation(EulerOrders[i], convention, field.newDfp(0.1), field.newDfp(singularEulerAngle[j]), @@ -599,11 +599,11 @@ public class FieldRotationDfpTest { @Test public void testQuaternion() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); double n = 23.5; - FieldRotation r2 = new FieldRotation<>(r1.getQ0().multiply(n), r1.getQ1().multiply(n), + FieldRotation r2 = new FieldRotation(r1.getQ0().multiply(n), r1.getQ1().multiply(n), r1.getQ2().multiply(n), r1.getQ3().multiply(n), true); for (double x = -0.9; x < 0.9; x += 0.2) { @@ -625,10 +625,10 @@ public class FieldRotationDfpTest { @Test public void testApplyToRotation() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation r2 = new FieldRotation<>(createVector(-1, 3, 2), + FieldRotation r2 = new FieldRotation(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation r3 = r2.applyTo(r1); @@ -653,10 +653,10 @@ public class FieldRotationDfpTest { @Test public void testComposeVectorOperator() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation r2 = new FieldRotation<>(createVector(-1, 3, 2), + FieldRotation r2 = new FieldRotation(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation r3 = r2.compose(r1, RotationConvention.VECTOR_OPERATOR); @@ -682,10 +682,10 @@ public class FieldRotationDfpTest { @Test public void testComposeFrameTransform() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.FRAME_TRANSFORM); - FieldRotation r2 = new FieldRotation<>(createVector(-1, 3, 2), + FieldRotation r2 = new FieldRotation(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.FRAME_TRANSFORM); FieldRotation r3 = r2.compose(r1, RotationConvention.FRAME_TRANSFORM); @@ -713,10 +713,10 @@ public class FieldRotationDfpTest { @Test public void testApplyInverseToRotation() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation r2 = new FieldRotation<>(createVector(-1, 3, 2), + FieldRotation r2 = new FieldRotation(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation r3 = r2.applyInverseTo(r1); @@ -741,10 +741,10 @@ public class FieldRotationDfpTest { @Test public void testComposeInverseVectorOperator() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation r2 = new FieldRotation<>(createVector(-1, 3, 2), + FieldRotation r2 = new FieldRotation(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation r3 = r2.composeInverse(r1, RotationConvention.VECTOR_OPERATOR); @@ -770,10 +770,10 @@ public class FieldRotationDfpTest { @Test public void testComposeInverseFrameTransform() throws MathIllegalArgumentException { - FieldRotation r1 = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r1 = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.FRAME_TRANSFORM); - FieldRotation r2 = new FieldRotation<>(createVector(-1, 3, 2), + FieldRotation r2 = new FieldRotation(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.FRAME_TRANSFORM); FieldRotation r3 = r2.composeInverse(r1, RotationConvention.FRAME_TRANSFORM); @@ -805,7 +805,7 @@ public class FieldRotationDfpTest { UnitSphereRandomVectorGenerator g = new UnitSphereRandomVectorGenerator(3, random); for (int i = 0; i < 10; ++i) { double[] unit = g.nextVector(); - FieldRotation r = new FieldRotation<>(createVector(unit[0], unit[1], unit[2]), + FieldRotation r = new FieldRotation(createVector(unit[0], unit[1], unit[2]), createAngle(random.nextDouble()), RotationConvention.VECTOR_OPERATOR); @@ -823,9 +823,9 @@ public class FieldRotationDfpTest { Dfp[] rIuArray = new Dfp[3]; r.applyInverseTo(new double[] { x, y, z}, rIuArray); checkVector(ruds, ru); - checkVector(ruds, new FieldVector3D<>(ruArray)); + checkVector(ruds, new FieldVector3D(ruArray)); checkVector(rIuds, rIu); - checkVector(rIuds, new FieldVector3D<>(rIuArray)); + checkVector(rIuds, new FieldVector3D(rIuArray)); } } } @@ -843,13 +843,13 @@ public class FieldRotationDfpTest { double[] unit1 = g.nextVector(); Rotation r1 = new Rotation(new Vector3D(unit1[0], unit1[1], unit1[2]), random.nextDouble(), RotationConvention.VECTOR_OPERATOR); - FieldRotation r1Prime = new FieldRotation<>(field.newDfp(r1.getQ0()), + FieldRotation r1Prime = new FieldRotation(field.newDfp(r1.getQ0()), field.newDfp(r1.getQ1()), field.newDfp(r1.getQ2()), field.newDfp(r1.getQ3()), false); double[] unit2 = g.nextVector(); - FieldRotation r2 = new FieldRotation<>(createVector(unit2[0], unit2[1], unit2[2]), + FieldRotation r2 = new FieldRotation(createVector(unit2[0], unit2[1], unit2[2]), createAngle(random.nextDouble()), RotationConvention.VECTOR_OPERATOR); @@ -880,7 +880,7 @@ public class FieldRotationDfpTest { @Test public void testArray() throws MathIllegalArgumentException { - FieldRotation r = new FieldRotation<>(createAxis(2, -3, 5), + FieldRotation r = new FieldRotation(createAxis(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); @@ -910,7 +910,7 @@ public class FieldRotationDfpTest { Dfp[] in = new Dfp[3]; Dfp[] out = new Dfp[3]; Dfp[] rebuilt = new Dfp[3]; - FieldRotation r = new FieldRotation<>(createVector(2, -3, 5), + FieldRotation r = new FieldRotation(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); for (double lambda = 0; lambda < 6.2; lambda += 0.2) { @@ -943,7 +943,7 @@ public class FieldRotationDfpTest { } } - r = new FieldRotation<>(createVector(0, 0, 1), createAngle(FastMath.PI), RotationConvention.VECTOR_OPERATOR); + r = new FieldRotation(createVector(0, 0, 1), createAngle(FastMath.PI), RotationConvention.VECTOR_OPERATOR); for (double lambda = 0; lambda < 6.2; lambda += 0.2) { for (double phi = -1.55; phi < 1.55; phi += 0.2) { FieldVector3D u = createVector(FastMath.cos(lambda) * FastMath.cos(phi), @@ -964,7 +964,7 @@ public class FieldRotationDfpTest { FieldVector3D u2 =createVector( -5712344449280879.0 / 2097152.0, -2275058564560979.0 / 1048576.0, 4423475992255071.0 / 65536.0); - FieldRotation rot = new FieldRotation<>(u1, u2, createVector(1, 0, 0),createVector(0, 0, 1)); + FieldRotation rot = new FieldRotation(u1, u2, createVector(1, 0, 0),createVector(0, 0, 1)); Assert.assertEquals( 0.6228370359608200639829222, rot.getQ0().getReal(), 1.0e-15); Assert.assertEquals( 0.0257707621456498790029987, rot.getQ1().getReal(), 1.0e-15); Assert.assertEquals(-0.0000000002503012255839931, rot.getQ2().getReal(), 1.0e-15); @@ -979,7 +979,7 @@ public class FieldRotationDfpTest { FieldVector3D v1 = createVector(0.9999999999999999, 0.0, 0.0); FieldVector3D v2 = createVector(0.0, 0.0, -1.0); - FieldRotation quat = new FieldRotation<>(u1, u2, v1, v2); + FieldRotation quat = new FieldRotation(u1, u2, v1, v2); double q2 = quat.getQ0().getReal() * quat.getQ0().getReal() + quat.getQ1().getReal() * quat.getQ1().getReal() + quat.getQ2().getReal() * quat.getQ2().getReal() + @@ -1002,7 +1002,7 @@ public class FieldRotationDfpTest { private FieldRotation createRotation(double q0, double q1, double q2, double q3, boolean needsNormalization) { DfpField field = new DfpField(20); - return new FieldRotation<>(field.newDfp(q0), + return new FieldRotation(field.newDfp(q0), field.newDfp(q1), field.newDfp(q2), field.newDfp(q3), @@ -1017,17 +1017,17 @@ public class FieldRotationDfpTest { mds[i][j] = field.newDfp(m[i][j]); } } - return new FieldRotation<>(mds, threshold); + return new FieldRotation(mds, threshold); } private FieldVector3D createVector(double x, double y, double z) { DfpField field = new DfpField(20); - return new FieldVector3D<>(field.newDfp(x), field.newDfp(y), field.newDfp(z)); + return new FieldVector3D(field.newDfp(x), field.newDfp(y), field.newDfp(z)); } private FieldVector3D createAxis(double x, double y, double z) { DfpField field = new DfpField(20); - return new FieldVector3D<>(field.newDfp(x), field.newDfp(y), field.newDfp(z)); + return new FieldVector3D(field.newDfp(x), field.newDfp(y), field.newDfp(z)); } private Dfp createAngle(double alpha) { diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java index 758e87005..24e551504 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java @@ -41,8 +41,8 @@ public class FieldVector3DTest { double sinAlpha = FastMath.sqrt(3) / 2.0; double cosDelta = FastMath.sqrt(2) / 2.0; double sinDelta = -FastMath.sqrt(2) / 2.0; - FieldVector3D u = new FieldVector3D<>(2, - new FieldVector3D<>(new DerivativeStructure(2, 1, 0, FastMath.PI / 3), + FieldVector3D u = new FieldVector3D(2, + new FieldVector3D(new DerivativeStructure(2, 1, 0, FastMath.PI / 3), new DerivativeStructure(2, 1, 1, -FastMath.PI / 4))); checkVector(u, 2 * cosAlpha * cosDelta, 2 * sinAlpha * cosDelta, 2 * sinDelta); Assert.assertEquals(-2 * sinAlpha * cosDelta, u.getX().getPartialDerivative(1, 0), 1.0e-12); @@ -52,41 +52,41 @@ public class FieldVector3DTest { Assert.assertEquals(-2 * sinAlpha * sinDelta, u.getY().getPartialDerivative(0, 1), 1.0e-12); Assert.assertEquals(2 * cosDelta, u.getZ().getPartialDerivative(0, 1), 1.0e-12); - checkVector(new FieldVector3D<>(2, createVector(1, 0, 0, 3)), + checkVector(new FieldVector3D(2, createVector(1, 0, 0, 3)), 2, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2); - checkVector(new FieldVector3D<>(new DerivativeStructure(4, 1, 3, 2.0), + checkVector(new FieldVector3D(new DerivativeStructure(4, 1, 3, 2.0), createVector(1, 0, 0, 4)), 2, 0, 0, 2, 0, 0, 1, 0, 2, 0, 0, 0, 0, 2, 0); - checkVector(new FieldVector3D<>(new DerivativeStructure(4, 1, 3, 2.0), + checkVector(new FieldVector3D(new DerivativeStructure(4, 1, 3, 2.0), new Vector3D(1, 0, 0)), 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0); - checkVector(new FieldVector3D<>(2, createVector(1, 0, 0, 3), + checkVector(new FieldVector3D(2, createVector(1, 0, 0, 3), -3, createVector(0, 0, -1, 3)), 2, 0, 3, -1, 0, 0, 0, -1, 0, 0, 0, -1); - checkVector(new FieldVector3D<>(new DerivativeStructure(4, 1, 3, 2.0), + checkVector(new FieldVector3D(new DerivativeStructure(4, 1, 3, 2.0), createVector(1, 0, 0, 4), new DerivativeStructure(4, 1, 3, -3.0), createVector(0, 0, -1, 4)), 2, 0, 3, -1, 0, 0, 1, 0, -1, 0, 0, 0, 0, -1, -1); - checkVector(new FieldVector3D<>(new DerivativeStructure(4, 1, 3, 2.0), + checkVector(new FieldVector3D(new DerivativeStructure(4, 1, 3, 2.0), new Vector3D(1, 0, 0), new DerivativeStructure(4, 1, 3, -3.0), new Vector3D(0, 0, -1)), 2, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1); - checkVector(new FieldVector3D<>(2, createVector(1, 0, 0, 3), + checkVector(new FieldVector3D(2, createVector(1, 0, 0, 3), 5, createVector(0, 1, 0, 3), -3, createVector(0, 0, -1, 3)), 2, 5, 3, 4, 0, 0, 0, 4, 0, 0, 0, 4); - checkVector(new FieldVector3D<>(new DerivativeStructure(4, 1, 3, 2.0), + checkVector(new FieldVector3D(new DerivativeStructure(4, 1, 3, 2.0), createVector(1, 0, 0, 4), new DerivativeStructure(4, 1, 3, 5.0), createVector(0, 1, 0, 4), new DerivativeStructure(4, 1, 3, -3.0), createVector(0, 0, -1, 4)), 2, 5, 3, 4, 0, 0, 1, 0, 4, 0, 1, 0, 0, 4, -1); - checkVector(new FieldVector3D<>(new DerivativeStructure(4, 1, 3, 2.0), + checkVector(new FieldVector3D(new DerivativeStructure(4, 1, 3, 2.0), new Vector3D(1, 0, 0), new DerivativeStructure(4, 1, 3, 5.0), new Vector3D(0, 1, 0), @@ -94,12 +94,12 @@ public class FieldVector3DTest { new Vector3D(0, 0, -1)), 2, 5, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, -1); - checkVector(new FieldVector3D<>(2, createVector(1, 0, 0, 3), + checkVector(new FieldVector3D(2, createVector(1, 0, 0, 3), 5, createVector(0, 1, 0, 3), 5, createVector(0, -1, 0, 3), -3, createVector(0, 0, -1, 3)), 2, 0, 3, 9, 0, 0, 0, 9, 0, 0, 0, 9); - checkVector(new FieldVector3D<>(new DerivativeStructure(4, 1, 3, 2.0), + checkVector(new FieldVector3D(new DerivativeStructure(4, 1, 3, 2.0), createVector(1, 0, 0, 4), new DerivativeStructure(4, 1, 3, 5.0), createVector(0, 1, 0, 4), @@ -108,7 +108,7 @@ public class FieldVector3DTest { new DerivativeStructure(4, 1, 3, -3.0), createVector(0, 0, -1, 4)), 2, 0, 3, 9, 0, 0, 1, 0, 9, 0, 0, 0, 0, 9, -1); - checkVector(new FieldVector3D<>(new DerivativeStructure(4, 1, 3, 2.0), + checkVector(new FieldVector3D(new DerivativeStructure(4, 1, 3, 2.0), new Vector3D(1, 0, 0), new DerivativeStructure(4, 1, 3, 5.0), new Vector3D(0, 1, 0), @@ -118,7 +118,7 @@ public class FieldVector3DTest { new Vector3D(0, 0, -1)), 2, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1); - checkVector(new FieldVector3D<>(new DerivativeStructure[] { + checkVector(new FieldVector3D(new DerivativeStructure[] { new DerivativeStructure(3, 1, 2, 2), new DerivativeStructure(3, 1, 1, 5), new DerivativeStructure(3, 1, 0, -3) @@ -132,16 +132,16 @@ public class FieldVector3DTest { FieldVector3D u1 = createVector(1, 2, 3, 3); FieldVector3D v = createVector(1, 2, 3 + 10 * Precision.EPSILON, 3); Assert.assertTrue(u1.equals(u1)); - Assert.assertTrue(u1.equals(new FieldVector3D<>(new DerivativeStructure(3, 1, 0, 1.0), + Assert.assertTrue(u1.equals(new FieldVector3D(new DerivativeStructure(3, 1, 0, 1.0), new DerivativeStructure(3, 1, 1, 2.0), new DerivativeStructure(3, 1, 2, 3.0)))); - Assert.assertFalse(u1.equals(new FieldVector3D<>(new DerivativeStructure(3, 1, 1.0), + Assert.assertFalse(u1.equals(new FieldVector3D(new DerivativeStructure(3, 1, 1.0), new DerivativeStructure(3, 1, 1, 2.0), new DerivativeStructure(3, 1, 2, 3.0)))); - Assert.assertFalse(u1.equals(new FieldVector3D<>(new DerivativeStructure(3, 1, 0, 1.0), + Assert.assertFalse(u1.equals(new FieldVector3D(new DerivativeStructure(3, 1, 0, 1.0), new DerivativeStructure(3, 1, 2.0), new DerivativeStructure(3, 1, 2, 3.0)))); - Assert.assertFalse(u1.equals(new FieldVector3D<>(new DerivativeStructure(3, 1, 0, 1.0), + Assert.assertFalse(u1.equals(new FieldVector3D(new DerivativeStructure(3, 1, 0, 1.0), new DerivativeStructure(3, 1, 1, 2.0), new DerivativeStructure(3, 1, 3.0)))); Assert.assertFalse(u1.equals(v)); @@ -184,7 +184,7 @@ public class FieldVector3DTest { @Test(expected=DimensionMismatchException.class) public void testWrongDimension() throws DimensionMismatchException { - new FieldVector3D<>(new DerivativeStructure[] { + new FieldVector3D(new DerivativeStructure[] { new DerivativeStructure(3, 1, 0, 2), new DerivativeStructure(3, 1, 0, 5) }); @@ -475,8 +475,8 @@ public class FieldVector3DTest { checkVector(FieldVector3D.crossProduct(v1, v2), -1, 2, 1); double scale = FastMath.scalb(1.0, 100); - FieldVector3D big1 = new FieldVector3D<>(scale, v1); - FieldVector3D small2 = new FieldVector3D<>(1 / scale, v2); + FieldVector3D big1 = new FieldVector3D(scale, v1); + FieldVector3D small2 = new FieldVector3D(1 / scale, v2); checkVector(FieldVector3D.crossProduct(big1, small2), -1, 2, 1); } @@ -637,7 +637,7 @@ public class FieldVector3DTest { final FieldVector3D u3 = createVector(12753243807587107.0 / 18446744073709551616.0, -2313766922703915.0 / 18446744073709551616.0, -227970081415313.0 / 288230376151711744.0, 3); - FieldVector3D cNaive = new FieldVector3D<>(u1.getY().multiply(u2.getZ()).subtract(u1.getZ().multiply(u2.getY())), + FieldVector3D cNaive = new FieldVector3D(u1.getY().multiply(u2.getZ()).subtract(u1.getZ().multiply(u2.getY())), u1.getZ().multiply(u2.getX()).subtract(u1.getX().multiply(u2.getZ())), u1.getX().multiply(u2.getY()).subtract(u1.getY().multiply(u2.getX()))); FieldVector3D cAccurate = FieldVector3D.crossProduct(u1, u2); @@ -679,7 +679,7 @@ public class FieldVector3DTest { } private FieldVector3D createVector(double x, double y, double z, int params) { - return new FieldVector3D<>(new DerivativeStructure(params, 1, 0, x), + return new FieldVector3D(new DerivativeStructure(params, 1, 0, x), new DerivativeStructure(params, 1, 1, y), new DerivativeStructure(params, 1, 2, z)); } diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PLYParser.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PLYParser.java index 7670e69ad..f65663cc2 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PLYParser.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PLYParser.java @@ -214,7 +214,7 @@ public class PLYParser { */ private List parseNextLine() throws IOException, ParseException { - final List fields = new ArrayList<>(); + final List fields = new ArrayList(); line = br.readLine(); if (line == null) { throw new EOFException(); diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java index d8b1d7dbb..b1b902ad5 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java @@ -243,7 +243,7 @@ public class PolyhedronsSetTest { new PolyhedronsSet(x - w, x + w, y - l, y + l, z - w, z + w, 1.0e-10); PolyhedronsSet zBeam = new PolyhedronsSet(x - w, x + w, y - w, y + w, z - l, z + l, 1.0e-10); - RegionFactory factory = new RegionFactory<>(); + RegionFactory factory = new RegionFactory(); PolyhedronsSet tree = (PolyhedronsSet) factory.union(xBeam, factory.union(yBeam, zBeam)); Vector3D barycenter = (Vector3D) tree.getBarycenter(); @@ -273,7 +273,7 @@ public class PolyhedronsSetTest { 1, 5, 6, 1, 6, 2, 2, 6, 7, 2, 7, 3, 4, 0, 3, 4, 3, 7}; - ArrayList> subHyperplaneList = new ArrayList<>(); + ArrayList> subHyperplaneList = new ArrayList>(); for (int idx = 0; idx < indices.length; idx += 3) { int idxA = indices[idx] * 3; int idxB = indices[idx + 1] * 3; @@ -283,7 +283,7 @@ public class PolyhedronsSetTest { Vector3D v_3 = new Vector3D(coords[idxC], coords[idxC + 1], coords[idxC + 2]); Vector3D[] vertices = {v_1, v_2, v_3}; Plane polyPlane = new Plane(v_1, v_2, v_3, 1.0e-10); - ArrayList> lines = new ArrayList<>(); + ArrayList> lines = new ArrayList>(); Vector2D[] projPts = new Vector2D[vertices.length]; for (int ptIdx = 0; ptIdx < projPts.length; ptIdx++) { diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGeneratorTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGeneratorTest.java index 81b9b2382..5fdc4f6fe 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGeneratorTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGeneratorTest.java @@ -143,7 +143,7 @@ public class SphereGeneratorTest { double d = 25 * random.nextDouble(); double refRadius = 10 * random.nextDouble(); Vector3D refCenter = new Vector3D(d, new Vector3D(sr.nextVector())); - List support = new ArrayList<>(); + List support = new ArrayList(); for (int j = 0; j < 5; ++j) { support.add(new Vector3D(1.0, refCenter, refRadius, new Vector3D(sr.nextVector()))); } diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java index 8c5268245..5ca929589 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java @@ -108,7 +108,7 @@ public class DiskGeneratorTest { double d = 25 * random.nextDouble(); double refRadius = 10 * random.nextDouble(); Vector2D refCenter = new Vector2D(d, new Vector2D(sr.nextVector())); - List support = new ArrayList<>(); + List support = new ArrayList(); for (int j = 0; j < 3; ++j) { support.add(new Vector2D(1.0, refCenter, refRadius, new Vector2D(sr.nextVector()))); } diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSetTest.java index bb4e51bb2..28b5eda93 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSetTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSetTest.java @@ -675,15 +675,15 @@ public class PolygonsSetTest { hyp[4] = (SubLine) hyp[4].split(hyp[3].getHyperplane()).getMinus().split(hyp[0].getHyperplane()).getMinus(); hyp[5] = (SubLine) hyp[5].split(hyp[4].getHyperplane()).getMinus().split(hyp[0].getHyperplane()).getMinus(); hyp[6] = (SubLine) hyp[6].split(hyp[3].getHyperplane()).getMinus().split(hyp[1].getHyperplane()).getMinus(); - BSPTree tree = new BSPTree<>(Boolean.TRUE); + BSPTree tree = new BSPTree(Boolean.TRUE); for (int i = hyp.length - 1; i >= 0; --i) { - tree = new BSPTree<>(hyp[i], new BSPTree(Boolean.FALSE), tree, null); + tree = new BSPTree(hyp[i], new BSPTree(Boolean.FALSE), tree, null); } PolygonsSet set = new PolygonsSet(tree, 1.0e-10); SubLine splitter = new Line(new Vector2D(-2.0 * sqrt3 / 3.0, 0.0), 9 * pi6, 1.0e-10).wholeHyperplane(); PolygonsSet slice = - new PolygonsSet(new BSPTree<>(splitter, + new PolygonsSet(new BSPTree(splitter, set.getTree(false).split(splitter).getPlus(), new BSPTree(Boolean.FALSE), null), 1.0e-10); @@ -726,85 +726,85 @@ public class PolygonsSetTest { @Test public void testBug20040520() { BSPTree a0 = - new BSPTree<>(buildSegment(new Vector2D(0.85, -0.05), + new BSPTree(buildSegment(new Vector2D(0.85, -0.05), new Vector2D(0.90, -0.10)), new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null); BSPTree a1 = - new BSPTree<>(buildSegment(new Vector2D(0.85, -0.10), + new BSPTree(buildSegment(new Vector2D(0.85, -0.10), new Vector2D(0.90, -0.10)), new BSPTree(Boolean.FALSE), a0, null); BSPTree a2 = - new BSPTree<>(buildSegment(new Vector2D(0.90, -0.05), + new BSPTree(buildSegment(new Vector2D(0.90, -0.05), new Vector2D(0.85, -0.05)), new BSPTree(Boolean.FALSE), a1, null); BSPTree a3 = - new BSPTree<>(buildSegment(new Vector2D(0.82, -0.05), + new BSPTree(buildSegment(new Vector2D(0.82, -0.05), new Vector2D(0.82, -0.08)), new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null); BSPTree a4 = - new BSPTree<>(buildHalfLine(new Vector2D(0.85, -0.05), + new BSPTree(buildHalfLine(new Vector2D(0.85, -0.05), new Vector2D(0.80, -0.05), false), new BSPTree(Boolean.FALSE), a3, null); BSPTree a5 = - new BSPTree<>(buildSegment(new Vector2D(0.82, -0.08), + new BSPTree(buildSegment(new Vector2D(0.82, -0.08), new Vector2D(0.82, -0.18)), new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null); BSPTree a6 = - new BSPTree<>(buildHalfLine(new Vector2D(0.82, -0.18), + new BSPTree(buildHalfLine(new Vector2D(0.82, -0.18), new Vector2D(0.85, -0.15), true), new BSPTree(Boolean.FALSE), a5, null); BSPTree a7 = - new BSPTree<>(buildHalfLine(new Vector2D(0.85, -0.05), + new BSPTree(buildHalfLine(new Vector2D(0.85, -0.05), new Vector2D(0.82, -0.08), false), a4, a6, null); BSPTree a8 = - new BSPTree<>(buildLine(new Vector2D(0.85, -0.25), + new BSPTree(buildLine(new Vector2D(0.85, -0.25), new Vector2D(0.85, 0.05)), a2, a7, null); BSPTree a9 = - new BSPTree<>(buildLine(new Vector2D(0.90, 0.05), + new BSPTree(buildLine(new Vector2D(0.90, 0.05), new Vector2D(0.90, -0.50)), a8, new BSPTree(Boolean.FALSE), null); BSPTree b0 = - new BSPTree<>(buildSegment(new Vector2D(0.92, -0.12), + new BSPTree(buildSegment(new Vector2D(0.92, -0.12), new Vector2D(0.92, -0.08)), new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null); BSPTree b1 = - new BSPTree<>(buildHalfLine(new Vector2D(0.92, -0.08), + new BSPTree(buildHalfLine(new Vector2D(0.92, -0.08), new Vector2D(0.90, -0.10), true), new BSPTree(Boolean.FALSE), b0, null); BSPTree b2 = - new BSPTree<>(buildSegment(new Vector2D(0.92, -0.18), + new BSPTree(buildSegment(new Vector2D(0.92, -0.18), new Vector2D(0.92, -0.12)), new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null); BSPTree b3 = - new BSPTree<>(buildSegment(new Vector2D(0.85, -0.15), + new BSPTree(buildSegment(new Vector2D(0.85, -0.15), new Vector2D(0.90, -0.20)), new BSPTree(Boolean.FALSE), b2, null); BSPTree b4 = - new BSPTree<>(buildSegment(new Vector2D(0.95, -0.15), + new BSPTree(buildSegment(new Vector2D(0.95, -0.15), new Vector2D(0.85, -0.05)), b1, b3, null); BSPTree b5 = - new BSPTree<>(buildHalfLine(new Vector2D(0.85, -0.05), + new BSPTree(buildHalfLine(new Vector2D(0.85, -0.05), new Vector2D(0.85, -0.25), true), new BSPTree(Boolean.FALSE), b4, null); BSPTree b6 = - new BSPTree<>(buildLine(new Vector2D(0.0, -1.10), + new BSPTree(buildLine(new Vector2D(0.0, -1.10), new Vector2D(1.0, -0.10)), new BSPTree(Boolean.FALSE), b5, null); @@ -866,7 +866,7 @@ public class PolygonsSetTest { }; BSPTree node1 = - new BSPTree<>(new SubLine(l[0], + new BSPTree(new SubLine(l[0], new IntervalsSet(intersectionAbscissa(l[0], l[1]), intersectionAbscissa(l[0], l[2]), 1.0e-10)), @@ -874,7 +874,7 @@ public class PolygonsSetTest { new BSPTree(Boolean.FALSE), null); BSPTree node2 = - new BSPTree<>(new SubLine(l[1], + new BSPTree(new SubLine(l[1], new IntervalsSet(intersectionAbscissa(l[1], l[2]), intersectionAbscissa(l[1], l[3]), 1.0e-10)), @@ -882,14 +882,14 @@ public class PolygonsSetTest { new BSPTree(Boolean.FALSE), null); BSPTree node3 = - new BSPTree<>(new SubLine(l[2], + new BSPTree(new SubLine(l[2], new IntervalsSet(intersectionAbscissa(l[2], l[3]), Double.POSITIVE_INFINITY, 1.0e-10)), node2, new BSPTree(Boolean.FALSE), null); BSPTree node4 = - new BSPTree<>(l[3].wholeHyperplane(), + new BSPTree(l[3].wholeHyperplane(), node3, new BSPTree(Boolean.FALSE), null); @@ -1126,7 +1126,7 @@ public class PolygonsSetTest { @Test public void testThinRectangle() { - RegionFactory factory = new RegionFactory<>(); + RegionFactory factory = new RegionFactory(); Vector2D pA = new Vector2D(0.0, 1.0); Vector2D pB = new Vector2D(0.0, 0.0); Vector2D pC = new Vector2D(1.0 / 64.0, 0.0); @@ -1236,7 +1236,7 @@ public class PolygonsSetTest { } private PolygonsSet buildSet(Vector2D[][] vertices) { - ArrayList> edges = new ArrayList<>(); + ArrayList> edges = new ArrayList>(); for (int i = 0; i < vertices.length; ++i) { int l = vertices[i].length; for (int j = 0; j < l; ++j) { diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java index d1af7a528..717b2644c 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java @@ -93,7 +93,7 @@ public abstract class ConvexHullGenerator2DAbstractTest { @Test public void testAllIdentical() { - final Collection points = new ArrayList<>(); + final Collection points = new ArrayList(); points.add(new Vector2D(1, 1)); points.add(new Vector2D(1, 1)); points.add(new Vector2D(1, 1)); @@ -118,7 +118,7 @@ public abstract class ConvexHullGenerator2DAbstractTest { @Test public void testCollinearPoints() { - final Collection points = new ArrayList<>(); + final Collection points = new ArrayList(); points.add(new Vector2D(1, 1)); points.add(new Vector2D(2, 2)); points.add(new Vector2D(2, 4)); @@ -131,7 +131,7 @@ public abstract class ConvexHullGenerator2DAbstractTest { @Test public void testCollinearPointsReverse() { - final Collection points = new ArrayList<>(); + final Collection points = new ArrayList(); points.add(new Vector2D(1, 1)); points.add(new Vector2D(2, 2)); points.add(new Vector2D(2, 4)); @@ -144,7 +144,7 @@ public abstract class ConvexHullGenerator2DAbstractTest { @Test public void testCollinearPointsIncluded() { - final Collection points = new ArrayList<>(); + final Collection points = new ArrayList(); points.add(new Vector2D(1, 1)); points.add(new Vector2D(2, 2)); points.add(new Vector2D(2, 4)); @@ -157,7 +157,7 @@ public abstract class ConvexHullGenerator2DAbstractTest { @Test public void testCollinearPointsIncludedReverse() { - final Collection points = new ArrayList<>(); + final Collection points = new ArrayList(); points.add(new Vector2D(1, 1)); points.add(new Vector2D(2, 2)); points.add(new Vector2D(2, 4)); @@ -170,7 +170,7 @@ public abstract class ConvexHullGenerator2DAbstractTest { @Test public void testIdenticalPoints() { - final Collection points = new ArrayList<>(); + final Collection points = new ArrayList(); points.add(new Vector2D(1, 1)); points.add(new Vector2D(2, 2)); points.add(new Vector2D(2, 4)); @@ -183,7 +183,7 @@ public abstract class ConvexHullGenerator2DAbstractTest { @Test public void testIdenticalPoints2() { - final Collection points = new ArrayList<>(); + final Collection points = new ArrayList(); points.add(new Vector2D(1, 1)); points.add(new Vector2D(2, 2)); points.add(new Vector2D(2, 4)); @@ -196,7 +196,7 @@ public abstract class ConvexHullGenerator2DAbstractTest { @Test public void testClosePoints() { - final Collection points = new ArrayList<>(); + final Collection points = new ArrayList(); points.add(new Vector2D(1, 1)); points.add(new Vector2D(2, 2)); points.add(new Vector2D(2, 4)); @@ -211,7 +211,7 @@ public abstract class ConvexHullGenerator2DAbstractTest { public void testCollinearPointOnExistingBoundary() { // MATH-1135: check that collinear points on the hull are handled correctly // when only a minimal hull shall be constructed - final Collection points = new ArrayList<>(); + final Collection points = new ArrayList(); points.add(new Vector2D(7.3152, 34.7472)); points.add(new Vector2D(6.400799999999997, 34.747199999999985)); points.add(new Vector2D(5.486399999999997, 34.7472)); @@ -233,7 +233,7 @@ public abstract class ConvexHullGenerator2DAbstractTest { // make sure that they are processed in the proper order // for each algorithm. - List points = new ArrayList<>(); + List points = new ArrayList(); // first case: 3 points are collinear points.add(new Vector2D(16.078200000000184, -36.52519999989808)); @@ -270,7 +270,7 @@ public abstract class ConvexHullGenerator2DAbstractTest { @Test public void testIssue1123() { - List points = new ArrayList<>(); + List points = new ArrayList(); int[][] data = new int[][] { { -11, -1 }, { -11, 0 }, { -11, 1 }, { -10, -3 }, { -10, -2 }, { -10, -1 }, { -10, 0 }, { -10, 1 }, @@ -367,7 +367,7 @@ public abstract class ConvexHullGenerator2DAbstractTest { protected final List createRandomPoints(int size) { // create the cloud container - List points = new ArrayList<>(size); + List points = new ArrayList(size); // fill the cloud with a random distribution of points for (int i = 0; i < size; i++) { points.add(new Vector2D(random.nextDouble() * 2.0 - 1.0, random.nextDouble() * 2.0 - 1.0)); diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChainTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChainTest.java index 7860b9db5..ebc2f6ceb 100644 --- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChainTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChainTest.java @@ -40,7 +40,7 @@ public class MonotoneChainTest extends ConvexHullGenerator2DAbstractTest { @Test(expected=ConvergenceException.class) public void testConvergenceException() { - final Collection points = new ArrayList<>(); + final Collection points = new ArrayList(); points.add(new Vector2D(1, 1)); points.add(new Vector2D(1, 5)); diff --git a/src/test/java/org/apache/commons/math4/geometry/partitioning/RegionParser.java b/src/test/java/org/apache/commons/math4/geometry/partitioning/RegionParser.java index ced198978..29e48f33e 100644 --- a/src/test/java/org/apache/commons/math4/geometry/partitioning/RegionParser.java +++ b/src/test/java/org/apache/commons/math4/geometry/partitioning/RegionParser.java @@ -211,7 +211,7 @@ public class RegionParser { getWord(TOLERANCE); tolerance = getNumber(); getWord(PLUS); - root = new BSPTree<>(); + root = new BSPTree(); parseTree(root); if (tokenizer.hasMoreTokens()) { throw new ParseException("unexpected " + tokenizer.nextToken(), 0); diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java index 6f868579a..e57286b0d 100644 --- a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java @@ -170,7 +170,7 @@ public class ArcsSetTest { @Test public void testSpecialConstruction() { - List> boundary = new ArrayList<>(); + List> boundary = new ArrayList>(); boundary.add(new LimitAngle(new S1Point(0.0), false, 1.0e-10).wholeHyperplane()); boundary.add(new LimitAngle(new S1Point(MathUtils.TWO_PI - 1.0e-11), true, 1.0e-10).wholeHyperplane()); ArcsSet set = new ArcsSet(boundary, 1.0e-10); @@ -271,7 +271,7 @@ public class ArcsSetTest { @Test public void testMultiple() { - RegionFactory factory = new RegionFactory<>(); + RegionFactory factory = new RegionFactory(); ArcsSet set = (ArcsSet) factory.intersection(factory.union(factory.difference(new ArcsSet(1.0, 6.0, 1.0e-10), new ArcsSet(3.0, 5.0, 1.0e-10)), @@ -347,9 +347,9 @@ public class ArcsSetTest { for (int k = -2; k < 3; ++k) { SubLimitAngle l1 = new LimitAngle(new S1Point(1.0 + k * MathUtils.TWO_PI), false, 1.0e-10).wholeHyperplane(); SubLimitAngle l2 = new LimitAngle(new S1Point(1.5 + k * MathUtils.TWO_PI), true, 1.0e-10).wholeHyperplane(); - ArcsSet set = new ArcsSet(new BSPTree<>(l1, + ArcsSet set = new ArcsSet(new BSPTree(l1, new BSPTree(Boolean.FALSE), - new BSPTree<>(l2, + new BSPTree(l2, new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null), @@ -371,10 +371,10 @@ public class ArcsSetTest { SubLimitAngle l1 = new LimitAngle(new S1Point(1.0), false, 1.0e-10).wholeHyperplane(); SubLimitAngle l2 = new LimitAngle(new S1Point(2.0), true, 1.0e-10).wholeHyperplane(); SubLimitAngle l3 = new LimitAngle(new S1Point(3.0), false, 1.0e-10).wholeHyperplane(); - new ArcsSet(new BSPTree<>(l1, + new ArcsSet(new BSPTree(l1, new BSPTree(Boolean.FALSE), - new BSPTree<>(l2, - new BSPTree<>(l3, + new BSPTree(l2, + new BSPTree(l3, new BSPTree(Boolean.FALSE), new BSPTree(Boolean.TRUE), null), diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSetTest.java index 4b0368e17..e9fbe475a 100644 --- a/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSetTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSetTest.java @@ -110,7 +110,7 @@ public class SphericalPolygonsSetTest { public void testPositiveOctantByIntersection() { double tol = 0.01; double sinTol = FastMath.sin(tol); - RegionFactory factory = new RegionFactory<>(); + RegionFactory factory = new RegionFactory(); SphericalPolygonsSet plusX = new SphericalPolygonsSet(Vector3D.PLUS_I, tol); SphericalPolygonsSet plusY = new SphericalPolygonsSet(Vector3D.PLUS_J, tol); SphericalPolygonsSet plusZ = new SphericalPolygonsSet(Vector3D.PLUS_K, tol); @@ -198,7 +198,7 @@ public class SphericalPolygonsSetTest { public void testNonConvex() { double tol = 0.01; double sinTol = FastMath.sin(tol); - RegionFactory factory = new RegionFactory<>(); + RegionFactory factory = new RegionFactory(); SphericalPolygonsSet plusX = new SphericalPolygonsSet(Vector3D.PLUS_I, tol); SphericalPolygonsSet plusY = new SphericalPolygonsSet(Vector3D.PLUS_J, tol); SphericalPolygonsSet plusZ = new SphericalPolygonsSet(Vector3D.PLUS_K, tol); @@ -267,7 +267,7 @@ public class SphericalPolygonsSetTest { @Test public void testModeratlyComplexShape() { double tol = 0.01; - List> boundary = new ArrayList<>(); + List> boundary = new ArrayList>(); boundary.add(create(Vector3D.MINUS_J, Vector3D.PLUS_I, Vector3D.PLUS_K, tol, 0.0, 0.5 * FastMath.PI)); boundary.add(create(Vector3D.MINUS_I, Vector3D.PLUS_K, Vector3D.PLUS_J, tol, 0.0, 0.5 * FastMath.PI)); boundary.add(create(Vector3D.PLUS_K, Vector3D.PLUS_J, Vector3D.MINUS_I, tol, 0.0, 0.5 * FastMath.PI)); @@ -324,7 +324,7 @@ public class SphericalPolygonsSetTest { public void testSeveralParts() { double tol = 0.01; double sinTol = FastMath.sin(tol); - List> boundary = new ArrayList<>(); + List> boundary = new ArrayList>(); // first part: +X, +Y, +Z octant boundary.add(create(Vector3D.PLUS_J, Vector3D.PLUS_K, Vector3D.PLUS_I, tol, 0.0, 0.5 * FastMath.PI)); @@ -406,7 +406,7 @@ public class SphericalPolygonsSetTest { SphericalPolygonsSet triOut = new SphericalPolygonsSet(center, Vector3D.PLUS_K, 0.25, 3, tol); SphericalPolygonsSet triIn = new SphericalPolygonsSet(center, Vector3D.PLUS_K, 0.15, 3, tol); - RegionFactory factory = new RegionFactory<>(); + RegionFactory factory = new RegionFactory(); SphericalPolygonsSet hexa = (SphericalPolygonsSet) factory.difference(hexaOut, hexaIn); SphericalPolygonsSet penta = (SphericalPolygonsSet) factory.difference(pentaOut, pentaIn); SphericalPolygonsSet quadri = (SphericalPolygonsSet) factory.difference(quadriOut, quadriIn); @@ -467,7 +467,7 @@ public class SphericalPolygonsSetTest { { 42.15249, 9.56001 }, { 43.00998, 9.39000 }, { 42.62812, 8.74600 }, { 42.25651, 8.54421 }, { 41.58361, 8.77572 }, { 41.38000, 9.22975 } }); - RegionFactory factory = new RegionFactory<>(); + RegionFactory factory = new RegionFactory(); SphericalPolygonsSet zone = (SphericalPolygonsSet) factory.union(continental, corsica); EnclosingBall enclosing = zone.getEnclosingCap(); Vector3D enclosingCenter = ((S2Point) enclosing.getCenter()).getVector(); @@ -525,7 +525,7 @@ public class SphericalPolygonsSetTest { private SubCircle create(Vector3D pole, Vector3D x, Vector3D y, double tolerance, double ... limits) { - RegionFactory factory = new RegionFactory<>(); + RegionFactory factory = new RegionFactory(); Circle circle = new Circle(pole, tolerance); Circle phased = (Circle) Circle.getTransform(new Rotation(circle.getXAxis(), circle.getYAxis(), x, y)).apply(circle); diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SubCircleTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SubCircleTest.java index 34b6278f7..891f6207f 100644 --- a/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SubCircleTest.java +++ b/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SubCircleTest.java @@ -127,7 +127,7 @@ public class SubCircleTest { private SubCircle create(Vector3D pole, Vector3D x, Vector3D y, double tolerance, double ... limits) { - RegionFactory factory = new RegionFactory<>(); + RegionFactory factory = new RegionFactory(); Circle circle = new Circle(pole, tolerance); Circle phased = (Circle) Circle.getTransform(new Rotation(circle.getXAxis(), circle.getYAxis(), x, y)).apply(circle); diff --git a/src/test/java/org/apache/commons/math4/linear/ArrayFieldVectorTest.java b/src/test/java/org/apache/commons/math4/linear/ArrayFieldVectorTest.java index 1268b262c..a9f7ac791 100644 --- a/src/test/java/org/apache/commons/math4/linear/ArrayFieldVectorTest.java +++ b/src/test/java/org/apache/commons/math4/linear/ArrayFieldVectorTest.java @@ -139,7 +139,7 @@ public class ArrayFieldVectorTest { for (int i = 0; i < data.length; i++) { out[i] = data[i].multiply(d); } - return new FieldVectorTestImpl<>(out); + return new FieldVectorTestImpl(out); } public FieldVector mapMultiplyToSelf(T d) { @@ -263,70 +263,70 @@ public class ArrayFieldVectorTest { @Test public void testConstructors() { - ArrayFieldVector v0 = new ArrayFieldVector<>(FractionField.getInstance()); + ArrayFieldVector v0 = new ArrayFieldVector(FractionField.getInstance()); Assert.assertEquals(0, v0.getDimension()); - ArrayFieldVector v1 = new ArrayFieldVector<>(FractionField.getInstance(), 7); + ArrayFieldVector v1 = new ArrayFieldVector(FractionField.getInstance(), 7); Assert.assertEquals(7, v1.getDimension()); Assert.assertEquals(Fraction.ZERO, v1.getEntry(6)); - ArrayFieldVector v2 = new ArrayFieldVector<>(5, new Fraction(123, 100)); + ArrayFieldVector v2 = new ArrayFieldVector(5, new Fraction(123, 100)); Assert.assertEquals(5, v2.getDimension()); Assert.assertEquals(new Fraction(123, 100), v2.getEntry(4)); - ArrayFieldVector v3 = new ArrayFieldVector<>(FractionField.getInstance(), vec1); + ArrayFieldVector v3 = new ArrayFieldVector(FractionField.getInstance(), vec1); Assert.assertEquals(3, v3.getDimension()); Assert.assertEquals(new Fraction(2), v3.getEntry(1)); - ArrayFieldVector v4 = new ArrayFieldVector<>(FractionField.getInstance(), vec4, 3, 2); + ArrayFieldVector v4 = new ArrayFieldVector(FractionField.getInstance(), vec4, 3, 2); Assert.assertEquals(2, v4.getDimension()); Assert.assertEquals(new Fraction(4), v4.getEntry(0)); try { - new ArrayFieldVector<>(vec4, 8, 3); + new ArrayFieldVector(vec4, 8, 3); Assert.fail("MathIllegalArgumentException expected"); } catch (MathIllegalArgumentException ex) { // expected behavior } - FieldVector v5_i = new ArrayFieldVector<>(dvec1); + FieldVector v5_i = new ArrayFieldVector(dvec1); Assert.assertEquals(9, v5_i.getDimension()); Assert.assertEquals(new Fraction(9), v5_i.getEntry(8)); - ArrayFieldVector v5 = new ArrayFieldVector<>(dvec1); + ArrayFieldVector v5 = new ArrayFieldVector(dvec1); Assert.assertEquals(9, v5.getDimension()); Assert.assertEquals(new Fraction(9), v5.getEntry(8)); - ArrayFieldVector v6 = new ArrayFieldVector<>(dvec1, 3, 2); + ArrayFieldVector v6 = new ArrayFieldVector(dvec1, 3, 2); Assert.assertEquals(2, v6.getDimension()); Assert.assertEquals(new Fraction(4), v6.getEntry(0)); try { - new ArrayFieldVector<>(dvec1, 8, 3); + new ArrayFieldVector(dvec1, 8, 3); Assert.fail("MathIllegalArgumentException expected"); } catch (MathIllegalArgumentException ex) { // expected behavior } - ArrayFieldVector v7 = new ArrayFieldVector<>(v1); + ArrayFieldVector v7 = new ArrayFieldVector(v1); Assert.assertEquals(7, v7.getDimension()); Assert.assertEquals(Fraction.ZERO, v7.getEntry(6)); - FieldVectorTestImpl v7_i = new FieldVectorTestImpl<>(vec1); + FieldVectorTestImpl v7_i = new FieldVectorTestImpl(vec1); - ArrayFieldVector v7_2 = new ArrayFieldVector<>(v7_i); + ArrayFieldVector v7_2 = new ArrayFieldVector(v7_i); Assert.assertEquals(3, v7_2.getDimension()); Assert.assertEquals(new Fraction(2), v7_2.getEntry(1)); - ArrayFieldVector v8 = new ArrayFieldVector<>(v1, true); + ArrayFieldVector v8 = new ArrayFieldVector(v1, true); Assert.assertEquals(7, v8.getDimension()); Assert.assertEquals(Fraction.ZERO, v8.getEntry(6)); Assert.assertNotSame("testData not same object ", v1.getDataRef(), v8.getDataRef()); - ArrayFieldVector v8_2 = new ArrayFieldVector<>(v1, false); + ArrayFieldVector v8_2 = new ArrayFieldVector(v1, false); Assert.assertEquals(7, v8_2.getDimension()); Assert.assertEquals(Fraction.ZERO, v8_2.getEntry(6)); Assert.assertArrayEquals(v1.getDataRef(), v8_2.getDataRef()); - ArrayFieldVector v9 = new ArrayFieldVector<>((FieldVector) v1, (FieldVector) v3); + ArrayFieldVector v9 = new ArrayFieldVector((FieldVector) v1, (FieldVector) v3); Assert.assertEquals(10, v9.getDimension()); Assert.assertEquals(new Fraction(1), v9.getEntry(7)); @@ -335,10 +335,10 @@ public class ArrayFieldVectorTest { @Test public void testDataInOut() { - ArrayFieldVector v1 = new ArrayFieldVector<>(vec1); - ArrayFieldVector v2 = new ArrayFieldVector<>(vec2); - ArrayFieldVector v4 = new ArrayFieldVector<>(vec4); - FieldVectorTestImpl v2_t = new FieldVectorTestImpl<>(vec2); + ArrayFieldVector v1 = new ArrayFieldVector(vec1); + ArrayFieldVector v2 = new ArrayFieldVector(vec2); + ArrayFieldVector v4 = new ArrayFieldVector(vec4); + FieldVectorTestImpl v2_t = new FieldVectorTestImpl(vec2); FieldVector v_append_1 = v1.append(v2); Assert.assertEquals(6, v_append_1.getDimension()); @@ -430,7 +430,7 @@ public class ArrayFieldVectorTest { @Test public void testMapFunctions() { - ArrayFieldVector v1 = new ArrayFieldVector<>(vec1); + ArrayFieldVector v1 = new ArrayFieldVector(vec1); //octave = v1 .+ 2.0 FieldVector v_mapAdd = v1.mapAdd(new Fraction(2)); @@ -491,18 +491,18 @@ public class ArrayFieldVectorTest { @Test public void testBasicFunctions() { - ArrayFieldVector v1 = new ArrayFieldVector<>(vec1); - ArrayFieldVector v2 = new ArrayFieldVector<>(vec2); - new ArrayFieldVector<>(vec_null); + ArrayFieldVector v1 = new ArrayFieldVector(vec1); + ArrayFieldVector v2 = new ArrayFieldVector(vec2); + new ArrayFieldVector(vec_null); - FieldVectorTestImpl v2_t = new FieldVectorTestImpl<>(vec2); + FieldVectorTestImpl v2_t = new FieldVectorTestImpl(vec2); //octave = v1 + v2 ArrayFieldVector v_add = v1.add(v2); Fraction[] result_add = {new Fraction(5), new Fraction(7), new Fraction(9)}; checkArray("compare vect" ,v_add.toArray(),result_add); - FieldVectorTestImpl vt2 = new FieldVectorTestImpl<>(vec2); + FieldVectorTestImpl vt2 = new FieldVectorTestImpl(vec2); FieldVector v_add_i = v1.add(vt2); Fraction[] result_add_i = {new Fraction(5), new Fraction(7), new Fraction(9)}; checkArray("compare vect" ,v_add_i.toArray(),result_add_i); @@ -560,9 +560,9 @@ public class ArrayFieldVectorTest { @Test public void testMisc() { - ArrayFieldVector v1 = new ArrayFieldVector<>(vec1); - ArrayFieldVector v4 = new ArrayFieldVector<>(vec4); - FieldVector v4_2 = new ArrayFieldVector<>(vec4); + ArrayFieldVector v1 = new ArrayFieldVector(vec1); + ArrayFieldVector v4 = new ArrayFieldVector(vec4); + FieldVector v4_2 = new ArrayFieldVector(vec4); String out1 = v1.toString(); Assert.assertTrue("some output ", out1.length()!=0); @@ -596,7 +596,7 @@ public class ArrayFieldVectorTest { @Test public void testSerial() { - ArrayFieldVector v = new ArrayFieldVector<>(vec1); + ArrayFieldVector v = new ArrayFieldVector(vec1); Assert.assertEquals(v,TestUtils.serializeAndRecover(v)); } @@ -605,40 +605,40 @@ public class ArrayFieldVectorTest { // when the field is not specified, array cannot be empty try { - new ArrayFieldVector<>(new Fraction[0]); + new ArrayFieldVector(new Fraction[0]); Assert.fail("MathIllegalArgumentException expected"); } catch (MathIllegalArgumentException ex) { // expected behavior } try { - new ArrayFieldVector<>(new Fraction[0], true); + new ArrayFieldVector(new Fraction[0], true); Assert.fail("MathIllegalArgumentException expected"); } catch (MathIllegalArgumentException ex) { // expected behavior } try { - new ArrayFieldVector<>(new Fraction[0], false); + new ArrayFieldVector(new Fraction[0], false); Assert.fail("MathIllegalArgumentException expected"); } catch (MathIllegalArgumentException ex) { // expected behavior } // when the field is specified, array can be empty - Assert.assertEquals(0, new ArrayFieldVector<>(FractionField.getInstance(), new Fraction[0]).getDimension()); - Assert.assertEquals(0, new ArrayFieldVector<>(FractionField.getInstance(), new Fraction[0], true).getDimension()); - Assert.assertEquals(0, new ArrayFieldVector<>(FractionField.getInstance(), new Fraction[0], false).getDimension()); + Assert.assertEquals(0, new ArrayFieldVector(FractionField.getInstance(), new Fraction[0]).getDimension()); + Assert.assertEquals(0, new ArrayFieldVector(FractionField.getInstance(), new Fraction[0], true).getDimension()); + Assert.assertEquals(0, new ArrayFieldVector(FractionField.getInstance(), new Fraction[0], false).getDimension()); } @Test public void testOuterProduct() { final ArrayFieldVector u - = new ArrayFieldVector<>(FractionField.getInstance(), + = new ArrayFieldVector(FractionField.getInstance(), new Fraction[] {new Fraction(1), new Fraction(2), new Fraction(-3)}); final ArrayFieldVector v - = new ArrayFieldVector<>(FractionField.getInstance(), + = new ArrayFieldVector(FractionField.getInstance(), new Fraction[] {new Fraction(4), new Fraction(-2)}); @@ -675,7 +675,7 @@ public class ArrayFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final ArrayFieldVector v = new ArrayFieldVector<>(data); + final ArrayFieldVector v = new ArrayFieldVector(data); final FieldVectorPreservingVisitor visitor; visitor = new FieldVectorPreservingVisitor() { @@ -762,7 +762,7 @@ public class ArrayFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final ArrayFieldVector v = new ArrayFieldVector<>(data); + final ArrayFieldVector v = new ArrayFieldVector(data); final int expectedStart = 2; final int expectedEnd = 7; final FieldVectorPreservingVisitor visitor; @@ -800,7 +800,7 @@ public class ArrayFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final ArrayFieldVector v = new ArrayFieldVector<>(data); + final ArrayFieldVector v = new ArrayFieldVector(data); final FieldVectorPreservingVisitor visitor; visitor = new FieldVectorPreservingVisitor() { private final boolean[] visited = new boolean[data.length]; @@ -889,7 +889,7 @@ public class ArrayFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final ArrayFieldVector v = new ArrayFieldVector<>(data); + final ArrayFieldVector v = new ArrayFieldVector(data); final int expectedStart = 2; final int expectedEnd = 7; final FieldVectorPreservingVisitor visitor; @@ -929,7 +929,7 @@ public class ArrayFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final ArrayFieldVector v = new ArrayFieldVector<>(data); + final ArrayFieldVector v = new ArrayFieldVector(data); final FieldVectorChangingVisitor visitor; visitor = new FieldVectorChangingVisitor() { @@ -1020,7 +1020,7 @@ public class ArrayFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final ArrayFieldVector v = new ArrayFieldVector<>(data); + final ArrayFieldVector v = new ArrayFieldVector(data); final int expectedStart = 2; final int expectedEnd = 7; final FieldVectorChangingVisitor visitor; @@ -1062,7 +1062,7 @@ public class ArrayFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final ArrayFieldVector v = new ArrayFieldVector<>(data); + final ArrayFieldVector v = new ArrayFieldVector(data); final FieldVectorChangingVisitor visitor; visitor = new FieldVectorChangingVisitor() { private final boolean[] visited = new boolean[data.length]; @@ -1155,7 +1155,7 @@ public class ArrayFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final ArrayFieldVector v = new ArrayFieldVector<>(data); + final ArrayFieldVector v = new ArrayFieldVector(data); final int expectedStart = 2; final int expectedEnd = 7; final FieldVectorChangingVisitor visitor; @@ -1196,6 +1196,6 @@ public class ArrayFieldVectorTest { for (int i = 0; i < n; ++i) { t[i] = Fraction.ZERO; } - return new ArrayFieldVector<>(t); + return new ArrayFieldVector(t); } } diff --git a/src/test/java/org/apache/commons/math4/linear/BlockFieldMatrixTest.java b/src/test/java/org/apache/commons/math4/linear/BlockFieldMatrixTest.java index 57c9cb7de..00dde9df6 100644 --- a/src/test/java/org/apache/commons/math4/linear/BlockFieldMatrixTest.java +++ b/src/test/java/org/apache/commons/math4/linear/BlockFieldMatrixTest.java @@ -167,8 +167,8 @@ public final class BlockFieldMatrixTest { /** test dimensions */ @Test public void testDimensions() { - BlockFieldMatrix m = new BlockFieldMatrix<>(testData); - BlockFieldMatrix m2 = new BlockFieldMatrix<>(testData2); + BlockFieldMatrix m = new BlockFieldMatrix(testData); + BlockFieldMatrix m2 = new BlockFieldMatrix(testData2); Assert.assertEquals("testData row dimension",3,m.getRowDimension()); Assert.assertEquals("testData column dimension",3,m.getColumnDimension()); Assert.assertTrue("testData is square",m.isSquare()); @@ -182,18 +182,18 @@ public final class BlockFieldMatrixTest { public void testCopyFunctions() { Random r = new Random(66636328996002l); BlockFieldMatrix m1 = createRandomMatrix(r, 47, 83); - BlockFieldMatrix m2 = new BlockFieldMatrix<>(m1.getData()); + BlockFieldMatrix m2 = new BlockFieldMatrix(m1.getData()); Assert.assertEquals(m1, m2); - BlockFieldMatrix m3 = new BlockFieldMatrix<>(testData); - BlockFieldMatrix m4 = new BlockFieldMatrix<>(m3.getData()); + BlockFieldMatrix m3 = new BlockFieldMatrix(testData); + BlockFieldMatrix m4 = new BlockFieldMatrix(m3.getData()); Assert.assertEquals(m3, m4); } /** test add */ @Test public void testAdd() { - BlockFieldMatrix m = new BlockFieldMatrix<>(testData); - BlockFieldMatrix mInv = new BlockFieldMatrix<>(testDataInv); + BlockFieldMatrix m = new BlockFieldMatrix(testData); + BlockFieldMatrix mInv = new BlockFieldMatrix(testDataInv); FieldMatrix mPlusMInv = m.add(mInv); Fraction[][] sumEntries = mPlusMInv.getData(); for (int row = 0; row < m.getRowDimension(); row++) { @@ -206,8 +206,8 @@ public final class BlockFieldMatrixTest { /** test add failure */ @Test public void testAddFail() { - BlockFieldMatrix m = new BlockFieldMatrix<>(testData); - BlockFieldMatrix m2 = new BlockFieldMatrix<>(testData2); + BlockFieldMatrix m = new BlockFieldMatrix(testData); + BlockFieldMatrix m2 = new BlockFieldMatrix(testData2); try { m.add(m2); Assert.fail("MathIllegalArgumentException expected"); @@ -219,11 +219,11 @@ public final class BlockFieldMatrixTest { /** test m-n = m + -n */ @Test public void testPlusMinus() { - BlockFieldMatrix m = new BlockFieldMatrix<>(testData); - BlockFieldMatrix m2 = new BlockFieldMatrix<>(testDataInv); + BlockFieldMatrix m = new BlockFieldMatrix(testData); + BlockFieldMatrix m2 = new BlockFieldMatrix(testDataInv); TestUtils.assertEquals(m.subtract(m2), m2.scalarMultiply(new Fraction(-1)).add(m)); try { - m.subtract(new BlockFieldMatrix<>(testData2)); + m.subtract(new BlockFieldMatrix(testData2)); Assert.fail("Expecting illegalArgumentException"); } catch (MathIllegalArgumentException ex) { // ignored @@ -233,17 +233,17 @@ public final class BlockFieldMatrixTest { /** test multiply */ @Test public void testMultiply() { - BlockFieldMatrix m = new BlockFieldMatrix<>(testData); - BlockFieldMatrix mInv = new BlockFieldMatrix<>(testDataInv); - BlockFieldMatrix identity = new BlockFieldMatrix<>(id); - BlockFieldMatrix m2 = new BlockFieldMatrix<>(testData2); + BlockFieldMatrix m = new BlockFieldMatrix(testData); + BlockFieldMatrix mInv = new BlockFieldMatrix(testDataInv); + BlockFieldMatrix identity = new BlockFieldMatrix(id); + BlockFieldMatrix m2 = new BlockFieldMatrix(testData2); TestUtils.assertEquals(m.multiply(mInv), identity); TestUtils.assertEquals(mInv.multiply(m), identity); TestUtils.assertEquals(m.multiply(identity), m); TestUtils.assertEquals(identity.multiply(mInv), mInv); TestUtils.assertEquals(m2.multiply(identity), m2); try { - m.multiply(new BlockFieldMatrix<>(bigSingular)); + m.multiply(new BlockFieldMatrix(bigSingular)); Assert.fail("Expecting illegalArgumentException"); } catch (MathIllegalArgumentException ex) { // expected @@ -253,7 +253,7 @@ public final class BlockFieldMatrixTest { @Test public void testSeveralBlocks() { FieldMatrix m = - new BlockFieldMatrix<>(FractionField.getInstance(), 37, 41); + new BlockFieldMatrix(FractionField.getInstance(), 37, 41); for (int i = 0; i < m.getRowDimension(); ++i) { for (int j = 0; j < m.getColumnDimension(); ++j) { m.setEntry(i, j, new Fraction(i * 11 + j, 11)); @@ -351,18 +351,18 @@ public final class BlockFieldMatrixTest { @Test public void testMultiply2() { - FieldMatrix m3 = new BlockFieldMatrix<>(d3); - FieldMatrix m4 = new BlockFieldMatrix<>(d4); - FieldMatrix m5 = new BlockFieldMatrix<>(d5); + FieldMatrix m3 = new BlockFieldMatrix(d3); + FieldMatrix m4 = new BlockFieldMatrix(d4); + FieldMatrix m5 = new BlockFieldMatrix(d5); TestUtils.assertEquals(m3.multiply(m4), m5); } /** test trace */ @Test public void testTrace() { - FieldMatrix m = new BlockFieldMatrix<>(id); + FieldMatrix m = new BlockFieldMatrix(id); Assert.assertEquals(new Fraction(3),m.getTrace()); - m = new BlockFieldMatrix<>(testData2); + m = new BlockFieldMatrix(testData2); try { m.getTrace(); Assert.fail("Expecting NonSquareMatrixException"); @@ -374,18 +374,18 @@ public final class BlockFieldMatrixTest { /** test scalarAdd */ @Test public void testScalarAdd() { - FieldMatrix m = new BlockFieldMatrix<>(testData); - TestUtils.assertEquals(new BlockFieldMatrix<>(testDataPlus2), + FieldMatrix m = new BlockFieldMatrix(testData); + TestUtils.assertEquals(new BlockFieldMatrix(testDataPlus2), m.scalarAdd(new Fraction(2))); } /** test operate */ @Test public void testOperate() { - FieldMatrix m = new BlockFieldMatrix<>(id); + FieldMatrix m = new BlockFieldMatrix(id); TestUtils.assertEquals(testVector, m.operate(testVector)); - TestUtils.assertEquals(testVector, m.operate(new ArrayFieldVector<>(testVector)).toArray()); - m = new BlockFieldMatrix<>(bigSingular); + TestUtils.assertEquals(testVector, m.operate(new ArrayFieldVector(testVector)).toArray()); + m = new BlockFieldMatrix(bigSingular); try { m.operate(testVector); Assert.fail("Expecting illegalArgumentException"); @@ -425,7 +425,7 @@ public final class BlockFieldMatrixTest { /** test issue MATH-209 */ @Test public void testMath209() { - FieldMatrix a = new BlockFieldMatrix<>(new Fraction[][] { + FieldMatrix a = new BlockFieldMatrix(new Fraction[][] { { new Fraction(1), new Fraction(2) }, { new Fraction(3), new Fraction(4) }, { new Fraction(5), new Fraction(6) } @@ -440,23 +440,23 @@ public final class BlockFieldMatrixTest { /** test transpose */ @Test public void testTranspose() { - FieldMatrix m = new BlockFieldMatrix<>(testData); - FieldMatrix mIT = new FieldLUDecomposition<>(m).getSolver().getInverse().transpose(); - FieldMatrix mTI = new FieldLUDecomposition<>(m.transpose()).getSolver().getInverse(); + FieldMatrix m = new BlockFieldMatrix(testData); + FieldMatrix mIT = new FieldLUDecomposition(m).getSolver().getInverse().transpose(); + FieldMatrix mTI = new FieldLUDecomposition(m.transpose()).getSolver().getInverse(); TestUtils.assertEquals(mIT, mTI); - m = new BlockFieldMatrix<>(testData2); - FieldMatrix mt = new BlockFieldMatrix<>(testData2T); + m = new BlockFieldMatrix(testData2); + FieldMatrix mt = new BlockFieldMatrix(testData2T); TestUtils.assertEquals(mt, m.transpose()); } /** test preMultiply by vector */ @Test public void testPremultiplyVector() { - FieldMatrix m = new BlockFieldMatrix<>(testData); + FieldMatrix m = new BlockFieldMatrix(testData); TestUtils.assertEquals(m.preMultiply(testVector), preMultTest); - TestUtils.assertEquals(m.preMultiply(new ArrayFieldVector<>(testVector).toArray()), + TestUtils.assertEquals(m.preMultiply(new ArrayFieldVector(testVector).toArray()), preMultTest); - m = new BlockFieldMatrix<>(bigSingular); + m = new BlockFieldMatrix(bigSingular); try { m.preMultiply(testVector); Assert.fail("expecting MathIllegalArgumentException"); @@ -467,20 +467,20 @@ public final class BlockFieldMatrixTest { @Test public void testPremultiply() { - FieldMatrix m3 = new BlockFieldMatrix<>(d3); - FieldMatrix m4 = new BlockFieldMatrix<>(d4); - FieldMatrix m5 = new BlockFieldMatrix<>(d5); + FieldMatrix m3 = new BlockFieldMatrix(d3); + FieldMatrix m4 = new BlockFieldMatrix(d4); + FieldMatrix m5 = new BlockFieldMatrix(d5); TestUtils.assertEquals(m4.preMultiply(m3), m5); - BlockFieldMatrix m = new BlockFieldMatrix<>(testData); - BlockFieldMatrix mInv = new BlockFieldMatrix<>(testDataInv); - BlockFieldMatrix identity = new BlockFieldMatrix<>(id); + BlockFieldMatrix m = new BlockFieldMatrix(testData); + BlockFieldMatrix mInv = new BlockFieldMatrix(testDataInv); + BlockFieldMatrix identity = new BlockFieldMatrix(id); TestUtils.assertEquals(m.preMultiply(mInv), identity); TestUtils.assertEquals(mInv.preMultiply(m), identity); TestUtils.assertEquals(m.preMultiply(identity), m); TestUtils.assertEquals(identity.preMultiply(mInv), mInv); try { - m.preMultiply(new BlockFieldMatrix<>(bigSingular)); + m.preMultiply(new BlockFieldMatrix(bigSingular)); Assert.fail("Expecting illegalArgumentException"); } catch (MathIllegalArgumentException ex) { // ignored @@ -489,7 +489,7 @@ public final class BlockFieldMatrixTest { @Test public void testGetVectors() { - FieldMatrix m = new BlockFieldMatrix<>(testData); + FieldMatrix m = new BlockFieldMatrix(testData); TestUtils.assertEquals(m.getRow(0), testDataRow1); TestUtils.assertEquals(m.getColumn(2), testDataCol3); try { @@ -508,7 +508,7 @@ public final class BlockFieldMatrixTest { @Test public void testGetEntry() { - FieldMatrix m = new BlockFieldMatrix<>(testData); + FieldMatrix m = new BlockFieldMatrix(testData); Assert.assertEquals(m.getEntry(0,1),new Fraction(2)); try { m.getEntry(10, 4); @@ -526,20 +526,20 @@ public final class BlockFieldMatrixTest { {new Fraction(1),new Fraction(2),new Fraction(3)}, {new Fraction(2),new Fraction(5),new Fraction(3)} }; - FieldMatrix m = new BlockFieldMatrix<>(matrixData); + FieldMatrix m = new BlockFieldMatrix(matrixData); // One more with three rows, two columns Fraction[][] matrixData2 = { {new Fraction(1),new Fraction(2)}, {new Fraction(2),new Fraction(5)}, {new Fraction(1), new Fraction(7)} }; - FieldMatrix n = new BlockFieldMatrix<>(matrixData2); + FieldMatrix n = new BlockFieldMatrix(matrixData2); // Now multiply m by n FieldMatrix p = m.multiply(n); Assert.assertEquals(2, p.getRowDimension()); Assert.assertEquals(2, p.getColumnDimension()); // Invert p - FieldMatrix pInverse = new FieldLUDecomposition<>(p).getSolver().getInverse(); + FieldMatrix pInverse = new FieldLUDecomposition(p).getSolver().getInverse(); Assert.assertEquals(2, pInverse.getRowDimension()); Assert.assertEquals(2, pInverse.getColumnDimension()); @@ -549,14 +549,14 @@ public final class BlockFieldMatrixTest { {new Fraction(-1), new Fraction(7), new Fraction(6)}, {new Fraction(4), new Fraction(-3), new Fraction(-5)} }; - FieldMatrix coefficients = new BlockFieldMatrix<>(coefficientsData); + FieldMatrix coefficients = new BlockFieldMatrix(coefficientsData); Fraction[] constants = { new Fraction(1), new Fraction(-2), new Fraction(1) }; Fraction[] solution; - solution = new FieldLUDecomposition<>(coefficients) + solution = new FieldLUDecomposition(coefficients) .getSolver() - .solve(new ArrayFieldVector<>(constants, false)).toArray(); + .solve(new ArrayFieldVector(constants, false)).toArray(); Assert.assertEquals(new Fraction(2).multiply(solution[0]). add(new Fraction(3).multiply(solution[1])). subtract(new Fraction(2).multiply(solution[2])), @@ -575,7 +575,7 @@ public final class BlockFieldMatrixTest { // test submatrix accessors @Test public void testGetSubMatrix() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); + FieldMatrix m = new BlockFieldMatrix(subTestData); checkGetSubMatrix(m, subRows23Cols00, 2 , 3 , 0, 0); checkGetSubMatrix(m, subRows00Cols33, 0 , 0 , 3, 3); checkGetSubMatrix(m, subRows01Cols23, 0 , 1 , 2, 3); @@ -598,7 +598,7 @@ public final class BlockFieldMatrixTest { try { FieldMatrix sub = m.getSubMatrix(startRow, endRow, startColumn, endColumn); if (reference != null) { - Assert.assertEquals(new BlockFieldMatrix<>(reference), sub); + Assert.assertEquals(new BlockFieldMatrix(reference), sub); } else { Assert.fail("Expecting OutOfRangeException or NotStrictlyPositiveException" + " or NumberIsTooSmallException or NoDataException"); @@ -627,7 +627,7 @@ public final class BlockFieldMatrixTest { try { FieldMatrix sub = m.getSubMatrix(selectedRows, selectedColumns); if (reference != null) { - Assert.assertEquals(new BlockFieldMatrix<>(reference), sub); + Assert.assertEquals(new BlockFieldMatrix(reference), sub); } else { Assert.fail("Expecting OutOfRangeException"); } @@ -654,9 +654,9 @@ public final class BlockFieldMatrixTest { public void testGetSetMatrixLarge() { int n = 3 * BlockFieldMatrix.BLOCK_SIZE; FieldMatrix m = - new BlockFieldMatrix<>(FractionField.getInstance(), n, n); + new BlockFieldMatrix(FractionField.getInstance(), n, n); FieldMatrix sub = - new BlockFieldMatrix<>(FractionField.getInstance(), n - 4, n - 4).scalarAdd(new Fraction(1)); + new BlockFieldMatrix(FractionField.getInstance(), n - 4, n - 4).scalarAdd(new Fraction(1)); m.setSubMatrix(sub.getData(), 2, 2); for (int i = 0; i < n; ++i) { @@ -673,7 +673,7 @@ public final class BlockFieldMatrixTest { @Test public void testCopySubMatrix() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); + FieldMatrix m = new BlockFieldMatrix(subTestData); checkCopy(m, subRows23Cols00, 2 , 3 , 0, 0); checkCopy(m, subRows00Cols33, 0 , 0 , 3, 3); checkCopy(m, subRows01Cols23, 0 , 1 , 2, 3); @@ -700,7 +700,7 @@ public final class BlockFieldMatrixTest { new Fraction[reference.length][reference[0].length]; m.copySubMatrix(startRow, endRow, startColumn, endColumn, sub); if (reference != null) { - Assert.assertEquals(new BlockFieldMatrix<>(reference), new BlockFieldMatrix<>(sub)); + Assert.assertEquals(new BlockFieldMatrix(reference), new BlockFieldMatrix(sub)); } else { Assert.fail("Expecting OutOfRangeException or NumberIsTooSmallException or NoDataException"); } @@ -727,7 +727,7 @@ public final class BlockFieldMatrixTest { new Fraction[reference.length][reference[0].length]; m.copySubMatrix(selectedRows, selectedColumns, sub); if (reference != null) { - Assert.assertEquals(new BlockFieldMatrix<>(reference), new BlockFieldMatrix<>(sub)); + Assert.assertEquals(new BlockFieldMatrix(reference), new BlockFieldMatrix(sub)); } else { Assert.fail("Expecting OutOfRangeException or NumberIsTooSmallException or NoDataException"); } @@ -748,9 +748,9 @@ public final class BlockFieldMatrixTest { @Test public void testGetRowMatrix() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); - FieldMatrix mRow0 = new BlockFieldMatrix<>(subRow0); - FieldMatrix mRow3 = new BlockFieldMatrix<>(subRow3); + FieldMatrix m = new BlockFieldMatrix(subTestData); + FieldMatrix mRow0 = new BlockFieldMatrix(subRow0); + FieldMatrix mRow3 = new BlockFieldMatrix(subRow3); Assert.assertEquals("Row0", mRow0, m.getRowMatrix(0)); Assert.assertEquals("Row3", mRow3, m.getRowMatrix(3)); try { @@ -769,8 +769,8 @@ public final class BlockFieldMatrixTest { @Test public void testSetRowMatrix() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); - FieldMatrix mRow3 = new BlockFieldMatrix<>(subRow3); + FieldMatrix m = new BlockFieldMatrix(subTestData); + FieldMatrix mRow3 = new BlockFieldMatrix(subRow3); Assert.assertNotSame(mRow3, m.getRowMatrix(0)); m.setRowMatrix(0, mRow3); Assert.assertEquals(mRow3, m.getRowMatrix(0)); @@ -792,9 +792,9 @@ public final class BlockFieldMatrixTest { public void testGetSetRowMatrixLarge() { int n = 3 * BlockFieldMatrix.BLOCK_SIZE; FieldMatrix m = - new BlockFieldMatrix<>(FractionField.getInstance(), n, n); + new BlockFieldMatrix(FractionField.getInstance(), n, n); FieldMatrix sub = - new BlockFieldMatrix<>(FractionField.getInstance(), 1, n).scalarAdd(new Fraction(1)); + new BlockFieldMatrix(FractionField.getInstance(), 1, n).scalarAdd(new Fraction(1)); m.setRowMatrix(2, sub); for (int i = 0; i < n; ++i) { @@ -812,9 +812,9 @@ public final class BlockFieldMatrixTest { @Test public void testGetColumnMatrix() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); - FieldMatrix mColumn1 = new BlockFieldMatrix<>(subColumn1); - FieldMatrix mColumn3 = new BlockFieldMatrix<>(subColumn3); + FieldMatrix m = new BlockFieldMatrix(subTestData); + FieldMatrix mColumn1 = new BlockFieldMatrix(subColumn1); + FieldMatrix mColumn3 = new BlockFieldMatrix(subColumn3); Assert.assertEquals(mColumn1, m.getColumnMatrix(1)); Assert.assertEquals(mColumn3, m.getColumnMatrix(3)); try { @@ -833,8 +833,8 @@ public final class BlockFieldMatrixTest { @Test public void testSetColumnMatrix() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); - FieldMatrix mColumn3 = new BlockFieldMatrix<>(subColumn3); + FieldMatrix m = new BlockFieldMatrix(subTestData); + FieldMatrix mColumn3 = new BlockFieldMatrix(subColumn3); Assert.assertNotSame(mColumn3, m.getColumnMatrix(1)); m.setColumnMatrix(1, mColumn3); Assert.assertEquals(mColumn3, m.getColumnMatrix(1)); @@ -856,9 +856,9 @@ public final class BlockFieldMatrixTest { public void testGetSetColumnMatrixLarge() { int n = 3 * BlockFieldMatrix.BLOCK_SIZE; FieldMatrix m = - new BlockFieldMatrix<>(FractionField.getInstance(), n, n); + new BlockFieldMatrix(FractionField.getInstance(), n, n); FieldMatrix sub = - new BlockFieldMatrix<>(FractionField.getInstance(), n, 1).scalarAdd(new Fraction(1)); + new BlockFieldMatrix(FractionField.getInstance(), n, 1).scalarAdd(new Fraction(1)); m.setColumnMatrix(2, sub); for (int i = 0; i < n; ++i) { @@ -876,9 +876,9 @@ public final class BlockFieldMatrixTest { @Test public void testGetRowVector() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); - FieldVector mRow0 = new ArrayFieldVector<>(subRow0[0]); - FieldVector mRow3 = new ArrayFieldVector<>(subRow3[0]); + FieldMatrix m = new BlockFieldMatrix(subTestData); + FieldVector mRow0 = new ArrayFieldVector(subRow0[0]); + FieldVector mRow3 = new ArrayFieldVector(subRow3[0]); Assert.assertEquals(mRow0, m.getRowVector(0)); Assert.assertEquals(mRow3, m.getRowVector(3)); try { @@ -897,8 +897,8 @@ public final class BlockFieldMatrixTest { @Test public void testSetRowVector() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); - FieldVector mRow3 = new ArrayFieldVector<>(subRow3[0]); + FieldMatrix m = new BlockFieldMatrix(subTestData); + FieldVector mRow3 = new ArrayFieldVector(subRow3[0]); Assert.assertNotSame(mRow3, m.getRowMatrix(0)); m.setRowVector(0, mRow3); Assert.assertEquals(mRow3, m.getRowVector(0)); @@ -909,7 +909,7 @@ public final class BlockFieldMatrixTest { // expected } try { - m.setRowVector(0, new ArrayFieldVector<>(FractionField.getInstance(), 5)); + m.setRowVector(0, new ArrayFieldVector(FractionField.getInstance(), 5)); Assert.fail("Expecting MatrixDimensionMismatchException"); } catch (MatrixDimensionMismatchException ex) { // expected @@ -919,8 +919,8 @@ public final class BlockFieldMatrixTest { @Test public void testGetSetRowVectorLarge() { int n = 3 * BlockFieldMatrix.BLOCK_SIZE; - FieldMatrix m = new BlockFieldMatrix<>(FractionField.getInstance(), n, n); - FieldVector sub = new ArrayFieldVector<>(n, new Fraction(1)); + FieldMatrix m = new BlockFieldMatrix(FractionField.getInstance(), n, n); + FieldVector sub = new ArrayFieldVector(n, new Fraction(1)); m.setRowVector(2, sub); for (int i = 0; i < n; ++i) { @@ -938,7 +938,7 @@ public final class BlockFieldMatrixTest { @Test public void testGetColumnVector() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); + FieldMatrix m = new BlockFieldMatrix(subTestData); FieldVector mColumn1 = columnToVector(subColumn1); FieldVector mColumn3 = columnToVector(subColumn3); Assert.assertEquals(mColumn1, m.getColumnVector(1)); @@ -959,7 +959,7 @@ public final class BlockFieldMatrixTest { @Test public void testSetColumnVector() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); + FieldMatrix m = new BlockFieldMatrix(subTestData); FieldVector mColumn3 = columnToVector(subColumn3); Assert.assertNotSame(mColumn3, m.getColumnVector(1)); m.setColumnVector(1, mColumn3); @@ -971,7 +971,7 @@ public final class BlockFieldMatrixTest { // expected } try { - m.setColumnVector(0, new ArrayFieldVector<>(FractionField.getInstance(), 5)); + m.setColumnVector(0, new ArrayFieldVector(FractionField.getInstance(), 5)); Assert.fail("Expecting MatrixDimensionMismatchException"); } catch (MatrixDimensionMismatchException ex) { // expected @@ -981,8 +981,8 @@ public final class BlockFieldMatrixTest { @Test public void testGetSetColumnVectorLarge() { int n = 3 * BlockFieldMatrix.BLOCK_SIZE; - FieldMatrix m = new BlockFieldMatrix<>(FractionField.getInstance(), n, n); - FieldVector sub = new ArrayFieldVector<>(n, new Fraction(1)); + FieldMatrix m = new BlockFieldMatrix(FractionField.getInstance(), n, n); + FieldVector sub = new ArrayFieldVector(n, new Fraction(1)); m.setColumnVector(2, sub); for (int i = 0; i < n; ++i) { @@ -1003,12 +1003,12 @@ public final class BlockFieldMatrixTest { for (int i = 0; i < data.length; ++i) { data[i] = column[i][0]; } - return new ArrayFieldVector<>(data, false); + return new ArrayFieldVector(data, false); } @Test public void testGetRow() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); + FieldMatrix m = new BlockFieldMatrix(subTestData); checkArrays(subRow0[0], m.getRow(0)); checkArrays(subRow3[0], m.getRow(3)); try { @@ -1027,7 +1027,7 @@ public final class BlockFieldMatrixTest { @Test public void testSetRow() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); + FieldMatrix m = new BlockFieldMatrix(subTestData); Assert.assertTrue(subRow3[0][0] != m.getRow(0)[0]); m.setRow(0, subRow3[0]); checkArrays(subRow3[0], m.getRow(0)); @@ -1048,7 +1048,7 @@ public final class BlockFieldMatrixTest { @Test public void testGetSetRowLarge() { int n = 3 * BlockFieldMatrix.BLOCK_SIZE; - FieldMatrix m = new BlockFieldMatrix<>(FractionField.getInstance(), n, n); + FieldMatrix m = new BlockFieldMatrix(FractionField.getInstance(), n, n); Fraction[] sub = new Fraction[n]; Arrays.fill(sub, new Fraction(1)); @@ -1068,7 +1068,7 @@ public final class BlockFieldMatrixTest { @Test public void testGetColumn() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); + FieldMatrix m = new BlockFieldMatrix(subTestData); Fraction[] mColumn1 = columnToArray(subColumn1); Fraction[] mColumn3 = columnToArray(subColumn3); checkArrays(mColumn1, m.getColumn(1)); @@ -1089,7 +1089,7 @@ public final class BlockFieldMatrixTest { @Test public void testSetColumn() { - FieldMatrix m = new BlockFieldMatrix<>(subTestData); + FieldMatrix m = new BlockFieldMatrix(subTestData); Fraction[] mColumn3 = columnToArray(subColumn3); Assert.assertTrue(mColumn3[0] != m.getColumn(1)[0]); m.setColumn(1, mColumn3); @@ -1111,7 +1111,7 @@ public final class BlockFieldMatrixTest { @Test public void testGetSetColumnLarge() { int n = 3 * BlockFieldMatrix.BLOCK_SIZE; - FieldMatrix m = new BlockFieldMatrix<>(FractionField.getInstance(), n, n); + FieldMatrix m = new BlockFieldMatrix(FractionField.getInstance(), n, n); Fraction[] sub = new Fraction[n]; Arrays.fill(sub, new Fraction(1)); @@ -1146,7 +1146,7 @@ public final class BlockFieldMatrixTest { @Test public void testEqualsAndHashCode() { - BlockFieldMatrix m = new BlockFieldMatrix<>(testData); + BlockFieldMatrix m = new BlockFieldMatrix(testData); BlockFieldMatrix m1 = (BlockFieldMatrix) m.copy(); BlockFieldMatrix mt = (BlockFieldMatrix) m.transpose(); Assert.assertTrue(m.hashCode() != mt.hashCode()); @@ -1155,36 +1155,36 @@ public final class BlockFieldMatrixTest { Assert.assertEquals(m, m1); Assert.assertFalse(m.equals(null)); Assert.assertFalse(m.equals(mt)); - Assert.assertFalse(m.equals(new BlockFieldMatrix<>(bigSingular))); + Assert.assertFalse(m.equals(new BlockFieldMatrix(bigSingular))); } @Test public void testToString() { - BlockFieldMatrix m = new BlockFieldMatrix<>(testData); + BlockFieldMatrix m = new BlockFieldMatrix(testData); Assert.assertEquals("BlockFieldMatrix{{1,2,3},{2,5,3},{1,0,8}}", m.toString()); } @Test public void testSetSubMatrix() { - BlockFieldMatrix m = new BlockFieldMatrix<>(testData); + BlockFieldMatrix m = new BlockFieldMatrix(testData); m.setSubMatrix(detData2,1,1); - FieldMatrix expected = new BlockFieldMatrix<> + FieldMatrix expected = new BlockFieldMatrix (new Fraction[][] {{new Fraction(1),new Fraction(2),new Fraction(3)},{new Fraction(2),new Fraction(1),new Fraction(3)},{new Fraction(1),new Fraction(2),new Fraction(4)}}); Assert.assertEquals(expected, m); m.setSubMatrix(detData2,0,0); - expected = new BlockFieldMatrix<> + expected = new BlockFieldMatrix (new Fraction[][] {{new Fraction(1),new Fraction(3),new Fraction(3)},{new Fraction(2),new Fraction(4),new Fraction(3)},{new Fraction(1),new Fraction(2),new Fraction(4)}}); Assert.assertEquals(expected, m); m.setSubMatrix(testDataPlus2,0,0); - expected = new BlockFieldMatrix<> + expected = new BlockFieldMatrix (new Fraction[][] {{new Fraction(3),new Fraction(4),new Fraction(5)},{new Fraction(4),new Fraction(7),new Fraction(5)},{new Fraction(3),new Fraction(2),new Fraction(10)}}); Assert.assertEquals(expected, m); // javadoc example BlockFieldMatrix matrix = - new BlockFieldMatrix<>(new Fraction[][] { + new BlockFieldMatrix(new Fraction[][] { {new Fraction(1), new Fraction(2), new Fraction(3), new Fraction(4)}, {new Fraction(5), new Fraction(6), new Fraction(7), new Fraction(8)}, {new Fraction(9), new Fraction(0), new Fraction(1) , new Fraction(2)} @@ -1194,7 +1194,7 @@ public final class BlockFieldMatrixTest { {new Fraction(5), new Fraction(6)} }, 1, 1); expected = - new BlockFieldMatrix<>(new Fraction[][] { + new BlockFieldMatrix(new Fraction[][] { {new Fraction(1), new Fraction(2), new Fraction(3),new Fraction(4)}, {new Fraction(5), new Fraction(3), new Fraction(4), new Fraction(8)}, {new Fraction(9), new Fraction(5) ,new Fraction(6), new Fraction(2)} @@ -1252,13 +1252,13 @@ public final class BlockFieldMatrixTest { int rows = 150; int columns = 75; - FieldMatrix m = new BlockFieldMatrix<>(FractionField.getInstance(), rows, columns); + FieldMatrix m = new BlockFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInRowOrder(new SetVisitor()); GetVisitor getVisitor = new GetVisitor(); m.walkInOptimizedOrder(getVisitor); Assert.assertEquals(rows * columns, getVisitor.getCount()); - m = new BlockFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new BlockFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInRowOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2); getVisitor = new GetVisitor(); m.walkInOptimizedOrder(getVisitor, 1, rows - 2, 1, columns - 2); @@ -1272,13 +1272,13 @@ public final class BlockFieldMatrixTest { Assert.assertEquals(new Fraction(0), m.getEntry(rows - 1, j)); } - m = new BlockFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new BlockFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInColumnOrder(new SetVisitor()); getVisitor = new GetVisitor(); m.walkInOptimizedOrder(getVisitor); Assert.assertEquals(rows * columns, getVisitor.getCount()); - m = new BlockFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new BlockFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInColumnOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2); getVisitor = new GetVisitor(); m.walkInOptimizedOrder(getVisitor, 1, rows - 2, 1, columns - 2); @@ -1292,13 +1292,13 @@ public final class BlockFieldMatrixTest { Assert.assertEquals(new Fraction(0), m.getEntry(rows - 1, j)); } - m = new BlockFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new BlockFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInOptimizedOrder(new SetVisitor()); getVisitor = new GetVisitor(); m.walkInRowOrder(getVisitor); Assert.assertEquals(rows * columns, getVisitor.getCount()); - m = new BlockFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new BlockFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInOptimizedOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2); getVisitor = new GetVisitor(); m.walkInRowOrder(getVisitor, 1, rows - 2, 1, columns - 2); @@ -1312,13 +1312,13 @@ public final class BlockFieldMatrixTest { Assert.assertEquals(new Fraction(0), m.getEntry(rows - 1, j)); } - m = new BlockFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new BlockFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInOptimizedOrder(new SetVisitor()); getVisitor = new GetVisitor(); m.walkInColumnOrder(getVisitor); Assert.assertEquals(rows * columns, getVisitor.getCount()); - m = new BlockFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new BlockFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInOptimizedOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2); getVisitor = new GetVisitor(); m.walkInColumnOrder(getVisitor, 1, rows - 2, 1, columns - 2); @@ -1336,7 +1336,7 @@ public final class BlockFieldMatrixTest { @Test public void testSerial() { - BlockFieldMatrix m = new BlockFieldMatrix<>(testData); + BlockFieldMatrix m = new BlockFieldMatrix(testData); Assert.assertEquals(m,TestUtils.serializeAndRecover(m)); } @@ -1368,7 +1368,7 @@ public final class BlockFieldMatrixTest { private BlockFieldMatrix createRandomMatrix(Random r, int rows, int columns) { BlockFieldMatrix m = - new BlockFieldMatrix<>(FractionField.getInstance(), rows, columns); + new BlockFieldMatrix(FractionField.getInstance(), rows, columns); for (int i = 0; i < rows; ++i) { for (int j = 0; j < columns; ++j) { int p = r.nextInt(20) - 10; diff --git a/src/test/java/org/apache/commons/math4/linear/FieldLUDecompositionTest.java b/src/test/java/org/apache/commons/math4/linear/FieldLUDecompositionTest.java index 0aa8c0681..528fdeb9e 100644 --- a/src/test/java/org/apache/commons/math4/linear/FieldLUDecompositionTest.java +++ b/src/test/java/org/apache/commons/math4/linear/FieldLUDecompositionTest.java @@ -60,8 +60,8 @@ public class FieldLUDecompositionTest { @Test public void testDimensions() { FieldMatrix matrix = - new Array2DRowFieldMatrix<>(FractionField.getInstance(), testData); - FieldLUDecomposition LU = new FieldLUDecomposition<>(matrix); + new Array2DRowFieldMatrix(FractionField.getInstance(), testData); + FieldLUDecomposition LU = new FieldLUDecomposition(matrix); Assert.assertEquals(testData.length, LU.getL().getRowDimension()); Assert.assertEquals(testData.length, LU.getL().getColumnDimension()); Assert.assertEquals(testData.length, LU.getU().getRowDimension()); @@ -76,7 +76,7 @@ public class FieldLUDecompositionTest { public void testNonSquare() { try { // we don't use FractionField.getInstance() for testing purposes - new FieldLUDecomposition<>(new Array2DRowFieldMatrix<>(new Fraction[][] { + new FieldLUDecomposition(new Array2DRowFieldMatrix(new Fraction[][] { { Fraction.ZERO, Fraction.ZERO }, { Fraction.ZERO, Fraction.ZERO }, { Fraction.ZERO, Fraction.ZERO } @@ -90,39 +90,39 @@ public class FieldLUDecompositionTest { /** test PA = LU */ @Test public void testPAEqualLU() { - FieldMatrix matrix = new Array2DRowFieldMatrix<>(FractionField.getInstance(), testData); - FieldLUDecomposition lu = new FieldLUDecomposition<>(matrix); + FieldMatrix matrix = new Array2DRowFieldMatrix(FractionField.getInstance(), testData); + FieldLUDecomposition lu = new FieldLUDecomposition(matrix); FieldMatrix l = lu.getL(); FieldMatrix u = lu.getU(); FieldMatrix p = lu.getP(); TestUtils.assertEquals(p.multiply(matrix), l.multiply(u)); - matrix = new Array2DRowFieldMatrix<>(FractionField.getInstance(), testDataMinus); - lu = new FieldLUDecomposition<>(matrix); + matrix = new Array2DRowFieldMatrix(FractionField.getInstance(), testDataMinus); + lu = new FieldLUDecomposition(matrix); l = lu.getL(); u = lu.getU(); p = lu.getP(); TestUtils.assertEquals(p.multiply(matrix), l.multiply(u)); - matrix = new Array2DRowFieldMatrix<>(FractionField.getInstance(), 17, 17); + matrix = new Array2DRowFieldMatrix(FractionField.getInstance(), 17, 17); for (int i = 0; i < matrix.getRowDimension(); ++i) { matrix.setEntry(i, i, Fraction.ONE); } - lu = new FieldLUDecomposition<>(matrix); + lu = new FieldLUDecomposition(matrix); l = lu.getL(); u = lu.getU(); p = lu.getP(); TestUtils.assertEquals(p.multiply(matrix), l.multiply(u)); - matrix = new Array2DRowFieldMatrix<>(FractionField.getInstance(), singular); - lu = new FieldLUDecomposition<>(matrix); + matrix = new Array2DRowFieldMatrix(FractionField.getInstance(), singular); + lu = new FieldLUDecomposition(matrix); Assert.assertFalse(lu.getSolver().isNonSingular()); Assert.assertNull(lu.getL()); Assert.assertNull(lu.getU()); Assert.assertNull(lu.getP()); - matrix = new Array2DRowFieldMatrix<>(FractionField.getInstance(), bigSingular); - lu = new FieldLUDecomposition<>(matrix); + matrix = new Array2DRowFieldMatrix(FractionField.getInstance(), bigSingular); + lu = new FieldLUDecomposition(matrix); Assert.assertFalse(lu.getSolver().isNonSingular()); Assert.assertNull(lu.getL()); Assert.assertNull(lu.getU()); @@ -133,8 +133,8 @@ public class FieldLUDecompositionTest { /** test that L is lower triangular with unit diagonal */ @Test public void testLLowerTriangular() { - FieldMatrix matrix = new Array2DRowFieldMatrix<>(FractionField.getInstance(), testData); - FieldMatrix l = new FieldLUDecomposition<>(matrix).getL(); + FieldMatrix matrix = new Array2DRowFieldMatrix(FractionField.getInstance(), testData); + FieldMatrix l = new FieldLUDecomposition(matrix).getL(); for (int i = 0; i < l.getRowDimension(); i++) { Assert.assertEquals(Fraction.ONE, l.getEntry(i, i)); for (int j = i + 1; j < l.getColumnDimension(); j++) { @@ -146,8 +146,8 @@ public class FieldLUDecompositionTest { /** test that U is upper triangular */ @Test public void testUUpperTriangular() { - FieldMatrix matrix = new Array2DRowFieldMatrix<>(FractionField.getInstance(), testData); - FieldMatrix u = new FieldLUDecomposition<>(matrix).getU(); + FieldMatrix matrix = new Array2DRowFieldMatrix(FractionField.getInstance(), testData); + FieldMatrix u = new FieldLUDecomposition(matrix).getU(); for (int i = 0; i < u.getRowDimension(); i++) { for (int j = 0; j < i; j++) { Assert.assertEquals(Fraction.ZERO, u.getEntry(i, j)); @@ -158,12 +158,12 @@ public class FieldLUDecompositionTest { /** test that P is a permutation matrix */ @Test public void testPPermutation() { - FieldMatrix matrix = new Array2DRowFieldMatrix<>(FractionField.getInstance(), testData); - FieldMatrix p = new FieldLUDecomposition<>(matrix).getP(); + FieldMatrix matrix = new Array2DRowFieldMatrix(FractionField.getInstance(), testData); + FieldMatrix p = new FieldLUDecomposition(matrix).getP(); FieldMatrix ppT = p.multiply(p.transpose()); FieldMatrix id = - new Array2DRowFieldMatrix<>(FractionField.getInstance(), + new Array2DRowFieldMatrix(FractionField.getInstance(), p.getRowDimension(), p.getRowDimension()); for (int i = 0; i < id.getRowDimension(); ++i) { id.setEntry(i, i, Fraction.ONE); @@ -215,11 +215,11 @@ public class FieldLUDecompositionTest { @Test public void testSingular() { FieldLUDecomposition lu = - new FieldLUDecomposition<>(new Array2DRowFieldMatrix<>(FractionField.getInstance(), testData)); + new FieldLUDecomposition(new Array2DRowFieldMatrix(FractionField.getInstance(), testData)); Assert.assertTrue(lu.getSolver().isNonSingular()); - lu = new FieldLUDecomposition<>(new Array2DRowFieldMatrix<>(FractionField.getInstance(), singular)); + lu = new FieldLUDecomposition(new Array2DRowFieldMatrix(FractionField.getInstance(), singular)); Assert.assertFalse(lu.getSolver().isNonSingular()); - lu = new FieldLUDecomposition<>(new Array2DRowFieldMatrix<>(FractionField.getInstance(), bigSingular)); + lu = new FieldLUDecomposition(new Array2DRowFieldMatrix(FractionField.getInstance(), bigSingular)); Assert.assertFalse(lu.getSolver().isNonSingular()); } @@ -227,18 +227,18 @@ public class FieldLUDecompositionTest { @Test public void testMatricesValues1() { FieldLUDecomposition lu = - new FieldLUDecomposition<>(new Array2DRowFieldMatrix<>(FractionField.getInstance(), testData)); - FieldMatrix lRef = new Array2DRowFieldMatrix<>(FractionField.getInstance(), new Fraction[][] { + new FieldLUDecomposition(new Array2DRowFieldMatrix(FractionField.getInstance(), testData)); + FieldMatrix lRef = new Array2DRowFieldMatrix(FractionField.getInstance(), new Fraction[][] { { new Fraction(1), new Fraction(0), new Fraction(0) }, { new Fraction(2), new Fraction(1), new Fraction(0) }, { new Fraction(1), new Fraction(-2), new Fraction(1) } }); - FieldMatrix uRef = new Array2DRowFieldMatrix<>(FractionField.getInstance(), new Fraction[][] { + FieldMatrix uRef = new Array2DRowFieldMatrix(FractionField.getInstance(), new Fraction[][] { { new Fraction(1), new Fraction(2), new Fraction(3) }, { new Fraction(0), new Fraction(1), new Fraction(-3) }, { new Fraction(0), new Fraction(0), new Fraction(-1) } }); - FieldMatrix pRef = new Array2DRowFieldMatrix<>(FractionField.getInstance(), new Fraction[][] { + FieldMatrix pRef = new Array2DRowFieldMatrix(FractionField.getInstance(), new Fraction[][] { { new Fraction(1), new Fraction(0), new Fraction(0) }, { new Fraction(0), new Fraction(1), new Fraction(0) }, { new Fraction(0), new Fraction(0), new Fraction(1) } @@ -268,18 +268,18 @@ public class FieldLUDecompositionTest { @Test public void testMatricesValues2() { FieldLUDecomposition lu = - new FieldLUDecomposition<>(new Array2DRowFieldMatrix<>(FractionField.getInstance(), luData)); - FieldMatrix lRef = new Array2DRowFieldMatrix<>(FractionField.getInstance(), new Fraction[][] { + new FieldLUDecomposition(new Array2DRowFieldMatrix(FractionField.getInstance(), luData)); + FieldMatrix lRef = new Array2DRowFieldMatrix(FractionField.getInstance(), new Fraction[][] { { new Fraction(1), new Fraction(0), new Fraction(0) }, { new Fraction(3), new Fraction(1), new Fraction(0) }, { new Fraction(1), new Fraction(0), new Fraction(1) } }); - FieldMatrix uRef = new Array2DRowFieldMatrix<>(FractionField.getInstance(), new Fraction[][] { + FieldMatrix uRef = new Array2DRowFieldMatrix(FractionField.getInstance(), new Fraction[][] { { new Fraction(2), new Fraction(3), new Fraction(3) }, { new Fraction(0), new Fraction(-3), new Fraction(-1) }, { new Fraction(0), new Fraction(0), new Fraction(4) } }); - FieldMatrix pRef = new Array2DRowFieldMatrix<>(FractionField.getInstance(), new Fraction[][] { + FieldMatrix pRef = new Array2DRowFieldMatrix(FractionField.getInstance(), new Fraction[][] { { new Fraction(1), new Fraction(0), new Fraction(0) }, { new Fraction(0), new Fraction(0), new Fraction(1) }, { new Fraction(0), new Fraction(1), new Fraction(0) } diff --git a/src/test/java/org/apache/commons/math4/linear/FieldLUSolverTest.java b/src/test/java/org/apache/commons/math4/linear/FieldLUSolverTest.java index 70ad9716b..03662d863 100644 --- a/src/test/java/org/apache/commons/math4/linear/FieldLUSolverTest.java +++ b/src/test/java/org/apache/commons/math4/linear/FieldLUSolverTest.java @@ -58,7 +58,7 @@ public class FieldLUSolverTest { final int numRows = data.length; final int numCols = data[0].length; final Array2DRowFieldMatrix m; - m = new Array2DRowFieldMatrix<>(FractionField.getInstance(), + m = new Array2DRowFieldMatrix(FractionField.getInstance(), numRows, numCols); for (int i = 0; i < numRows; i++) { for (int j = 0; j < numCols; j++) { @@ -72,13 +72,13 @@ public class FieldLUSolverTest { @Test public void testSingular() { FieldDecompositionSolver solver; - solver = new FieldLUDecomposition<>(createFractionMatrix(testData)) + solver = new FieldLUDecomposition(createFractionMatrix(testData)) .getSolver(); Assert.assertTrue(solver.isNonSingular()); - solver = new FieldLUDecomposition<>(createFractionMatrix(singular)) + solver = new FieldLUDecomposition(createFractionMatrix(singular)) .getSolver(); Assert.assertFalse(solver.isNonSingular()); - solver = new FieldLUDecomposition<>(createFractionMatrix(bigSingular)) + solver = new FieldLUDecomposition(createFractionMatrix(bigSingular)) .getSolver(); Assert.assertFalse(solver.isNonSingular()); } @@ -87,7 +87,7 @@ public class FieldLUSolverTest { @Test public void testSolveDimensionErrors() { FieldDecompositionSolver solver; - solver = new FieldLUDecomposition<>(createFractionMatrix(testData)) + solver = new FieldLUDecomposition(createFractionMatrix(testData)) .getSolver(); FieldMatrix b = createFractionMatrix(new int[2][2]); try { @@ -108,7 +108,7 @@ public class FieldLUSolverTest { @Test public void testSolveSingularityErrors() { FieldDecompositionSolver solver; - solver = new FieldLUDecomposition<>(createFractionMatrix(singular)) + solver = new FieldLUDecomposition(createFractionMatrix(singular)) .getSolver(); FieldMatrix b = createFractionMatrix(new int[2][2]); try { @@ -129,7 +129,7 @@ public class FieldLUSolverTest { @Test public void testSolve() { FieldDecompositionSolver solver; - solver = new FieldLUDecomposition<>(createFractionMatrix(testData)) + solver = new FieldLUDecomposition(createFractionMatrix(testData)) .getSolver(); FieldMatrix b = createFractionMatrix(new int[][] { { 1, 0 }, { 2, -5 }, { 3, 1 } @@ -159,7 +159,7 @@ public class FieldLUSolverTest { // using SparseFieldVector for (int j = 0; j < b.getColumnDimension(); j++) { final SparseFieldVector bj; - bj = new SparseFieldVector<>(FractionField.getInstance(), + bj = new SparseFieldVector(FractionField.getInstance(), b.getColumn(j)); final FieldVector xj = solver.solve(bj); for (int i = 0; i < xj.getDimension(); i++) { @@ -179,6 +179,6 @@ public class FieldLUSolverTest { } private double getDeterminant(final FieldMatrix m) { - return new FieldLUDecomposition<>(m).getDeterminant().doubleValue(); + return new FieldLUDecomposition(m).getDeterminant().doubleValue(); } } diff --git a/src/test/java/org/apache/commons/math4/linear/FieldMatrixImplTest.java b/src/test/java/org/apache/commons/math4/linear/FieldMatrixImplTest.java index bd4ccf55e..4fb5bf467 100644 --- a/src/test/java/org/apache/commons/math4/linear/FieldMatrixImplTest.java +++ b/src/test/java/org/apache/commons/math4/linear/FieldMatrixImplTest.java @@ -109,8 +109,8 @@ public final class FieldMatrixImplTest { /** test dimensions */ @Test public void testDimensions() { - Array2DRowFieldMatrix m = new Array2DRowFieldMatrix<>(testData); - Array2DRowFieldMatrix m2 = new Array2DRowFieldMatrix<>(testData2); + Array2DRowFieldMatrix m = new Array2DRowFieldMatrix(testData); + Array2DRowFieldMatrix m2 = new Array2DRowFieldMatrix(testData2); Assert.assertEquals("testData row dimension",3,m.getRowDimension()); Assert.assertEquals("testData column dimension",3,m.getColumnDimension()); Assert.assertTrue("testData is square",m.isSquare()); @@ -122,19 +122,19 @@ public final class FieldMatrixImplTest { /** test copy functions */ @Test public void testCopyFunctions() { - Array2DRowFieldMatrix m1 = new Array2DRowFieldMatrix<>(testData); - Array2DRowFieldMatrix m2 = new Array2DRowFieldMatrix<>(m1.getData()); + Array2DRowFieldMatrix m1 = new Array2DRowFieldMatrix(testData); + Array2DRowFieldMatrix m2 = new Array2DRowFieldMatrix(m1.getData()); Assert.assertEquals(m2,m1); - Array2DRowFieldMatrix m3 = new Array2DRowFieldMatrix<>(testData); - Array2DRowFieldMatrix m4 = new Array2DRowFieldMatrix<>(m3.getData(), false); + Array2DRowFieldMatrix m3 = new Array2DRowFieldMatrix(testData); + Array2DRowFieldMatrix m4 = new Array2DRowFieldMatrix(m3.getData(), false); Assert.assertEquals(m4,m3); } /** test add */ @Test public void testAdd() { - Array2DRowFieldMatrix m = new Array2DRowFieldMatrix<>(testData); - Array2DRowFieldMatrix mInv = new Array2DRowFieldMatrix<>(testDataInv); + Array2DRowFieldMatrix m = new Array2DRowFieldMatrix(testData); + Array2DRowFieldMatrix mInv = new Array2DRowFieldMatrix(testDataInv); FieldMatrix mPlusMInv = m.add(mInv); Fraction[][] sumEntries = mPlusMInv.getData(); for (int row = 0; row < m.getRowDimension(); row++) { @@ -147,8 +147,8 @@ public final class FieldMatrixImplTest { /** test add failure */ @Test public void testAddFail() { - Array2DRowFieldMatrix m = new Array2DRowFieldMatrix<>(testData); - Array2DRowFieldMatrix m2 = new Array2DRowFieldMatrix<>(testData2); + Array2DRowFieldMatrix m = new Array2DRowFieldMatrix(testData); + Array2DRowFieldMatrix m2 = new Array2DRowFieldMatrix(testData2); try { m.add(m2); Assert.fail("MathIllegalArgumentException expected"); @@ -160,11 +160,11 @@ public final class FieldMatrixImplTest { /** test m-n = m + -n */ @Test public void testPlusMinus() { - Array2DRowFieldMatrix m = new Array2DRowFieldMatrix<>(testData); - Array2DRowFieldMatrix m2 = new Array2DRowFieldMatrix<>(testDataInv); + Array2DRowFieldMatrix m = new Array2DRowFieldMatrix(testData); + Array2DRowFieldMatrix m2 = new Array2DRowFieldMatrix(testDataInv); TestUtils.assertEquals(m.subtract(m2),m2.scalarMultiply(new Fraction(-1)).add(m)); try { - m.subtract(new Array2DRowFieldMatrix<>(testData2)); + m.subtract(new Array2DRowFieldMatrix(testData2)); Assert.fail("Expecting illegalArgumentException"); } catch (MathIllegalArgumentException ex) { // ignored @@ -174,17 +174,17 @@ public final class FieldMatrixImplTest { /** test multiply */ @Test public void testMultiply() { - Array2DRowFieldMatrix m = new Array2DRowFieldMatrix<>(testData); - Array2DRowFieldMatrix mInv = new Array2DRowFieldMatrix<>(testDataInv); - Array2DRowFieldMatrix identity = new Array2DRowFieldMatrix<>(id); - Array2DRowFieldMatrix m2 = new Array2DRowFieldMatrix<>(testData2); + Array2DRowFieldMatrix m = new Array2DRowFieldMatrix(testData); + Array2DRowFieldMatrix mInv = new Array2DRowFieldMatrix(testDataInv); + Array2DRowFieldMatrix identity = new Array2DRowFieldMatrix(id); + Array2DRowFieldMatrix m2 = new Array2DRowFieldMatrix(testData2); TestUtils.assertEquals(m.multiply(mInv), identity); TestUtils.assertEquals(mInv.multiply(m), identity); TestUtils.assertEquals(m.multiply(identity), m); TestUtils.assertEquals(identity.multiply(mInv), mInv); TestUtils.assertEquals(m2.multiply(identity), m2); try { - m.multiply(new Array2DRowFieldMatrix<>(bigSingular)); + m.multiply(new Array2DRowFieldMatrix(bigSingular)); Assert.fail("Expecting illegalArgumentException"); } catch (MathIllegalArgumentException ex) { // ignored @@ -199,18 +199,18 @@ public final class FieldMatrixImplTest { @Test public void testMultiply2() { - FieldMatrix m3 = new Array2DRowFieldMatrix<>(d3); - FieldMatrix m4 = new Array2DRowFieldMatrix<>(d4); - FieldMatrix m5 = new Array2DRowFieldMatrix<>(d5); + FieldMatrix m3 = new Array2DRowFieldMatrix(d3); + FieldMatrix m4 = new Array2DRowFieldMatrix(d4); + FieldMatrix m5 = new Array2DRowFieldMatrix(d5); TestUtils.assertEquals(m3.multiply(m4), m5); } @Test public void testPower() { - FieldMatrix m = new Array2DRowFieldMatrix<>(testData); - FieldMatrix mInv = new Array2DRowFieldMatrix<>(testDataInv); - FieldMatrix mPlusInv = new Array2DRowFieldMatrix<>(testDataPlusInv); - FieldMatrix identity = new Array2DRowFieldMatrix<>(id); + FieldMatrix m = new Array2DRowFieldMatrix(testData); + FieldMatrix mInv = new Array2DRowFieldMatrix(testDataInv); + FieldMatrix mPlusInv = new Array2DRowFieldMatrix(testDataPlusInv); + FieldMatrix identity = new Array2DRowFieldMatrix(id); TestUtils.assertEquals(m.power(0), identity); TestUtils.assertEquals(mInv.power(0), identity); @@ -236,7 +236,7 @@ public final class FieldMatrixImplTest { } try { - FieldMatrix mNotSquare = new Array2DRowFieldMatrix<>(testData2T); + FieldMatrix mNotSquare = new Array2DRowFieldMatrix(testData2T); mNotSquare.power(2); Assert.fail("Expecting NonSquareMatrixException"); } catch (NonSquareMatrixException ex) { @@ -254,9 +254,9 @@ public final class FieldMatrixImplTest { /** test trace */ @Test public void testTrace() { - FieldMatrix m = new Array2DRowFieldMatrix<>(id); + FieldMatrix m = new Array2DRowFieldMatrix(id); Assert.assertEquals("identity trace",new Fraction(3),m.getTrace()); - m = new Array2DRowFieldMatrix<>(testData2); + m = new Array2DRowFieldMatrix(testData2); try { m.getTrace(); Assert.fail("Expecting NonSquareMatrixException"); @@ -268,17 +268,17 @@ public final class FieldMatrixImplTest { /** test sclarAdd */ @Test public void testScalarAdd() { - FieldMatrix m = new Array2DRowFieldMatrix<>(testData); - TestUtils.assertEquals(new Array2DRowFieldMatrix<>(testDataPlus2), m.scalarAdd(new Fraction(2))); + FieldMatrix m = new Array2DRowFieldMatrix(testData); + TestUtils.assertEquals(new Array2DRowFieldMatrix(testDataPlus2), m.scalarAdd(new Fraction(2))); } /** test operate */ @Test public void testOperate() { - FieldMatrix m = new Array2DRowFieldMatrix<>(id); + FieldMatrix m = new Array2DRowFieldMatrix(id); TestUtils.assertEquals(testVector, m.operate(testVector)); - TestUtils.assertEquals(testVector, m.operate(new ArrayFieldVector<>(testVector)).toArray()); - m = new Array2DRowFieldMatrix<>(bigSingular); + TestUtils.assertEquals(testVector, m.operate(new ArrayFieldVector(testVector)).toArray()); + m = new Array2DRowFieldMatrix(bigSingular); try { m.operate(testVector); Assert.fail("Expecting illegalArgumentException"); @@ -290,7 +290,7 @@ public final class FieldMatrixImplTest { /** test issue MATH-209 */ @Test public void testMath209() { - FieldMatrix a = new Array2DRowFieldMatrix<>(new Fraction[][] { + FieldMatrix a = new Array2DRowFieldMatrix(new Fraction[][] { { new Fraction(1), new Fraction(2) }, { new Fraction(3), new Fraction(4) }, { new Fraction(5), new Fraction(6) } }, false); Fraction[] b = a.operate(new Fraction[] { new Fraction(1), new Fraction(1) }); @@ -303,23 +303,23 @@ public final class FieldMatrixImplTest { /** test transpose */ @Test public void testTranspose() { - FieldMatrix m = new Array2DRowFieldMatrix<>(testData); - FieldMatrix mIT = new FieldLUDecomposition<>(m).getSolver().getInverse().transpose(); - FieldMatrix mTI = new FieldLUDecomposition<>(m.transpose()).getSolver().getInverse(); + FieldMatrix m = new Array2DRowFieldMatrix(testData); + FieldMatrix mIT = new FieldLUDecomposition(m).getSolver().getInverse().transpose(); + FieldMatrix mTI = new FieldLUDecomposition(m.transpose()).getSolver().getInverse(); TestUtils.assertEquals(mIT, mTI); - m = new Array2DRowFieldMatrix<>(testData2); - FieldMatrix mt = new Array2DRowFieldMatrix<>(testData2T); + m = new Array2DRowFieldMatrix(testData2); + FieldMatrix mt = new Array2DRowFieldMatrix(testData2T); TestUtils.assertEquals(mt, m.transpose()); } /** test preMultiply by vector */ @Test public void testPremultiplyVector() { - FieldMatrix m = new Array2DRowFieldMatrix<>(testData); + FieldMatrix m = new Array2DRowFieldMatrix(testData); TestUtils.assertEquals(m.preMultiply(testVector), preMultTest); - TestUtils.assertEquals(m.preMultiply(new ArrayFieldVector<>(testVector).toArray()), + TestUtils.assertEquals(m.preMultiply(new ArrayFieldVector(testVector).toArray()), preMultTest); - m = new Array2DRowFieldMatrix<>(bigSingular); + m = new Array2DRowFieldMatrix(bigSingular); try { m.preMultiply(testVector); Assert.fail("expecting MathIllegalArgumentException"); @@ -330,20 +330,20 @@ public final class FieldMatrixImplTest { @Test public void testPremultiply() { - FieldMatrix m3 = new Array2DRowFieldMatrix<>(d3); - FieldMatrix m4 = new Array2DRowFieldMatrix<>(d4); - FieldMatrix m5 = new Array2DRowFieldMatrix<>(d5); + FieldMatrix m3 = new Array2DRowFieldMatrix(d3); + FieldMatrix m4 = new Array2DRowFieldMatrix(d4); + FieldMatrix m5 = new Array2DRowFieldMatrix(d5); TestUtils.assertEquals(m4.preMultiply(m3), m5); - Array2DRowFieldMatrix m = new Array2DRowFieldMatrix<>(testData); - Array2DRowFieldMatrix mInv = new Array2DRowFieldMatrix<>(testDataInv); - Array2DRowFieldMatrix identity = new Array2DRowFieldMatrix<>(id); + Array2DRowFieldMatrix m = new Array2DRowFieldMatrix(testData); + Array2DRowFieldMatrix mInv = new Array2DRowFieldMatrix(testDataInv); + Array2DRowFieldMatrix identity = new Array2DRowFieldMatrix(id); TestUtils.assertEquals(m.preMultiply(mInv), identity); TestUtils.assertEquals(mInv.preMultiply(m), identity); TestUtils.assertEquals(m.preMultiply(identity), m); TestUtils.assertEquals(identity.preMultiply(mInv), mInv); try { - m.preMultiply(new Array2DRowFieldMatrix<>(bigSingular)); + m.preMultiply(new Array2DRowFieldMatrix(bigSingular)); Assert.fail("Expecting illegalArgumentException"); } catch (MathIllegalArgumentException ex) { // ignored @@ -352,7 +352,7 @@ public final class FieldMatrixImplTest { @Test public void testGetVectors() { - FieldMatrix m = new Array2DRowFieldMatrix<>(testData); + FieldMatrix m = new Array2DRowFieldMatrix(testData); TestUtils.assertEquals(m.getRow(0), testDataRow1); TestUtils.assertEquals(m.getColumn(2), testDataCol3); try { @@ -371,7 +371,7 @@ public final class FieldMatrixImplTest { @Test public void testGetEntry() { - FieldMatrix m = new Array2DRowFieldMatrix<>(testData); + FieldMatrix m = new Array2DRowFieldMatrix(testData); Assert.assertEquals("get entry", m.getEntry(0,1), new Fraction(2)); try { m.getEntry(10, 4); @@ -389,20 +389,20 @@ public final class FieldMatrixImplTest { {new Fraction(1),new Fraction(2),new Fraction(3)}, {new Fraction(2),new Fraction(5),new Fraction(3)} }; - FieldMatrix m = new Array2DRowFieldMatrix<>(matrixData); + FieldMatrix m = new Array2DRowFieldMatrix(matrixData); // One more with three rows, two columns Fraction[][] matrixData2 = { {new Fraction(1),new Fraction(2)}, {new Fraction(2),new Fraction(5)}, {new Fraction(1), new Fraction(7)} }; - FieldMatrix n = new Array2DRowFieldMatrix<>(matrixData2); + FieldMatrix n = new Array2DRowFieldMatrix(matrixData2); // Now multiply m by n FieldMatrix p = m.multiply(n); Assert.assertEquals(2, p.getRowDimension()); Assert.assertEquals(2, p.getColumnDimension()); // Invert p - FieldMatrix pInverse = new FieldLUDecomposition<>(p).getSolver().getInverse(); + FieldMatrix pInverse = new FieldLUDecomposition(p).getSolver().getInverse(); Assert.assertEquals(2, pInverse.getRowDimension()); Assert.assertEquals(2, pInverse.getColumnDimension()); @@ -412,14 +412,14 @@ public final class FieldMatrixImplTest { {new Fraction(-1), new Fraction(7), new Fraction(6)}, {new Fraction(4), new Fraction(-3), new Fraction(-5)} }; - FieldMatrix coefficients = new Array2DRowFieldMatrix<>(coefficientsData); + FieldMatrix coefficients = new Array2DRowFieldMatrix(coefficientsData); Fraction[] constants = { new Fraction(1), new Fraction(-2), new Fraction(1) }; Fraction[] solution; - solution = new FieldLUDecomposition<>(coefficients) + solution = new FieldLUDecomposition(coefficients) .getSolver() - .solve(new ArrayFieldVector<>(constants, false)).toArray(); + .solve(new ArrayFieldVector(constants, false)).toArray(); Assert.assertEquals(new Fraction(2).multiply(solution[0]). add(new Fraction(3).multiply(solution[1])). subtract(new Fraction(2).multiply(solution[2])), constants[0]); @@ -435,7 +435,7 @@ public final class FieldMatrixImplTest { // test submatrix accessors @Test public void testGetSubMatrix() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); checkGetSubMatrix(m, subRows23Cols00, 2 , 3 , 0, 0); checkGetSubMatrix(m, subRows00Cols33, 0 , 0 , 3, 3); checkGetSubMatrix(m, subRows01Cols23, 0 , 1 , 2, 3); @@ -458,7 +458,7 @@ public final class FieldMatrixImplTest { try { FieldMatrix sub = m.getSubMatrix(startRow, endRow, startColumn, endColumn); if (reference != null) { - Assert.assertEquals(new Array2DRowFieldMatrix<>(reference), sub); + Assert.assertEquals(new Array2DRowFieldMatrix(reference), sub); } else { Assert.fail("Expecting OutOfRangeException or NotStrictlyPositiveException" + " or NumberIsTooSmallException or NoDataException"); @@ -487,7 +487,7 @@ public final class FieldMatrixImplTest { try { FieldMatrix sub = m.getSubMatrix(selectedRows, selectedColumns); if (reference != null) { - Assert.assertEquals(new Array2DRowFieldMatrix<>(reference), sub); + Assert.assertEquals(new Array2DRowFieldMatrix(reference), sub); } else { Assert.fail("Expecting OutOfRangeException or NotStrictlyPositiveException" + " or NumberIsTooSmallException or NoDataException"); @@ -513,7 +513,7 @@ public final class FieldMatrixImplTest { @Test public void testCopySubMatrix() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); checkCopy(m, subRows23Cols00, 2 , 3 , 0, 0); checkCopy(m, subRows00Cols33, 0 , 0 , 3, 3); checkCopy(m, subRows01Cols23, 0 , 1 , 2, 3); @@ -540,7 +540,7 @@ public final class FieldMatrixImplTest { new Fraction[reference.length][reference[0].length]; m.copySubMatrix(startRow, endRow, startColumn, endColumn, sub); if (reference != null) { - Assert.assertEquals(new Array2DRowFieldMatrix<>(reference), new Array2DRowFieldMatrix<>(sub)); + Assert.assertEquals(new Array2DRowFieldMatrix(reference), new Array2DRowFieldMatrix(sub)); } else { Assert.fail("Expecting OutOfRangeException or NumberIsTooSmallException or NoDataException"); } @@ -567,7 +567,7 @@ public final class FieldMatrixImplTest { new Fraction[reference.length][reference[0].length]; m.copySubMatrix(selectedRows, selectedColumns, sub); if (reference != null) { - Assert.assertEquals(new Array2DRowFieldMatrix<>(reference), new Array2DRowFieldMatrix<>(sub)); + Assert.assertEquals(new Array2DRowFieldMatrix(reference), new Array2DRowFieldMatrix(sub)); } else { Assert.fail("Expecting OutOfRangeException or NumberIsTooSmallException or NoDataException"); } @@ -588,9 +588,9 @@ public final class FieldMatrixImplTest { @Test public void testGetRowMatrix() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); - FieldMatrix mRow0 = new Array2DRowFieldMatrix<>(subRow0); - FieldMatrix mRow3 = new Array2DRowFieldMatrix<>(subRow3); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); + FieldMatrix mRow0 = new Array2DRowFieldMatrix(subRow0); + FieldMatrix mRow3 = new Array2DRowFieldMatrix(subRow3); Assert.assertEquals("Row0", mRow0, m.getRowMatrix(0)); Assert.assertEquals("Row3", mRow3, @@ -611,8 +611,8 @@ public final class FieldMatrixImplTest { @Test public void testSetRowMatrix() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); - FieldMatrix mRow3 = new Array2DRowFieldMatrix<>(subRow3); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); + FieldMatrix mRow3 = new Array2DRowFieldMatrix(subRow3); Assert.assertNotSame(mRow3, m.getRowMatrix(0)); m.setRowMatrix(0, mRow3); Assert.assertEquals(mRow3, m.getRowMatrix(0)); @@ -632,9 +632,9 @@ public final class FieldMatrixImplTest { @Test public void testGetColumnMatrix() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); - FieldMatrix mColumn1 = new Array2DRowFieldMatrix<>(subColumn1); - FieldMatrix mColumn3 = new Array2DRowFieldMatrix<>(subColumn3); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); + FieldMatrix mColumn1 = new Array2DRowFieldMatrix(subColumn1); + FieldMatrix mColumn3 = new Array2DRowFieldMatrix(subColumn3); Assert.assertEquals("Column1", mColumn1, m.getColumnMatrix(1)); Assert.assertEquals("Column3", mColumn3, @@ -655,8 +655,8 @@ public final class FieldMatrixImplTest { @Test public void testSetColumnMatrix() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); - FieldMatrix mColumn3 = new Array2DRowFieldMatrix<>(subColumn3); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); + FieldMatrix mColumn3 = new Array2DRowFieldMatrix(subColumn3); Assert.assertNotSame(mColumn3, m.getColumnMatrix(1)); m.setColumnMatrix(1, mColumn3); Assert.assertEquals(mColumn3, m.getColumnMatrix(1)); @@ -676,9 +676,9 @@ public final class FieldMatrixImplTest { @Test public void testGetRowVector() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); - FieldVector mRow0 = new ArrayFieldVector<>(subRow0[0]); - FieldVector mRow3 = new ArrayFieldVector<>(subRow3[0]); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); + FieldVector mRow0 = new ArrayFieldVector(subRow0[0]); + FieldVector mRow3 = new ArrayFieldVector(subRow3[0]); Assert.assertEquals("Row0", mRow0, m.getRowVector(0)); Assert.assertEquals("Row3", mRow3, m.getRowVector(3)); try { @@ -697,8 +697,8 @@ public final class FieldMatrixImplTest { @Test public void testSetRowVector() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); - FieldVector mRow3 = new ArrayFieldVector<>(subRow3[0]); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); + FieldVector mRow3 = new ArrayFieldVector(subRow3[0]); Assert.assertNotSame(mRow3, m.getRowMatrix(0)); m.setRowVector(0, mRow3); Assert.assertEquals(mRow3, m.getRowVector(0)); @@ -709,7 +709,7 @@ public final class FieldMatrixImplTest { // expected } try { - m.setRowVector(0, new ArrayFieldVector<>(FractionField.getInstance(), 5)); + m.setRowVector(0, new ArrayFieldVector(FractionField.getInstance(), 5)); Assert.fail("Expecting MatrixDimensionMismatchException"); } catch (MatrixDimensionMismatchException ex) { // expected @@ -718,7 +718,7 @@ public final class FieldMatrixImplTest { @Test public void testGetColumnVector() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); FieldVector mColumn1 = columnToVector(subColumn1); FieldVector mColumn3 = columnToVector(subColumn3); Assert.assertEquals("Column1", mColumn1, m.getColumnVector(1)); @@ -739,7 +739,7 @@ public final class FieldMatrixImplTest { @Test public void testSetColumnVector() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); FieldVector mColumn3 = columnToVector(subColumn3); Assert.assertNotSame(mColumn3, m.getColumnVector(1)); m.setColumnVector(1, mColumn3); @@ -751,7 +751,7 @@ public final class FieldMatrixImplTest { // expected } try { - m.setColumnVector(0, new ArrayFieldVector<>(FractionField.getInstance(), 5)); + m.setColumnVector(0, new ArrayFieldVector(FractionField.getInstance(), 5)); Assert.fail("Expecting MatrixDimensionMismatchException"); } catch (MatrixDimensionMismatchException ex) { // expected @@ -763,12 +763,12 @@ public final class FieldMatrixImplTest { for (int i = 0; i < data.length; ++i) { data[i] = column[i][0]; } - return new ArrayFieldVector<>(data, false); + return new ArrayFieldVector(data, false); } @Test public void testGetRow() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); checkArrays(subRow0[0], m.getRow(0)); checkArrays(subRow3[0], m.getRow(3)); try { @@ -787,7 +787,7 @@ public final class FieldMatrixImplTest { @Test public void testSetRow() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); Assert.assertTrue(subRow3[0][0] != m.getRow(0)[0]); m.setRow(0, subRow3[0]); checkArrays(subRow3[0], m.getRow(0)); @@ -807,7 +807,7 @@ public final class FieldMatrixImplTest { @Test public void testGetColumn() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); Fraction[] mColumn1 = columnToArray(subColumn1); Fraction[] mColumn3 = columnToArray(subColumn3); checkArrays(mColumn1, m.getColumn(1)); @@ -828,7 +828,7 @@ public final class FieldMatrixImplTest { @Test public void testSetColumn() { - FieldMatrix m = new Array2DRowFieldMatrix<>(subTestData); + FieldMatrix m = new Array2DRowFieldMatrix(subTestData); Fraction[] mColumn3 = columnToArray(subColumn3); Assert.assertTrue(mColumn3[0] != m.getColumn(1)[0]); m.setColumn(1, mColumn3); @@ -864,7 +864,7 @@ public final class FieldMatrixImplTest { @Test public void testEqualsAndHashCode() { - Array2DRowFieldMatrix m = new Array2DRowFieldMatrix<>(testData); + Array2DRowFieldMatrix m = new Array2DRowFieldMatrix(testData); Array2DRowFieldMatrix m1 = (Array2DRowFieldMatrix) m.copy(); Array2DRowFieldMatrix mt = (Array2DRowFieldMatrix) m.transpose(); Assert.assertTrue(m.hashCode() != mt.hashCode()); @@ -873,22 +873,22 @@ public final class FieldMatrixImplTest { Assert.assertEquals(m, m1); Assert.assertFalse(m.equals(null)); Assert.assertFalse(m.equals(mt)); - Assert.assertFalse(m.equals(new Array2DRowFieldMatrix<>(bigSingular))); + Assert.assertFalse(m.equals(new Array2DRowFieldMatrix(bigSingular))); } @Test public void testToString() { - Array2DRowFieldMatrix m = new Array2DRowFieldMatrix<>(testData); + Array2DRowFieldMatrix m = new Array2DRowFieldMatrix(testData); Assert.assertEquals("Array2DRowFieldMatrix{{1,2,3},{2,5,3},{1,0,8}}", m.toString()); - m = new Array2DRowFieldMatrix<>(FractionField.getInstance()); + m = new Array2DRowFieldMatrix(FractionField.getInstance()); Assert.assertEquals("Array2DRowFieldMatrix{}", m.toString()); } @Test public void testSetSubMatrix() { - Array2DRowFieldMatrix m = new Array2DRowFieldMatrix<>(testData); + Array2DRowFieldMatrix m = new Array2DRowFieldMatrix(testData); m.setSubMatrix(detData2,1,1); - FieldMatrix expected = new Array2DRowFieldMatrix<> + FieldMatrix expected = new Array2DRowFieldMatrix (new Fraction[][] { {new Fraction(1),new Fraction(2),new Fraction(3)}, {new Fraction(2),new Fraction(1),new Fraction(3)}, @@ -897,7 +897,7 @@ public final class FieldMatrixImplTest { Assert.assertEquals(expected, m); m.setSubMatrix(detData2,0,0); - expected = new Array2DRowFieldMatrix<> + expected = new Array2DRowFieldMatrix (new Fraction[][] { {new Fraction(1),new Fraction(3),new Fraction(3)}, {new Fraction(2),new Fraction(4),new Fraction(3)}, @@ -906,7 +906,7 @@ public final class FieldMatrixImplTest { Assert.assertEquals(expected, m); m.setSubMatrix(testDataPlus2,0,0); - expected = new Array2DRowFieldMatrix<> + expected = new Array2DRowFieldMatrix (new Fraction[][] { {new Fraction(3),new Fraction(4),new Fraction(5)}, {new Fraction(4),new Fraction(7),new Fraction(5)}, @@ -942,7 +942,7 @@ public final class FieldMatrixImplTest { } catch (NullArgumentException e) { // expected } - Array2DRowFieldMatrix m2 = new Array2DRowFieldMatrix<>(FractionField.getInstance()); + Array2DRowFieldMatrix m2 = new Array2DRowFieldMatrix(FractionField.getInstance()); try { m2.setSubMatrix(testData,0,1); Assert.fail("expecting MathIllegalStateException"); @@ -980,13 +980,13 @@ public final class FieldMatrixImplTest { int columns = 75; FieldMatrix m = - new Array2DRowFieldMatrix<>(FractionField.getInstance(), rows, columns); + new Array2DRowFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInRowOrder(new SetVisitor()); GetVisitor getVisitor = new GetVisitor(); m.walkInOptimizedOrder(getVisitor); Assert.assertEquals(rows * columns, getVisitor.getCount()); - m = new Array2DRowFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new Array2DRowFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInRowOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2); getVisitor = new GetVisitor(); m.walkInOptimizedOrder(getVisitor, 1, rows - 2, 1, columns - 2); @@ -1000,13 +1000,13 @@ public final class FieldMatrixImplTest { Assert.assertEquals(new Fraction(0), m.getEntry(rows - 1, j)); } - m = new Array2DRowFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new Array2DRowFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInColumnOrder(new SetVisitor()); getVisitor = new GetVisitor(); m.walkInOptimizedOrder(getVisitor); Assert.assertEquals(rows * columns, getVisitor.getCount()); - m = new Array2DRowFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new Array2DRowFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInColumnOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2); getVisitor = new GetVisitor(); m.walkInOptimizedOrder(getVisitor, 1, rows - 2, 1, columns - 2); @@ -1020,13 +1020,13 @@ public final class FieldMatrixImplTest { Assert.assertEquals(new Fraction(0), m.getEntry(rows - 1, j)); } - m = new Array2DRowFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new Array2DRowFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInOptimizedOrder(new SetVisitor()); getVisitor = new GetVisitor(); m.walkInRowOrder(getVisitor); Assert.assertEquals(rows * columns, getVisitor.getCount()); - m = new Array2DRowFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new Array2DRowFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInOptimizedOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2); getVisitor = new GetVisitor(); m.walkInRowOrder(getVisitor, 1, rows - 2, 1, columns - 2); @@ -1040,13 +1040,13 @@ public final class FieldMatrixImplTest { Assert.assertEquals(new Fraction(0), m.getEntry(rows - 1, j)); } - m = new Array2DRowFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new Array2DRowFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInOptimizedOrder(new SetVisitor()); getVisitor = new GetVisitor(); m.walkInColumnOrder(getVisitor); Assert.assertEquals(rows * columns, getVisitor.getCount()); - m = new Array2DRowFieldMatrix<>(FractionField.getInstance(), rows, columns); + m = new Array2DRowFieldMatrix(FractionField.getInstance(), rows, columns); m.walkInOptimizedOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2); getVisitor = new GetVisitor(); m.walkInColumnOrder(getVisitor, 1, rows - 2, 1, columns - 2); @@ -1063,7 +1063,7 @@ public final class FieldMatrixImplTest { @Test public void testSerial() { - Array2DRowFieldMatrix m = new Array2DRowFieldMatrix<>(testData); + Array2DRowFieldMatrix m = new Array2DRowFieldMatrix(testData); Assert.assertEquals(m,TestUtils.serializeAndRecover(m)); } @@ -1148,6 +1148,6 @@ public final class FieldMatrixImplTest { out[i][j] = matrix.getEntry(permutation[i], j); } } - return new Array2DRowFieldMatrix<>(out); + return new Array2DRowFieldMatrix(out); } } diff --git a/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java b/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java index c8bd3f910..b547cdc03 100644 --- a/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java +++ b/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java @@ -104,9 +104,9 @@ public final class MatrixUtilsTest { @Test public void testcreateFieldMatrix() { - Assert.assertEquals(new Array2DRowFieldMatrix<>(asFraction(testData)), + Assert.assertEquals(new Array2DRowFieldMatrix(asFraction(testData)), MatrixUtils.createFieldMatrix(asFraction(testData))); - Assert.assertEquals(new Array2DRowFieldMatrix<>(FractionField.getInstance(), fractionColMatrix), + Assert.assertEquals(new Array2DRowFieldMatrix(FractionField.getInstance(), fractionColMatrix), MatrixUtils.createFieldMatrix(fractionColMatrix)); try { MatrixUtils.createFieldMatrix(asFraction(new double[][] {{1}, {1,2}})); // ragged @@ -149,9 +149,9 @@ public final class MatrixUtilsTest { @Test public void testCreateRowFieldMatrix() { Assert.assertEquals(MatrixUtils.createRowFieldMatrix(asFraction(row)), - new Array2DRowFieldMatrix<>(asFraction(rowMatrix))); + new Array2DRowFieldMatrix(asFraction(rowMatrix))); Assert.assertEquals(MatrixUtils.createRowFieldMatrix(fractionRow), - new Array2DRowFieldMatrix<>(fractionRowMatrix)); + new Array2DRowFieldMatrix(fractionRowMatrix)); try { MatrixUtils.createRowFieldMatrix(new Fraction[] {}); // empty Assert.fail("Expecting MathIllegalArgumentException"); @@ -187,9 +187,9 @@ public final class MatrixUtilsTest { @Test public void testCreateColumnFieldMatrix() { Assert.assertEquals(MatrixUtils.createColumnFieldMatrix(asFraction(col)), - new Array2DRowFieldMatrix<>(asFraction(colMatrix))); + new Array2DRowFieldMatrix(asFraction(colMatrix))); Assert.assertEquals(MatrixUtils.createColumnFieldMatrix(fractionCol), - new Array2DRowFieldMatrix<>(fractionColMatrix)); + new Array2DRowFieldMatrix(fractionColMatrix)); try { MatrixUtils.createColumnFieldMatrix(new Fraction[] {}); // empty @@ -268,7 +268,7 @@ public final class MatrixUtilsTest { { new BigFraction(2), new BigFraction(5), new BigFraction(3) }, { new BigFraction(1), new BigFraction(0), new BigFraction(8) } }; - FieldMatrix m = new Array2DRowFieldMatrix<>(bfData, false); + FieldMatrix m = new Array2DRowFieldMatrix(bfData, false); RealMatrix converted = MatrixUtils.bigFractionMatrixToRealMatrix(m); RealMatrix reference = new Array2DRowRealMatrix(testData, false); Assert.assertEquals(0.0, converted.subtract(reference).getNorm(), 0.0); @@ -281,7 +281,7 @@ public final class MatrixUtilsTest { { new Fraction(2), new Fraction(5), new Fraction(3) }, { new Fraction(1), new Fraction(0), new Fraction(8) } }; - FieldMatrix m = new Array2DRowFieldMatrix<>(fData, false); + FieldMatrix m = new Array2DRowFieldMatrix(fData, false); RealMatrix converted = MatrixUtils.fractionMatrixToRealMatrix(m); RealMatrix reference = new Array2DRowRealMatrix(testData, false); Assert.assertEquals(0.0, converted.subtract(reference).getNorm(), 0.0); diff --git a/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java b/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java index 0266b305d..176b227aa 100644 --- a/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java +++ b/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java @@ -209,7 +209,7 @@ public class SparseFieldMatrixTest { SparseFieldMatrix m2 = createSparseMatrix(testData2); assertClose("inverse multiply", m.multiply(mInv), identity, entryTolerance); - assertClose("inverse multiply", m.multiply(new Array2DRowFieldMatrix<>(FractionField.getInstance(), testDataInv)), identity, + assertClose("inverse multiply", m.multiply(new Array2DRowFieldMatrix(FractionField.getInstance(), testDataInv)), identity, entryTolerance); assertClose("inverse multiply", mInv.multiply(m), identity, entryTolerance); @@ -270,7 +270,7 @@ public class SparseFieldMatrixTest { assertClose("identity operate", testVector, m.operate(testVector), entryTolerance); assertClose("identity operate", testVector, m.operate( - new ArrayFieldVector<>(testVector)).toArray(), entryTolerance); + new ArrayFieldVector(testVector)).toArray(), entryTolerance); m = createSparseMatrix(bigSingular); try { m.operate(testVector); @@ -296,8 +296,8 @@ public class SparseFieldMatrixTest { @Test public void testTranspose() { FieldMatrix m = createSparseMatrix(testData); - FieldMatrix mIT = new FieldLUDecomposition<>(m).getSolver().getInverse().transpose(); - FieldMatrix mTI = new FieldLUDecomposition<>(m.transpose()).getSolver().getInverse(); + FieldMatrix mIT = new FieldLUDecomposition(m).getSolver().getInverse().transpose(); + FieldMatrix mTI = new FieldLUDecomposition(m.transpose()).getSolver().getInverse(); assertClose("inverse-transpose", mIT, mTI, normTolerance); m = createSparseMatrix(testData2); FieldMatrix mt = createSparseMatrix(testData2T); @@ -311,7 +311,7 @@ public class SparseFieldMatrixTest { assertClose("premultiply", m.preMultiply(testVector), preMultTest, normTolerance); assertClose("premultiply", m.preMultiply( - new ArrayFieldVector<>(testVector).toArray()), preMultTest, normTolerance); + new ArrayFieldVector(testVector).toArray()), preMultTest, normTolerance); m = createSparseMatrix(bigSingular); try { m.preMultiply(testVector); @@ -392,7 +392,7 @@ public class SparseFieldMatrixTest { Assert.assertEquals(2, p.getRowDimension()); Assert.assertEquals(2, p.getColumnDimension()); // Invert p - FieldMatrix pInverse = new FieldLUDecomposition<>(p).getSolver().getInverse(); + FieldMatrix pInverse = new FieldLUDecomposition(p).getSolver().getInverse(); Assert.assertEquals(2, pInverse.getRowDimension()); Assert.assertEquals(2, pInverse.getColumnDimension()); @@ -402,9 +402,9 @@ public class SparseFieldMatrixTest { FieldMatrix coefficients = createSparseMatrix(coefficientsData); Fraction[] constants = { new Fraction(1), new Fraction(-2), new Fraction(1) }; Fraction[] solution; - solution = new FieldLUDecomposition<>(coefficients) + solution = new FieldLUDecomposition(coefficients) .getSolver() - .solve(new ArrayFieldVector<>(constants, false)).toArray(); + .solve(new ArrayFieldVector(constants, false)).toArray(); Assert.assertEquals((new Fraction(2).multiply((solution[0])).add(new Fraction(3).multiply(solution[1])).subtract(new Fraction(2).multiply(solution[2]))).doubleValue(), constants[0].doubleValue(), 1E-12); Assert.assertEquals(((new Fraction(-1).multiply(solution[0])).add(new Fraction(7).multiply(solution[1])).add(new Fraction(6).multiply(solution[2]))).doubleValue(), @@ -525,8 +525,8 @@ public class SparseFieldMatrixTest { @Test public void testGetRowVector() { FieldMatrix m = createSparseMatrix(subTestData); - FieldVector mRow0 = new ArrayFieldVector<>(subRow0[0]); - FieldVector mRow3 = new ArrayFieldVector<>(subRow3[0]); + FieldVector mRow0 = new ArrayFieldVector(subRow0[0]); + FieldVector mRow3 = new ArrayFieldVector(subRow3[0]); Assert.assertEquals("Row0", mRow0, m.getRowVector(0)); Assert.assertEquals("Row3", mRow3, m.getRowVector(3)); try { @@ -569,7 +569,7 @@ public class SparseFieldMatrixTest { for (int i = 0; i < data.length; ++i) { data[i] = column[i][0]; } - return new ArrayFieldVector<>(data, false); + return new ArrayFieldVector(data, false); } @Test @@ -653,7 +653,7 @@ public class SparseFieldMatrixTest { // expected } try { - new SparseFieldMatrix<>(field, 0, 0); + new SparseFieldMatrix(field, 0, 0); Assert.fail("expecting MathIllegalArgumentException"); } catch (MathIllegalArgumentException e) { // expected @@ -702,7 +702,7 @@ public class SparseFieldMatrixTest { } private SparseFieldMatrix createSparseMatrix(Fraction[][] data) { - SparseFieldMatrix matrix = new SparseFieldMatrix<>(field, data.length, data[0].length); + SparseFieldMatrix matrix = new SparseFieldMatrix(field, data.length, data[0].length); for (int row = 0; row < data.length; row++) { for (int col = 0; col < data[row].length; col++) { matrix.setEntry(row, col, data[row][col]); diff --git a/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java b/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java index 5df1142e2..3a607f463 100644 --- a/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java +++ b/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java @@ -58,7 +58,7 @@ public class SparseFieldVectorTest { @Test public void testMapFunctions() throws FractionConversionException { - SparseFieldVector v1 = new SparseFieldVector<>(field,vec1); + SparseFieldVector v1 = new SparseFieldVector(field,vec1); //octave = v1 .+ 2.0 FieldVector v_mapAdd = v1.mapAdd(new Fraction(2)); @@ -120,17 +120,17 @@ public class SparseFieldVectorTest { @Test public void testBasicFunctions() throws FractionConversionException { - SparseFieldVector v1 = new SparseFieldVector<>(field,vec1); - SparseFieldVector v2 = new SparseFieldVector<>(field,vec2); + SparseFieldVector v1 = new SparseFieldVector(field,vec1); + SparseFieldVector v2 = new SparseFieldVector(field,vec2); - FieldVector v2_t = new ArrayFieldVectorTest.FieldVectorTestImpl<>(vec2); + FieldVector v2_t = new ArrayFieldVectorTest.FieldVectorTestImpl(vec2); //octave = v1 + v2 FieldVector v_add = v1.add(v2); Fraction[] result_add = {new Fraction(5), new Fraction(7), new Fraction(9)}; Assert.assertArrayEquals("compare vect" ,v_add.toArray(),result_add); - FieldVector vt2 = new ArrayFieldVectorTest.FieldVectorTestImpl<>(vec2); + FieldVector vt2 = new ArrayFieldVectorTest.FieldVectorTestImpl(vec2); FieldVector v_add_i = v1.add(vt2); Fraction[] result_add_i = {new Fraction(5), new Fraction(7), new Fraction(9)}; Assert.assertArrayEquals("compare vect" ,v_add_i.toArray(),result_add_i); @@ -181,12 +181,12 @@ public class SparseFieldVectorTest { @Test public void testOuterProduct() { final SparseFieldVector u - = new SparseFieldVector<>(FractionField.getInstance(), + = new SparseFieldVector(FractionField.getInstance(), new Fraction[] {new Fraction(1), new Fraction(2), new Fraction(-3)}); final SparseFieldVector v - = new SparseFieldVector<>(FractionField.getInstance(), + = new SparseFieldVector(FractionField.getInstance(), new Fraction[] {new Fraction(4), new Fraction(-2)}); @@ -203,7 +203,7 @@ public class SparseFieldVectorTest { @Test public void testMisc() { - SparseFieldVector v1 = new SparseFieldVector<>(field,vec1); + SparseFieldVector v1 = new SparseFieldVector(field,vec1); String out1 = v1.toString(); Assert.assertTrue("some output ", out1.length()!=0); @@ -220,11 +220,11 @@ public class SparseFieldVectorTest { @Test public void testPredicates() { - SparseFieldVector v = new SparseFieldVector<>(field, new Fraction[] { new Fraction(0), new Fraction(1), new Fraction(2) }); + SparseFieldVector v = new SparseFieldVector(field, new Fraction[] { new Fraction(0), new Fraction(1), new Fraction(2) }); v.setEntry(0, field.getZero()); - Assert.assertEquals(v, new SparseFieldVector<>(field, new Fraction[] { new Fraction(0), new Fraction(1), new Fraction(2) })); - Assert.assertNotSame(v, new SparseFieldVector<>(field, new Fraction[] { new Fraction(0), new Fraction(1), new Fraction(2), new Fraction(3) })); + Assert.assertEquals(v, new SparseFieldVector(field, new Fraction[] { new Fraction(0), new Fraction(1), new Fraction(2) })); + Assert.assertNotSame(v, new SparseFieldVector(field, new Fraction[] { new Fraction(0), new Fraction(1), new Fraction(2), new Fraction(3) })); } @@ -260,7 +260,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector v = new SparseFieldVector<>(field, data); + final SparseFieldVector v = new SparseFieldVector(field, data); final FieldVectorPreservingVisitor visitor; visitor = new FieldVectorPreservingVisitor() { @@ -347,7 +347,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector v = new SparseFieldVector<>(field, data); + final SparseFieldVector v = new SparseFieldVector(field, data); final int expectedStart = 2; final int expectedEnd = 7; final FieldVectorPreservingVisitor visitor; @@ -385,7 +385,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector v = new SparseFieldVector<>(field, data); + final SparseFieldVector v = new SparseFieldVector(field, data); final FieldVectorPreservingVisitor visitor; visitor = new FieldVectorPreservingVisitor() { private final boolean[] visited = new boolean[data.length]; @@ -474,7 +474,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector v = new SparseFieldVector<>(field, data); + final SparseFieldVector v = new SparseFieldVector(field, data); final int expectedStart = 2; final int expectedEnd = 7; final FieldVectorPreservingVisitor visitor; @@ -514,7 +514,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector v = new SparseFieldVector<>(field, data); + final SparseFieldVector v = new SparseFieldVector(field, data); final FieldVectorChangingVisitor visitor; visitor = new FieldVectorChangingVisitor() { @@ -605,7 +605,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector v = new SparseFieldVector<>(field, data); + final SparseFieldVector v = new SparseFieldVector(field, data); final int expectedStart = 2; final int expectedEnd = 7; final FieldVectorChangingVisitor visitor; @@ -647,7 +647,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector v = new SparseFieldVector<>(field, data); + final SparseFieldVector v = new SparseFieldVector(field, data); final FieldVectorChangingVisitor visitor; visitor = new FieldVectorChangingVisitor() { private final boolean[] visited = new boolean[data.length]; @@ -740,7 +740,7 @@ public class SparseFieldVectorTest { Fraction.ZERO, Fraction.TWO, Fraction.ZERO, Fraction.ZERO, Fraction.ZERO, new Fraction(3) }; - final SparseFieldVector v = new SparseFieldVector<>(field, data); + final SparseFieldVector v = new SparseFieldVector(field, data); final int expectedStart = 2; final int expectedEnd = 7; final FieldVectorChangingVisitor visitor; @@ -781,6 +781,6 @@ public class SparseFieldVectorTest { for (int i = 0; i < n; ++i) { t[i] = Fraction.ZERO; } - return new SparseFieldVector<>(field, t); + return new SparseFieldVector(field, t); } } diff --git a/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java b/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java index 121789e38..993080143 100644 --- a/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java +++ b/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java @@ -53,7 +53,7 @@ public abstract class UnmodifiableRealVectorAbstractTest { * The list of methods which are excluded from the general test * {@link #testAllButExcluded()}. */ - protected static final Set EXCLUDE = new HashSet<>(); + protected static final Set EXCLUDE = new HashSet(); /** The random number generator (always initialized with the same seed. */ protected static final Random RANDOM; diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java index e3413a709..0820fbc58 100644 --- a/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java +++ b/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java @@ -99,7 +99,7 @@ public class DBSCANClustererTest { }; final DBSCANClusterer transformer = - new DBSCANClusterer<>(2.0, 5); + new DBSCANClusterer(2.0, 5); final List> clusters = transformer.cluster(Arrays.asList(points)); final List clusterOne = @@ -152,7 +152,7 @@ public class DBSCANClustererTest { }; - final DBSCANClusterer clusterer = new DBSCANClusterer<>(3, 3); + final DBSCANClusterer clusterer = new DBSCANClusterer(3, 3); List> clusters = clusterer.cluster(Arrays.asList(points)); Assert.assertEquals(1, clusters.size()); @@ -164,13 +164,13 @@ public class DBSCANClustererTest { @Test public void testGetEps() { - final DBSCANClusterer transformer = new DBSCANClusterer<>(2.0, 5); + final DBSCANClusterer transformer = new DBSCANClusterer(2.0, 5); Assert.assertEquals(2.0, transformer.getEps(), 0.0); } @Test public void testGetMinPts() { - final DBSCANClusterer transformer = new DBSCANClusterer<>(2.0, 5); + final DBSCANClusterer transformer = new DBSCANClusterer(2.0, 5); Assert.assertEquals(5, transformer.getMinPts()); } @@ -186,7 +186,7 @@ public class DBSCANClustererTest { @Test(expected = NullArgumentException.class) public void testNullDataset() { - DBSCANClusterer clusterer = new DBSCANClusterer<>(2.0, 5); + DBSCANClusterer clusterer = new DBSCANClusterer(2.0, 5); clusterer.cluster(null); } diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java index dd5ca3623..a46c01ea7 100644 --- a/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java +++ b/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java @@ -43,7 +43,7 @@ public class FuzzyKMeansClustererTest { @Test public void testCluster() { - final List points = new ArrayList<>(); + final List points = new ArrayList(); // create 10 data points: [1], ... [10] for (int i = 1; i <= 10; i++) { @@ -52,7 +52,7 @@ public class FuzzyKMeansClustererTest { } final FuzzyKMeansClusterer transformer = - new FuzzyKMeansClusterer<>(3, 2.0); + new FuzzyKMeansClusterer(3, 2.0); final List> clusters = transformer.cluster(points); // we expect 3 clusters: @@ -90,7 +90,7 @@ public class FuzzyKMeansClustererTest { @Test(expected = NullArgumentException.class) public void testNullDataset() { - final FuzzyKMeansClusterer clusterer = new FuzzyKMeansClusterer<>(3, 2.0); + final FuzzyKMeansClusterer clusterer = new FuzzyKMeansClusterer(3, 2.0); clusterer.cluster(null); } @@ -99,7 +99,7 @@ public class FuzzyKMeansClustererTest { final DistanceMeasure measure = new CanberraDistance(); final RandomGenerator random = new JDKRandomGenerator(); final FuzzyKMeansClusterer clusterer = - new FuzzyKMeansClusterer<>(3, 2.0, 100, measure, 1e-6, random); + new FuzzyKMeansClusterer(3, 2.0, 100, measure, 1e-6, random); Assert.assertEquals(3, clusterer.getK()); Assert.assertEquals(2.0, clusterer.getFuzziness(), 1e-6); @@ -111,11 +111,11 @@ public class FuzzyKMeansClustererTest { @Test public void testSingleCluster() { - final List points = new ArrayList<>(); + final List points = new ArrayList(); points.add(new DoublePoint(new double[] { 1, 1 })); final FuzzyKMeansClusterer transformer = - new FuzzyKMeansClusterer<>(1, 2.0); + new FuzzyKMeansClusterer(1, 2.0); final List> clusters = transformer.cluster(points); Assert.assertEquals(1, clusters.size()); @@ -123,14 +123,14 @@ public class FuzzyKMeansClustererTest { @Test public void testClusterCenterEqualsPoints() { - final List points = new ArrayList<>(); + final List points = new ArrayList(); points.add(new DoublePoint(new double[] { 1, 1 })); points.add(new DoublePoint(new double[] { 1.00001, 1.00001 })); points.add(new DoublePoint(new double[] { 2, 2 })); points.add(new DoublePoint(new double[] { 3, 3 })); final FuzzyKMeansClusterer transformer = - new FuzzyKMeansClusterer<>(3, 2.0); + new FuzzyKMeansClusterer(3, 2.0); final List> clusters = transformer.cluster(points); Assert.assertEquals(3, clusters.size()); diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java index 56f262d55..39ef2c53f 100644 --- a/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java +++ b/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java @@ -52,7 +52,7 @@ public class KMeansPlusPlusClustererTest { @Test public void testPerformClusterAnalysisDegenerate() { KMeansPlusPlusClusterer transformer = - new KMeansPlusPlusClusterer<>(1, 1); + new KMeansPlusPlusClusterer(1, 1); DoublePoint[] points = new DoublePoint[] { new DoublePoint(new int[] { 1959, 325100 }), @@ -102,7 +102,7 @@ public class KMeansPlusPlusClustererTest { for (int n = 2; n < 27; ++n) { KMeansPlusPlusClusterer transformer = - new KMeansPlusPlusClusterer<>(n, 100, new EuclideanDistance(), random, strategy); + new KMeansPlusPlusClusterer(n, 100, new EuclideanDistance(), random, strategy); List> clusters = transformer.cluster(Arrays.asList(breakingPoints)); @@ -143,7 +143,7 @@ public class KMeansPlusPlusClustererTest { DoublePoint repeatedPoint = new DoublePoint(repeatedArray); DoublePoint uniquePoint = new DoublePoint(uniqueArray); - Collection points = new ArrayList<>(); + Collection points = new ArrayList(); final int NUM_REPEATED_POINTS = 10 * 1000; for (int i = 0; i < NUM_REPEATED_POINTS; ++i) { points.add(repeatedPoint); @@ -158,7 +158,7 @@ public class KMeansPlusPlusClustererTest { random.setSeed(RANDOM_SEED); KMeansPlusPlusClusterer clusterer = - new KMeansPlusPlusClusterer<>(NUM_CLUSTERS, NUM_ITERATIONS, + new KMeansPlusPlusClusterer(NUM_CLUSTERS, NUM_ITERATIONS, new CloseDistance(), random); List> clusters = clusterer.cluster(points); @@ -178,7 +178,7 @@ public class KMeansPlusPlusClustererTest { @Test(expected=NumberIsTooSmallException.class) public void testPerformClusterAnalysisToManyClusters() { KMeansPlusPlusClusterer transformer = - new KMeansPlusPlusClusterer<>(3, 1, new EuclideanDistance(), random); + new KMeansPlusPlusClusterer(3, 1, new EuclideanDistance(), random); DoublePoint[] points = new DoublePoint[] { new DoublePoint(new int[] { diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java index 12816d708..d7071129c 100644 --- a/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java +++ b/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java @@ -34,7 +34,7 @@ public class MultiKMeansPlusPlusClustererTest { @Test public void dimension2() { MultiKMeansPlusPlusClusterer transformer = - new MultiKMeansPlusPlusClusterer<>( + new MultiKMeansPlusPlusClusterer( new KMeansPlusPlusClusterer(3, 10), 5); DoublePoint[] points = new DoublePoint[] { diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java index 37c59a605..0b20f8b05 100644 --- a/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java +++ b/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java @@ -38,7 +38,7 @@ public class SumOfClusterVariancesTest { @Before public void setUp() { - evaluator = new SumOfClusterVariances<>(new EuclideanDistance()); + evaluator = new SumOfClusterVariances(new EuclideanDistance()); } @Test @@ -55,9 +55,9 @@ public class SumOfClusterVariancesTest { new DoublePoint(new double[] { 10 }) }; - final List> clusters = new ArrayList<>(); + final List> clusters = new ArrayList>(); - final Cluster cluster1 = new Cluster<>(); + final Cluster cluster1 = new Cluster(); for (DoublePoint p : points1) { cluster1.addPoint(p); } @@ -65,7 +65,7 @@ public class SumOfClusterVariancesTest { assertEquals(1.0/3.0, evaluator.score(clusters), 1e-6); - final Cluster cluster2 = new Cluster<>(); + final Cluster cluster2 = new Cluster(); for (DoublePoint p : points2) { cluster2.addPoint(p); } diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java index 4404aacbc..f716fc8d1 100644 --- a/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java +++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java @@ -49,8 +49,8 @@ public class MapUtilsTest { final Network net = new NeuronString(3, false, initArray).getNetwork(); final DistanceMeasure dist = new EuclideanDistance(); - final Set allBest = new HashSet<>(); - final Set best = new HashSet<>(); + final Set allBest = new HashSet(); + final Set best = new HashSet(); double[][] features; // The following tests ensures that @@ -97,7 +97,7 @@ public class MapUtilsTest { @Test public void testSort() { - final Set list = new HashSet<>(); + final Set list = new HashSet(); for (int i = 0; i < 4; i++) { list.add(new Neuron(i, new double[] { i - 0.5 })); diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java index 5871956bb..e7654fdc0 100644 --- a/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java +++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java @@ -139,7 +139,7 @@ public class NeuronStringTest { public void testGetNeighboursWithExclude() { final FeatureInitializer[] initArray = { init }; final Network net = new NeuronString(5, true, initArray).getNetwork(); - final Collection exclude = new ArrayList<>(); + final Collection exclude = new ArrayList(); exclude.add(net.getNeuron(1)); final Collection neighbours = net.getNeighbours(net.getNeuron(0), exclude); diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java index 373a5bd90..dd669d58d 100644 --- a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java +++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java @@ -112,7 +112,7 @@ public class KohonenTrainingTaskTest { final ExecutorService service = Executors.newCachedThreadPool(); final int numProcs = Runtime.getRuntime().availableProcessors(); final Runnable[] tasks = solver.createParallelTasks(numProcs, 5000); - final List> execOutput = new ArrayList<>(); + final List> execOutput = new ArrayList>(); // Run tasks. for (Runnable r : tasks) { execOutput.add(service.submit(r)); @@ -165,7 +165,7 @@ public class KohonenTrainingTaskTest { * @return the total distance. */ private Collection uniqueCities(City[] cityList) { - final Set unique = new HashSet<>(); + final Set unique = new HashSet(); for (City c : cityList) { unique.add(c); } diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java index 37a9b2df2..fea0f162b 100644 --- a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java +++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java @@ -58,7 +58,7 @@ public class TravellingSalesmanSolver { /** RNG. */ private final RandomGenerator random; /** Set of cities. */ - private final Set cities = new HashSet<>(); + private final Set cities = new HashSet(); /** SOFM. */ private final Network net; /** Distance function. */ @@ -176,7 +176,7 @@ public class TravellingSalesmanSolver { * @return the iterator. */ private Iterator createRandomIterator(final long numSamples) { - final List cityList = new ArrayList<>(); + final List cityList = new ArrayList(); cityList.addAll(cities); return new Iterator() { @@ -204,7 +204,7 @@ public class TravellingSalesmanSolver { */ private List getNeuronList() { // Sequence of coordinates. - final List list = new ArrayList<>(); + final List list = new ArrayList(); // First neuron. Neuron current = net.getNeuron(FIRST_NEURON_ID); @@ -230,7 +230,7 @@ public class TravellingSalesmanSolver { */ public List getCoordinatesList() { // Sequence of coordinates. - final List coordinatesList = new ArrayList<>(); + final List coordinatesList = new ArrayList(); for (Neuron n : getNeuronList()) { coordinatesList.add(n.getFeatures()); diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java index 833717514..d233b24fb 100644 --- a/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java +++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java @@ -574,7 +574,7 @@ public class NeuronSquareMesh2DTest { initArray).getNetwork(); Collection neighbours; - Collection exclude = new HashSet<>(); + Collection exclude = new HashSet(); // Level-1 neighbourhood. neighbours = net.getNeighbours(net.getNeuron(12)); @@ -623,7 +623,7 @@ public class NeuronSquareMesh2DTest { initArray).getNetwork(); Collection neighbours; - Collection exclude = new HashSet<>(); + Collection exclude = new HashSet(); // Level-1 neighbourhood. neighbours = net.getNeighbours(net.getNeuron(8)); @@ -854,13 +854,13 @@ public class NeuronSquareMesh2DTest { 3, true, SquareNeighbourhood.VON_NEUMANN, initArray); - final Set fromMap = new HashSet<>(); + final Set fromMap = new HashSet(); for (Neuron n : map) { fromMap.add(n); } final Network net = map.getNetwork(); - final Set fromNet = new HashSet<>(); + final Set fromNet = new HashSet(); for (Neuron n : net) { fromNet.add(n); } diff --git a/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java b/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java index b50d0b9e4..870ee1e2f 100644 --- a/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java +++ b/src/test/java/org/apache/commons/math4/ode/ContinuousOutputFieldModelTest.java @@ -42,12 +42,12 @@ public class ContinuousOutputFieldModelTest { } private > void doTestBoundaries(final Field field) { - TestFieldProblem3 pb = new TestFieldProblem3<>(field, field.getZero().add(0.9)); + TestFieldProblem3 pb = new TestFieldProblem3(field, field.getZero().add(0.9)); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); - FirstOrderFieldIntegrator integ = new DormandPrince54FieldIntegrator<>(field, minStep, maxStep, 1.0e-8, 1.0e-8); + FirstOrderFieldIntegrator integ = new DormandPrince54FieldIntegrator(field, minStep, maxStep, 1.0e-8, 1.0e-8); integ.addStepHandler(new ContinuousOutputFieldModel()); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); ContinuousOutputFieldModel cm = (ContinuousOutputFieldModel) integ.getStepHandlers().iterator().next(); cm.getInterpolatedState(pb.getInitialState().getTime().multiply(2).subtract(pb.getFinalTime())); cm.getInterpolatedState(pb.getFinalTime().multiply(2).subtract(pb.getInitialState().getTime())); @@ -61,13 +61,13 @@ public class ContinuousOutputFieldModelTest { private > void doTestRandomAccess(final Field field) { - TestFieldProblem3 pb = new TestFieldProblem3<>(field, field.getZero().add(0.9)); + TestFieldProblem3 pb = new TestFieldProblem3(field, field.getZero().add(0.9)); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); - FirstOrderFieldIntegrator integ = new DormandPrince54FieldIntegrator<>(field, minStep, maxStep, 1.0e-8, 1.0e-8); - ContinuousOutputFieldModel cm = new ContinuousOutputFieldModel<>(); + FirstOrderFieldIntegrator integ = new DormandPrince54FieldIntegrator(field, minStep, maxStep, 1.0e-8, 1.0e-8); + ContinuousOutputFieldModel cm = new ContinuousOutputFieldModel(); integ.addStepHandler(cm); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); Random random = new Random(347588535632l); T maxError = field.getZero(); @@ -117,32 +117,32 @@ public class ContinuousOutputFieldModelTest { }; // integrate backward from π to 0; - ContinuousOutputFieldModel cm1 = new ContinuousOutputFieldModel<>(); + ContinuousOutputFieldModel cm1 = new ContinuousOutputFieldModel(); FirstOrderFieldIntegrator integ1 = - new DormandPrince853FieldIntegrator<>(field, 0, 1.0, 1.0e-8, 1.0e-8); + new DormandPrince853FieldIntegrator(field, 0, 1.0, 1.0e-8, 1.0e-8); integ1.addStepHandler(cm1); T t0 = field.getZero().add(FastMath.PI); T[] y0 = MathArrays.buildArray(field, 2); y0[0] = field.getOne().negate(); y0[1] = field.getZero(); - integ1.integrate(new FieldExpandableODE<>(problem), - new FieldODEState<>(t0, y0), + integ1.integrate(new FieldExpandableODE(problem), + new FieldODEState(t0, y0), field.getZero()); // integrate backward from 2π to π - ContinuousOutputFieldModel cm2 = new ContinuousOutputFieldModel<>(); + ContinuousOutputFieldModel cm2 = new ContinuousOutputFieldModel(); FirstOrderFieldIntegrator integ2 = - new DormandPrince853FieldIntegrator<>(field, 0, 0.1, 1.0e-12, 1.0e-12); + new DormandPrince853FieldIntegrator(field, 0, 0.1, 1.0e-12, 1.0e-12); integ2.addStepHandler(cm2); t0 = field.getZero().add(2.0 * FastMath.PI); y0[0] = field.getOne(); y0[1] = field.getZero(); - integ2.integrate(new FieldExpandableODE<>(problem), - new FieldODEState<>(t0, y0), + integ2.integrate(new FieldExpandableODE(problem), + new FieldODEState(t0, y0), field.getZero().add(FastMath.PI)); // merge the two half circles - ContinuousOutputFieldModel cm = new ContinuousOutputFieldModel<>(); + ContinuousOutputFieldModel cm = new ContinuousOutputFieldModel(); cm.append(cm2); cm.append(new ContinuousOutputFieldModel()); cm.append(cm1); @@ -164,7 +164,7 @@ public class ContinuousOutputFieldModelTest { } private > void doTestErrorConditions(final Field field) { - ContinuousOutputFieldModel cm = new ContinuousOutputFieldModel<>(); + ContinuousOutputFieldModel cm = new ContinuousOutputFieldModel(); cm.handleStep(buildInterpolator(field, 0, 1, new double[] { 0.0, 1.0, -2.0 }), true); // dimension mismatch @@ -184,7 +184,7 @@ public class ContinuousOutputFieldModelTest { private > boolean checkAppendError(Field field, ContinuousOutputFieldModel cm, double t0, double t1, double[] y) { try { - ContinuousOutputFieldModel otherCm = new ContinuousOutputFieldModel<>(); + ContinuousOutputFieldModel otherCm = new ContinuousOutputFieldModel(); otherCm.handleStep(buildInterpolator(field, t0, t1, y), true); cm.append(otherCm); } catch(DimensionMismatchException dme) { @@ -201,9 +201,9 @@ public class ContinuousOutputFieldModelTest { for (int i = 0; i < y.length; ++i) { fieldY[i] = field.getZero().add(y[i]); } - final FieldODEStateAndDerivative s0 = new FieldODEStateAndDerivative<>(field.getZero().add(t0), fieldY, fieldY); - final FieldODEStateAndDerivative s1 = new FieldODEStateAndDerivative<>(field.getZero().add(t1), fieldY, fieldY); - final FieldEquationsMapper mapper = new FieldExpandableODE<>(new FirstOrderFieldDifferentialEquations() { + final FieldODEStateAndDerivative s0 = new FieldODEStateAndDerivative(field.getZero().add(t0), fieldY, fieldY); + final FieldODEStateAndDerivative s1 = new FieldODEStateAndDerivative(field.getZero().add(t1), fieldY, fieldY); + final FieldEquationsMapper mapper = new FieldExpandableODE(new FirstOrderFieldDifferentialEquations() { public int getDimension() { return s0.getStateDimension(); } @@ -213,7 +213,7 @@ public class ContinuousOutputFieldModelTest { return y; } }).getMapper(); - return new DummyFieldStepInterpolator<>(t1 >= t0, s0, s1, s0, s1, mapper); + return new DummyFieldStepInterpolator(t1 >= t0, s0, s1, s0, s1, mapper); } public void checkValue(double value, double reference) { diff --git a/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java b/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java index 20fc11f35..79070d03b 100644 --- a/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java +++ b/src/test/java/org/apache/commons/math4/ode/FieldExpandableODETest.java @@ -39,8 +39,8 @@ public class FieldExpandableODETest { } private > void doTestOnlyMainEquation(final Field field) { - FirstOrderFieldDifferentialEquations main = new Linear<>(field, 3, 0); - FieldExpandableODE equation = new FieldExpandableODE<>(main); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); + FieldExpandableODE equation = new FieldExpandableODE(main); Assert.assertEquals(main.getDimension(), equation.getMapper().getTotalDimension()); Assert.assertEquals(1, equation.getMapper().getNumberOfEquations()); T t0 = field.getZero().add(10); @@ -70,11 +70,11 @@ public class FieldExpandableODETest { private > void doTestMainAndSecondary(final Field field) { - FirstOrderFieldDifferentialEquations main = new Linear<>(field, 3, 0); - FieldExpandableODE equation = new FieldExpandableODE<>(main); - FieldSecondaryEquations secondary1 = new Linear<>(field, 3, main.getDimension()); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); + FieldExpandableODE equation = new FieldExpandableODE(main); + FieldSecondaryEquations secondary1 = new Linear(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); - FieldSecondaryEquations secondary2 = new Linear<>(field, 5, main.getDimension() + secondary1.getDimension()); + FieldSecondaryEquations secondary2 = new Linear(field, 5, main.getDimension() + secondary1.getDimension()); int i2 = equation.addSecondaryEquations(secondary2); Assert.assertEquals(main.getDimension() + secondary1.getDimension() + secondary2.getDimension(), equation.getMapper().getTotalDimension()); @@ -127,11 +127,11 @@ public class FieldExpandableODETest { private > void doTestMap(final Field field) { - FirstOrderFieldDifferentialEquations main = new Linear<>(field, 3, 0); - FieldExpandableODE equation = new FieldExpandableODE<>(main); - FieldSecondaryEquations secondary1 = new Linear<>(field, 3, main.getDimension()); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); + FieldExpandableODE equation = new FieldExpandableODE(main); + FieldSecondaryEquations secondary1 = new Linear(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); - FieldSecondaryEquations secondary2 = new Linear<>(field, 5, main.getDimension() + secondary1.getDimension()); + FieldSecondaryEquations secondary2 = new Linear(field, 5, main.getDimension() + secondary1.getDimension()); int i2 = equation.addSecondaryEquations(secondary2); Assert.assertEquals(main.getDimension() + secondary1.getDimension() + secondary2.getDimension(), equation.getMapper().getTotalDimension()); @@ -215,9 +215,9 @@ public class FieldExpandableODETest { private > void doTestExtractDimensionMismatch(final Field field) throws DimensionMismatchException { - FirstOrderFieldDifferentialEquations main = new Linear<>(field, 3, 0); - FieldExpandableODE equation = new FieldExpandableODE<>(main); - FieldSecondaryEquations secondary1 = new Linear<>(field, 3, main.getDimension()); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); + FieldExpandableODE equation = new FieldExpandableODE(main); + FieldSecondaryEquations secondary1 = new Linear(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); T[] tooShort = MathArrays.buildArray(field, main.getDimension()); equation.getMapper().extractEquationData(i1, tooShort); @@ -231,9 +231,9 @@ public class FieldExpandableODETest { private > void doTestInsertTooShortComplete(final Field field) throws DimensionMismatchException { - FirstOrderFieldDifferentialEquations main = new Linear<>(field, 3, 0); - FieldExpandableODE equation = new FieldExpandableODE<>(main); - FieldSecondaryEquations secondary1 = new Linear<>(field, 3, main.getDimension()); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); + FieldExpandableODE equation = new FieldExpandableODE(main); + FieldSecondaryEquations secondary1 = new Linear(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); T[] equationData = MathArrays.buildArray(field, secondary1.getDimension()); T[] tooShort = MathArrays.buildArray(field, main.getDimension()); @@ -248,9 +248,9 @@ public class FieldExpandableODETest { private > void doTestInsertWrongEquationData(final Field field) throws DimensionMismatchException { - FirstOrderFieldDifferentialEquations main = new Linear<>(field, 3, 0); - FieldExpandableODE equation = new FieldExpandableODE<>(main); - FieldSecondaryEquations secondary1 = new Linear<>(field, 3, main.getDimension()); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); + FieldExpandableODE equation = new FieldExpandableODE(main); + FieldSecondaryEquations secondary1 = new Linear(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); T[] wrongEquationData = MathArrays.buildArray(field, secondary1.getDimension() + 1); T[] complete = MathArrays.buildArray(field, equation.getMapper().getTotalDimension()); @@ -265,8 +265,8 @@ public class FieldExpandableODETest { private > void doTestNegativeIndex(final Field field) throws MathIllegalArgumentException { - FirstOrderFieldDifferentialEquations main = new Linear<>(field, 3, 0); - FieldExpandableODE equation = new FieldExpandableODE<>(main); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); + FieldExpandableODE equation = new FieldExpandableODE(main); T[] complete = MathArrays.buildArray(field, equation.getMapper().getTotalDimension()); equation.getMapper().extractEquationData(-1, complete); } @@ -279,8 +279,8 @@ public class FieldExpandableODETest { private > void doTestTooLargeIndex(final Field field) throws MathIllegalArgumentException { - FirstOrderFieldDifferentialEquations main = new Linear<>(field, 3, 0); - FieldExpandableODE equation = new FieldExpandableODE<>(main); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); + FieldExpandableODE equation = new FieldExpandableODE(main); T[] complete = MathArrays.buildArray(field, equation.getMapper().getTotalDimension()); equation.getMapper().extractEquationData(+1, complete); } diff --git a/src/test/java/org/apache/commons/math4/ode/TestFieldProblem4.java b/src/test/java/org/apache/commons/math4/ode/TestFieldProblem4.java index 01db18f6a..cc797776e 100644 --- a/src/test/java/org/apache/commons/math4/ode/TestFieldProblem4.java +++ b/src/test/java/org/apache/commons/math4/ode/TestFieldProblem4.java @@ -67,8 +67,8 @@ public class TestFieldProblem4> @SuppressWarnings("unchecked") FieldEventHandler[] handlers = (FieldEventHandler[]) Array.newInstance(FieldEventHandler.class, 2); - handlers[0] = new Bounce<>(); - handlers[1] = new Stop<>(); + handlers[0] = new Bounce(); + handlers[1] = new Stop(); return handlers; } @@ -130,7 +130,7 @@ public class TestFieldProblem4> T[] y = state.getState(); y[0] = y[0].negate(); y[1] = y[1].negate(); - return new FieldODEState<>(state.getTime(), y); + return new FieldODEState(state.getTime(), y); } } diff --git a/src/test/java/org/apache/commons/math4/ode/TestFieldProblemAbstract.java b/src/test/java/org/apache/commons/math4/ode/TestFieldProblemAbstract.java index cf404d677..9d1b78b11 100644 --- a/src/test/java/org/apache/commons/math4/ode/TestFieldProblemAbstract.java +++ b/src/test/java/org/apache/commons/math4/ode/TestFieldProblemAbstract.java @@ -114,7 +114,7 @@ public abstract class TestFieldProblemAbstract> * @return initial state */ public FieldODEState getInitialState() { - return new FieldODEState<>(t0, y0); + return new FieldODEState(t0, y0); } /** diff --git a/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java b/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java index 38f1cf33e..e489e4e22 100644 --- a/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java +++ b/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java @@ -90,8 +90,8 @@ public class OverlappingEventsTest implements FirstOrderDifferentialEquations { double t = 0.0; double tEnd = 10.0; double[] y = {0.0, 0.0}; - List events1 = new ArrayList<>(); - List events2 = new ArrayList<>(); + List events1 = new ArrayList(); + List events2 = new ArrayList(); while (t < tEnd) { t = integrator.integrate(this, t, y, tEnd, y); //System.out.println("t=" + t + ",\t\ty=[" + y[0] + "," + y[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 aceede07e..61372f51e 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 @@ -152,8 +152,8 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { EmbeddedRungeKuttaFieldIntegrator integrator = createIntegrator(field, 0.0, 1.0, 1.0e-10, 1.0e-10); try { - integrator.integrate(new FieldExpandableODE<>(equations), - new FieldODEState<>(field.getOne().negate(), + integrator.integrate(new FieldExpandableODE(equations), + new FieldODEState(field.getOne().negate(), MathArrays.buildArray(field, 1)), field.getZero()); Assert.fail("an exception should have been thrown"); @@ -162,8 +162,8 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { } try { - integrator.integrate(new FieldExpandableODE<>(equations), - new FieldODEState<>(field.getZero(), + integrator.integrate(new FieldExpandableODE(equations), + new FieldODEState(field.getZero(), MathArrays.buildArray(field, 1)), field.getOne()); Assert.fail("an exception should have been thrown"); @@ -182,7 +182,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { protected > void doTestMinStep(final Field field) throws NumberIsTooSmallException { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); + TestFieldProblem1 pb = new TestFieldProblem1(field); double minStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.1).getReal(); double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double[] vecAbsoluteTolerance = { 1.0e-15, 1.0e-16 }; @@ -190,9 +190,9 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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"); } @@ -206,7 +206,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { int previousCalls = Integer.MAX_VALUE; for (int i = -12; i < -2; ++i) { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); + TestFieldProblem1 pb = new TestFieldProblem1(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = FastMath.pow(10.0, i); @@ -214,9 +214,9 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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.assertTrue(handler.getMaximalValueError().getReal() < (factor * scalAbsoluteTolerance)); Assert.assertEquals(0, handler.getMaximalTimeError().getReal(), epsilon); @@ -237,7 +237,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { final double epsilonMaxValue, final String name) { - TestFieldProblem4 pb = new TestFieldProblem4<>(field); + TestFieldProblem4 pb = new TestFieldProblem4(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = 1.0e-8; @@ -245,7 +245,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); FieldEventHandler[] functions = pb.getEventsHandlers(); double convergence = 1.0e-8 * maxStep; @@ -253,7 +253,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { integ.addEventHandler(functions[l], Double.POSITIVE_INFINITY, convergence, 1000); } Assert.assertEquals(functions.length, integ.getEventHandlers().size()); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue); Assert.assertEquals(0, handler.getMaximalTimeError().getReal(), convergence); @@ -269,7 +269,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { protected > void doTestEventsErrors(final Field field) throws LocalException { - final TestFieldProblem1 pb = new TestFieldProblem1<>(field); + final TestFieldProblem1 pb = new TestFieldProblem1(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = 1.0e-8; @@ -277,7 +277,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); integ.addEventHandler(new FieldEventHandler() { @@ -299,7 +299,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { } }, Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); } @@ -308,7 +308,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { protected > void doTestEventsNoConvergence(final Field field){ - final TestFieldProblem1 pb = new TestFieldProblem1<>(field); + final TestFieldProblem1 pb = new TestFieldProblem1(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = 1.0e-8; @@ -316,7 +316,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); integ.addEventHandler(new FieldEventHandler() { @@ -336,7 +336,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { }, Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 3); try { - 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"); } catch (MaxCountExceededException mcee) { // Expected. @@ -348,13 +348,13 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { public abstract void testSanityChecks(); protected > void doTestSanityChecks(Field field) { - TestFieldProblem3 pb = new TestFieldProblem3<>(field); + TestFieldProblem3 pb = new TestFieldProblem3(field); try { EmbeddedRungeKuttaFieldIntegrator integrator = createIntegrator(field, 0, pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(), new double[4], new double[4]); - integrator.integrate(new FieldExpandableODE<>(pb), - new FieldODEState<>(pb.getInitialState().getTime(), + integrator.integrate(new FieldExpandableODE(pb), + new FieldODEState(pb.getInitialState().getTime(), MathArrays.buildArray(field, 6)), pb.getFinalTime()); Assert.fail("an exception should have been thrown"); @@ -365,7 +365,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) { } @@ -374,7 +374,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) { } @@ -391,7 +391,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { throws DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException, NoBracketingException { - TestFieldProblem5 pb = new TestFieldProblem5<>(field); + TestFieldProblem5 pb = new TestFieldProblem5(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).abs().getReal(); double scalAbsoluteTolerance = 1.0e-8; @@ -400,9 +400,9 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { EmbeddedRungeKuttaFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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(), epsilonLast); Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue); @@ -416,7 +416,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { protected > void doTestKepler(Field field, double epsilon) { - final TestFieldProblem3 pb = new TestFieldProblem3<>(field, field.getZero().add(0.9)); + final TestFieldProblem3 pb = new TestFieldProblem3(field, field.getZero().add(0.9)); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double[] vecAbsoluteTolerance = { 1.0e-8, 1.0e-8, 1.0e-10, 1.0e-10 }; @@ -424,8 +424,8 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); - integ.addStepHandler(new KeplerHandler<>(pb, epsilon)); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.addStepHandler(new KeplerHandler(pb, epsilon)); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); } private static class KeplerHandler> implements FieldStepHandler { @@ -486,8 +486,8 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { t.subtract(t0).multiply(0.001).getReal(), t.subtract(t0).getReal(), 1.0e-12, 1.0e-12); FieldODEStateAndDerivative result = - integrator.integrate(new FieldExpandableODE<>(sinCos), - new FieldODEState<>(t0, y0), + integrator.integrate(new FieldExpandableODE(sinCos), + new FieldODEState(t0, y0), t); // check values 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 80b682856..d79a19f15 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 @@ -151,8 +151,8 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { y0[i] = field.getOne().add(i); } - FieldODEStateAndDerivative result = integrator.integrate(new FieldExpandableODE<>(ode), - new FieldODEState<>(t0, y0), + FieldODEStateAndDerivative result = integrator.integrate(new FieldExpandableODE(ode), + new FieldODEState(t0, y0), tEvent); Assert.assertEquals(tEvent.getReal(), result.getTime().getReal(), epsilonT); T[] y = result.getState(); @@ -180,8 +180,8 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { return Action.CONTINUE; } }, Double.POSITIVE_INFINITY, 1.0e-20, 100); - result = integrator.integrate(new FieldExpandableODE<>(ode), - new FieldODEState<>(t0, y0), + result = integrator.integrate(new FieldExpandableODE(ode), + new FieldODEState(t0, y0), tEvent.add(120)); Assert.assertEquals(tEvent.add(120).getReal(), result.getTime().getReal(), epsilonT); y = result.getState(); @@ -201,17 +201,17 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { MaxCountExceededException, NoBracketingException { RungeKuttaFieldIntegrator integrator = createIntegrator(field, field.getZero().add(0.01)); try { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); - integrator.integrate(new FieldExpandableODE<>(pb), - new FieldODEState<>(field.getZero(), MathArrays.buildArray(field, pb.getDimension() + 10)), + TestFieldProblem1 pb = new TestFieldProblem1(field); + 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"); } catch(DimensionMismatchException ie) { } try { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); - integrator.integrate(new FieldExpandableODE<>(pb), - new FieldODEState<>(field.getZero(), MathArrays.buildArray(field, pb.getDimension())), + TestFieldProblem1 pb = new TestFieldProblem1(field); + integrator.integrate(new FieldExpandableODE(pb), + new FieldODEState(field.getZero(), MathArrays.buildArray(field, pb.getDimension())), field.getZero()); Assert.fail("an exception should have been thrown"); } catch(NumberIsTooSmallException ie) { @@ -231,12 +231,12 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { @SuppressWarnings("unchecked") TestFieldProblemAbstract[] allProblems = (TestFieldProblemAbstract[]) Array.newInstance(TestFieldProblemAbstract.class, 6); - allProblems[0] = new TestFieldProblem1<>(field); - allProblems[1] = new TestFieldProblem2<>(field); - allProblems[2] = new TestFieldProblem3<>(field); - allProblems[3] = new TestFieldProblem4<>(field); - allProblems[4] = new TestFieldProblem5<>(field); - allProblems[5] = new TestFieldProblem6<>(field); + allProblems[0] = new TestFieldProblem1(field); + allProblems[1] = new TestFieldProblem2(field); + allProblems[2] = new TestFieldProblem3(field); + allProblems[3] = new TestFieldProblem4(field); + allProblems[4] = new TestFieldProblem5(field); + allProblems[5] = new TestFieldProblem6(field); for (TestFieldProblemAbstract pb : allProblems) { T previousValueError = null; @@ -246,7 +246,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { T step = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(FastMath.pow(2.0, -i)); RungeKuttaFieldIntegrator integ = createIntegrator(field, step); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); FieldEventHandler[] functions = pb.getEventsHandlers(); for (int l = 0; l < functions.length; ++l) { @@ -254,7 +254,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { Double.POSITIVE_INFINITY, 1.0e-6 * step.getReal(), 1000); } Assert.assertEquals(functions.length, integ.getEventHandlers().size()); - FieldODEStateAndDerivative stop = integ.integrate(new FieldExpandableODE<>(pb), + FieldODEStateAndDerivative stop = integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); if (functions.length == 0) { @@ -292,13 +292,13 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { throws DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException, NoBracketingException { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); + TestFieldProblem1 pb = new TestFieldProblem1(field); T step = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.001); RungeKuttaFieldIntegrator integ = createIntegrator(field, step); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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(), epsilonLast); Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue); @@ -318,13 +318,13 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { throws DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException, NoBracketingException { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); + TestFieldProblem1 pb = new TestFieldProblem1(field); T step = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.2); RungeKuttaFieldIntegrator integ = createIntegrator(field, step); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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.assertTrue(handler.getLastError().getReal() > belowLast); Assert.assertTrue(handler.getMaximalValueError().getReal() > belowMaxValue); @@ -344,13 +344,13 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { throws DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException, NoBracketingException { - TestFieldProblem5 pb = new TestFieldProblem5<>(field); + TestFieldProblem5 pb = new TestFieldProblem5(field); T step = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.001).abs(); RungeKuttaFieldIntegrator integ = createIntegrator(field, step); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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(), epsilonLast); Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue); @@ -366,12 +366,12 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { throws DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException, NoBracketingException { - final TestFieldProblem3 pb = new TestFieldProblem3<>(field, field.getZero().add(0.9)); + final TestFieldProblem3 pb = new TestFieldProblem3(field, field.getZero().add(0.9)); T step = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.0003); RungeKuttaFieldIntegrator integ = createIntegrator(field, step); - integ.addStepHandler(new KeplerHandler<>(pb, expectedMaxError, epsilon)); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.addStepHandler(new KeplerHandler(pb, expectedMaxError, epsilon)); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); } private static class KeplerHandler> implements FieldStepHandler { @@ -424,7 +424,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { public void init(FieldODEStateAndDerivative s0, T t) { } }); - integ.integrate(new FieldExpandableODE<>(new FirstOrderFieldDifferentialEquations() { + integ.integrate(new FieldExpandableODE(new FirstOrderFieldDifferentialEquations() { public void init(T t0, T[] y0, T t) { } public T[] computeDerivatives(T t, T[] y) { @@ -435,7 +435,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { public int getDimension() { return 1; } - }), new FieldODEState<>(field.getZero(), MathArrays.buildArray(field, 1)), field.getZero().add(5.0)); + }), new FieldODEState(field.getZero(), MathArrays.buildArray(field, 1)), field.getZero().add(5.0)); } @Test @@ -443,7 +443,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { protected > void doTestSingleStep(final Field field, final double epsilon) { - final TestFieldProblem3 pb = new TestFieldProblem3<>(field, field.getZero().add(0.9)); + final TestFieldProblem3 pb = new TestFieldProblem3(field, field.getZero().add(0.9)); T h = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.0003); RungeKuttaFieldIntegrator integ = createIntegrator(field, field.getZero().add(Double.NaN)); @@ -489,7 +489,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); } @@ -497,14 +497,14 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { public abstract void testUnstableDerivative(); protected > void doTestUnstableDerivative(Field field, double epsilon) { - final StepFieldProblem stepProblem = new StepFieldProblem<>(field, + final StepFieldProblem stepProblem = new StepFieldProblem(field, field.getZero().add(0.0), field.getZero().add(1.0), 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); } @@ -513,7 +513,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { public abstract void testDerivativesConsistency(); protected > void doTestDerivativesConsistency(final Field field, double epsilon) { - TestFieldProblem3 pb = new TestFieldProblem3<>(field); + TestFieldProblem3 pb = new TestFieldProblem3(field); T step = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.001); RungeKuttaFieldIntegrator integ = createIntegrator(field, step); StepInterpolatorTestUtils.checkDerivativesConsistency(integ, pb, 1.0e-10); @@ -546,8 +546,8 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { RungeKuttaFieldIntegrator integrator = createIntegrator(omega.getField(), t.subtract(t0).multiply(0.001)); FieldODEStateAndDerivative result = - integrator.integrate(new FieldExpandableODE<>(sinCos), - new FieldODEState<>(t0, y0), + integrator.integrate(new FieldExpandableODE(sinCos), + new FieldODEState(t0, y0), t); // check values diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegratorTest.java index 15d05a8aa..ed69ccd69 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthFieldIntegratorTest.java @@ -31,14 +31,14 @@ public class AdamsBashforthFieldIntegratorTest extends AdamsFieldIntegratorAbstr protected > AdamsFieldIntegrator createIntegrator(Field field, final int nSteps, final double minStep, final double maxStep, final double scalAbsoluteTolerance, final double scalRelativeTolerance) { - return new AdamsBashforthFieldIntegrator<>(field, nSteps, minStep, maxStep, + return new AdamsBashforthFieldIntegrator(field, nSteps, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); } protected > AdamsFieldIntegrator createIntegrator(Field field, final int nSteps, final double minStep, final double maxStep, final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance) { - return new AdamsBashforthFieldIntegrator<>(field, nSteps, minStep, maxStep, + return new AdamsBashforthFieldIntegrator(field, nSteps, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); } diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldIntegratorAbstractTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldIntegratorAbstractTest.java index 1f786bcd8..340dd4888 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldIntegratorAbstractTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsFieldIntegratorAbstractTest.java @@ -54,7 +54,7 @@ public abstract class AdamsFieldIntegratorAbstractTest { public abstract void testMinStep(); protected > void doDimensionCheck(final Field field) { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); + TestFieldProblem1 pb = new TestFieldProblem1(field); double minStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.1).getReal(); double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); @@ -64,9 +64,9 @@ public abstract class AdamsFieldIntegratorAbstractTest { FirstOrderFieldIntegrator integ = createIntegrator(field, 4, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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()); } @@ -78,7 +78,7 @@ public abstract class AdamsFieldIntegratorAbstractTest { int previousCalls = Integer.MAX_VALUE; for (int i = -12; i < -2; ++i) { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); + TestFieldProblem1 pb = new TestFieldProblem1(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = FastMath.pow(10.0, i); @@ -87,9 +87,9 @@ public abstract class AdamsFieldIntegratorAbstractTest { FirstOrderFieldIntegrator integ = createIntegrator(field, 4, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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.assertTrue(handler.getMaximalValueError().getReal() > ratioMin * scalAbsoluteTolerance); Assert.assertTrue(handler.getMaximalValueError().getReal() < ratioMax * scalAbsoluteTolerance); @@ -108,14 +108,14 @@ public abstract class AdamsFieldIntegratorAbstractTest { protected > void doExceedMaxEvaluations(final Field field, final int max) { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); + TestFieldProblem1 pb = new TestFieldProblem1(field); double range = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); FirstOrderFieldIntegrator integ = createIntegrator(field, 2, 0, range, 1.0e-12, 1.0e-12); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); integ.setMaxEvaluations(max); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); } @@ -128,13 +128,13 @@ public abstract class AdamsFieldIntegratorAbstractTest { final double epsilonMaxTime, final String name) { - TestFieldProblem5 pb = new TestFieldProblem5<>(field); + TestFieldProblem5 pb = new TestFieldProblem5(field); double range = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); AdamsFieldIntegrator integ = createIntegrator(field, 4, 0, range, 1.0e-12, 1.0e-12); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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.0, handler.getLastError().getReal(), epsilonLast); Assert.assertEquals(0.0, handler.getMaximalValueError().getReal(), epsilonMaxValue); @@ -149,15 +149,15 @@ public abstract class AdamsFieldIntegratorAbstractTest { final int nLimit, final double epsilonBad, final double epsilonGood) { - TestFieldProblem6 pb = new TestFieldProblem6<>(field); + TestFieldProblem6 pb = new TestFieldProblem6(field); double range = pb.getFinalTime().subtract(pb.getInitialState().getTime()).abs().getReal(); for (int nSteps = 2; nSteps < 8; ++nSteps) { AdamsFieldIntegrator integ = createIntegrator(field, nSteps, 1.0e-6 * range, 0.1 * range, 1.0e-4, 1.0e-4); - integ.setStarterIntegrator(new PerfectStarter<>(pb, nSteps)); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + integ.setStarterIntegrator(new PerfectStarter(pb, nSteps)); + 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()); if (nSteps < nLimit) { Assert.assertTrue(handler.getMaximalValueError().getReal() > epsilonBad); } else { @@ -171,7 +171,7 @@ public abstract class AdamsFieldIntegratorAbstractTest { public abstract void testStartFailure(); protected > void doTestStartFailure(final Field field) { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); + TestFieldProblem1 pb = new TestFieldProblem1(field); double minStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.0001).getReal(); double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = 1.0e-6; @@ -180,10 +180,10 @@ public abstract class AdamsFieldIntegratorAbstractTest { MultistepFieldIntegrator integ = createIntegrator(field, 6, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - integ.setStarterIntegrator(new DormandPrince853FieldIntegrator<>(field, maxStep * 0.5, maxStep, 0.1, 0.1)); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + integ.setStarterIntegrator(new DormandPrince853FieldIntegrator(field, maxStep * 0.5, maxStep, 0.1, 0.1)); + 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()); } @@ -194,7 +194,7 @@ public abstract class AdamsFieldIntegratorAbstractTest { public PerfectStarter(final TestFieldProblemAbstract problem, final int nbSteps) { super(problem.getField(), "perfect-starter"); - this.interpolator = new PerfectInterpolator<>(problem); + this.interpolator = new PerfectInterpolator(problem); this.nbSteps = nbSteps; } @@ -252,7 +252,7 @@ public abstract class AdamsFieldIntegratorAbstractTest { public FieldODEStateAndDerivative getInterpolatedState(T time) { T[] y = problem.computeTheoreticalState(time); T[] yDot = problem.computeDerivatives(time, y); - return new FieldODEStateAndDerivative<>(time, y, yDot); + return new FieldODEStateAndDerivative(time, y, yDot); } } diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegratorTest.java index 84a0f7d24..51eb7efda 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonFieldIntegratorTest.java @@ -31,14 +31,14 @@ public class AdamsMoultonFieldIntegratorTest extends AdamsFieldIntegratorAbstrac protected > AdamsFieldIntegrator createIntegrator(Field field, final int nSteps, final double minStep, final double maxStep, final double scalAbsoluteTolerance, final double scalRelativeTolerance) { - return new AdamsMoultonFieldIntegrator<>(field, nSteps, minStep, maxStep, + return new AdamsMoultonFieldIntegrator(field, nSteps, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); } protected > AdamsFieldIntegrator createIntegrator(Field field, final int nSteps, final double minStep, final double maxStep, final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance) { - return new AdamsMoultonFieldIntegrator<>(field, nSteps, minStep, maxStep, + return new AdamsMoultonFieldIntegrator(field, nSteps, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); } diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java index f484baacb..bbe30c2cc 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungKuttaFieldStepInterpolatorTest.java @@ -34,7 +34,7 @@ public class ClassicalRungKuttaFieldStepInterpolatorTest extends RungeKuttaField FieldODEStateAndDerivative softPreviousState, FieldODEStateAndDerivative softCurrentState, FieldEquationsMapper mapper) { - return new ClassicalRungeKuttaFieldStepInterpolator<>(field, forward, yDotK, + return new ClassicalRungeKuttaFieldStepInterpolator(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState, mapper); @@ -42,7 +42,7 @@ public class ClassicalRungKuttaFieldStepInterpolatorTest extends RungeKuttaField protected > FieldButcherArrayProvider createButcherArrayProvider(final Field field) { - return new ClassicalRungeKuttaFieldIntegrator<>(field, field.getOne()); + return new ClassicalRungeKuttaFieldIntegrator(field, field.getOne()); } @Test diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java index ebc996256..3cd0e3558 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaFieldIntegratorTest.java @@ -26,7 +26,7 @@ public class ClassicalRungeKuttaFieldIntegratorTest extends RungeKuttaFieldInteg protected > RungeKuttaFieldIntegrator createIntegrator(Field field, T step) { - return new ClassicalRungeKuttaFieldIntegrator<>(field, step); + return new ClassicalRungeKuttaFieldIntegrator(field, step); } @Override diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java index 28267e045..da908035b 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldIntegratorTest.java @@ -27,13 +27,13 @@ public class DormandPrince54FieldIntegratorTest extends EmbeddedRungeKuttaFieldI protected > EmbeddedRungeKuttaFieldIntegrator createIntegrator(Field field, final double minStep, final double maxStep, final double scalAbsoluteTolerance, final double scalRelativeTolerance) { - return new DormandPrince54FieldIntegrator<>(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); + return new DormandPrince54FieldIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); } protected > EmbeddedRungeKuttaFieldIntegrator createIntegrator(Field field, final double minStep, final double maxStep, final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance) { - return new DormandPrince54FieldIntegrator<>(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); + return new DormandPrince54FieldIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); } @Override diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java index b10501fb8..9b6d60707 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54FieldStepInterpolatorTest.java @@ -34,7 +34,7 @@ public class DormandPrince54FieldStepInterpolatorTest extends RungeKuttaFieldSte FieldODEStateAndDerivative softPreviousState, FieldODEStateAndDerivative softCurrentState, FieldEquationsMapper mapper) { - return new DormandPrince54FieldStepInterpolator<>(field, forward, yDotK, + return new DormandPrince54FieldStepInterpolator(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState, mapper); @@ -42,7 +42,7 @@ public class DormandPrince54FieldStepInterpolatorTest extends RungeKuttaFieldSte protected > FieldButcherArrayProvider createButcherArrayProvider(final Field field) { - return new DormandPrince54FieldIntegrator<>(field, 0, 1, 1, 1); + return new DormandPrince54FieldIntegrator(field, 0, 1, 1, 1); } @Test diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegratorTest.java index 258ccc7d7..bc7396805 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldIntegratorTest.java @@ -27,13 +27,13 @@ public class DormandPrince853FieldIntegratorTest extends EmbeddedRungeKuttaField protected > EmbeddedRungeKuttaFieldIntegrator createIntegrator(Field field, final double minStep, final double maxStep, final double scalAbsoluteTolerance, final double scalRelativeTolerance) { - return new DormandPrince853FieldIntegrator<>(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); + return new DormandPrince853FieldIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); } protected > EmbeddedRungeKuttaFieldIntegrator createIntegrator(Field field, final double minStep, final double maxStep, final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance) { - return new DormandPrince853FieldIntegrator<>(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); + return new DormandPrince853FieldIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); } @Override diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java index 69dbec4a9..5591b4d8d 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853FieldStepInterpolatorTest.java @@ -34,7 +34,7 @@ public class DormandPrince853FieldStepInterpolatorTest extends RungeKuttaFieldSt FieldODEStateAndDerivative softPreviousState, FieldODEStateAndDerivative softCurrentState, FieldEquationsMapper mapper) { - return new DormandPrince853FieldStepInterpolator<>(field, forward, yDotK, + return new DormandPrince853FieldStepInterpolator(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState, mapper); @@ -42,7 +42,7 @@ public class DormandPrince853FieldStepInterpolatorTest extends RungeKuttaFieldSt protected > FieldButcherArrayProvider createButcherArrayProvider(final Field field) { - return new DormandPrince853FieldIntegrator<>(field, 0, 1, 1, 1); + return new DormandPrince853FieldIntegrator(field, 0, 1, 1, 1); } @Test diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegratorAbstractTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegratorAbstractTest.java index edb950128..045e77de7 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegratorAbstractTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaFieldIntegratorAbstractTest.java @@ -152,8 +152,8 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { EmbeddedRungeKuttaFieldIntegrator integrator = createIntegrator(field, 0.0, 1.0, 1.0e-10, 1.0e-10); try { - integrator.integrate(new FieldExpandableODE<>(equations), - new FieldODEState<>(field.getOne().negate(), + integrator.integrate(new FieldExpandableODE(equations), + new FieldODEState(field.getOne().negate(), MathArrays.buildArray(field, 1)), field.getZero()); Assert.fail("an exception should have been thrown"); @@ -162,8 +162,8 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { } try { - integrator.integrate(new FieldExpandableODE<>(equations), - new FieldODEState<>(field.getZero(), + integrator.integrate(new FieldExpandableODE(equations), + new FieldODEState(field.getZero(), MathArrays.buildArray(field, 1)), field.getOne()); Assert.fail("an exception should have been thrown"); @@ -182,7 +182,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { protected > void doTestMinStep(final Field field) throws NumberIsTooSmallException { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); + TestFieldProblem1 pb = new TestFieldProblem1(field); double minStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.1).getReal(); double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double[] vecAbsoluteTolerance = { 1.0e-15, 1.0e-16 }; @@ -190,9 +190,9 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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"); } @@ -206,7 +206,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { int previousCalls = Integer.MAX_VALUE; for (int i = -12; i < -2; ++i) { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); + TestFieldProblem1 pb = new TestFieldProblem1(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = FastMath.pow(10.0, i); @@ -214,9 +214,9 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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.assertTrue(handler.getMaximalValueError().getReal() < (factor * scalAbsoluteTolerance)); Assert.assertEquals(0, handler.getMaximalTimeError().getReal(), epsilon); @@ -237,7 +237,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { final double epsilonMaxValue, final String name) { - TestFieldProblem4 pb = new TestFieldProblem4<>(field); + TestFieldProblem4 pb = new TestFieldProblem4(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = 1.0e-8; @@ -245,7 +245,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); FieldEventHandler[] functions = pb.getEventsHandlers(); double convergence = 1.0e-8 * maxStep; @@ -253,7 +253,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { integ.addEventHandler(functions[l], Double.POSITIVE_INFINITY, convergence, 1000); } Assert.assertEquals(functions.length, integ.getEventHandlers().size()); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue); Assert.assertEquals(0, handler.getMaximalTimeError().getReal(), convergence); @@ -269,7 +269,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { protected > void doTestEventsErrors(final Field field) throws LocalException { - final TestFieldProblem1 pb = new TestFieldProblem1<>(field); + final TestFieldProblem1 pb = new TestFieldProblem1(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = 1.0e-8; @@ -277,7 +277,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); integ.addEventHandler(new FieldEventHandler() { @@ -299,7 +299,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { } }, Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 1000); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); } @@ -308,7 +308,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { protected > void doTestEventsNoConvergence(final Field field){ - final TestFieldProblem1 pb = new TestFieldProblem1<>(field); + final TestFieldProblem1 pb = new TestFieldProblem1(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double scalAbsoluteTolerance = 1.0e-8; @@ -316,7 +316,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); integ.addEventHandler(new FieldEventHandler() { @@ -336,7 +336,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { }, Double.POSITIVE_INFINITY, 1.0e-8 * maxStep, 3); try { - 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"); } catch (MaxCountExceededException mcee) { // Expected. @@ -348,13 +348,13 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { public abstract void testSanityChecks(); protected > void doTestSanityChecks(Field field) { - TestFieldProblem3 pb = new TestFieldProblem3<>(field); + TestFieldProblem3 pb = new TestFieldProblem3(field); try { EmbeddedRungeKuttaFieldIntegrator integrator = createIntegrator(field, 0, pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(), new double[4], new double[4]); - integrator.integrate(new FieldExpandableODE<>(pb), - new FieldODEState<>(pb.getInitialState().getTime(), + integrator.integrate(new FieldExpandableODE(pb), + new FieldODEState(pb.getInitialState().getTime(), MathArrays.buildArray(field, 6)), pb.getFinalTime()); Assert.fail("an exception should have been thrown"); @@ -365,7 +365,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { 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) { } @@ -374,7 +374,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { 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) { } @@ -391,7 +391,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { throws DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException, NoBracketingException { - TestFieldProblem5 pb = new TestFieldProblem5<>(field); + TestFieldProblem5 pb = new TestFieldProblem5(field); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).abs().getReal(); double scalAbsoluteTolerance = 1.0e-8; @@ -400,9 +400,9 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { EmbeddedRungeKuttaFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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(), epsilonLast); Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue); @@ -416,7 +416,7 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { protected > void doTestKepler(Field field, double epsilon) { - final TestFieldProblem3 pb = new TestFieldProblem3<>(field, field.getZero().add(0.9)); + final TestFieldProblem3 pb = new TestFieldProblem3(field, field.getZero().add(0.9)); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); double[] vecAbsoluteTolerance = { 1.0e-8, 1.0e-8, 1.0e-10, 1.0e-10 }; @@ -424,8 +424,8 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); - integ.addStepHandler(new KeplerHandler<>(pb, epsilon)); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.addStepHandler(new KeplerHandler(pb, epsilon)); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); } private static class KeplerHandler> implements FieldStepHandler { @@ -486,8 +486,8 @@ public abstract class EmbeddedRungeKuttaFieldIntegratorAbstractTest { t.subtract(t0).multiply(0.001).getReal(), t.subtract(t0).getReal(), 1.0e-12, 1.0e-12); FieldODEStateAndDerivative result = - integrator.integrate(new FieldExpandableODE<>(sinCos), - new FieldODEState<>(t0, y0), + integrator.integrate(new FieldExpandableODE(sinCos), + new FieldODEState(t0, y0), t); // check values diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegratorTest.java index d492cab4c..9a4898681 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldIntegratorTest.java @@ -26,7 +26,7 @@ public class EulerFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractT protected > RungeKuttaFieldIntegrator createIntegrator(Field field, T step) { - return new EulerFieldIntegrator<>(field, step); + return new EulerFieldIntegrator(field, step); } @Override diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolatorTest.java index 9f7f1ffe6..c5d1c3b72 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerFieldStepInterpolatorTest.java @@ -33,7 +33,7 @@ public class EulerFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpola FieldODEStateAndDerivative globalCurrentState, FieldODEStateAndDerivative softPreviousState, FieldODEStateAndDerivative softCurrentState, FieldEquationsMapper mapper) { - return new EulerFieldStepInterpolator<>(field, forward, yDotK, + return new EulerFieldStepInterpolator(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState, mapper); @@ -41,7 +41,7 @@ public class EulerFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpola protected > FieldButcherArrayProvider createButcherArrayProvider(final Field field) { - return new EulerFieldIntegrator<>(field, field.getOne()); + return new EulerFieldIntegrator(field, field.getOne()); } @Test diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/GillFieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/GillFieldIntegratorTest.java index 7100cbf95..877321beb 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/GillFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/GillFieldIntegratorTest.java @@ -26,7 +26,7 @@ public class GillFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTe protected > RungeKuttaFieldIntegrator createIntegrator(Field field, T step) { - return new GillFieldIntegrator<>(field, step); + return new GillFieldIntegrator(field, step); } @Override diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/GillFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/GillFieldStepInterpolatorTest.java index 3c7d21c7e..87a9b10ca 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/GillFieldStepInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/GillFieldStepInterpolatorTest.java @@ -34,7 +34,7 @@ public class GillFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolat FieldODEStateAndDerivative softPreviousState, FieldODEStateAndDerivative softCurrentState, FieldEquationsMapper mapper) { - return new GillFieldStepInterpolator<>(field, forward, yDotK, + return new GillFieldStepInterpolator(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState, mapper); @@ -42,7 +42,7 @@ public class GillFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpolat protected > FieldButcherArrayProvider createButcherArrayProvider(final Field field) { - return new GillFieldIntegrator<>(field, field.getOne()); + return new GillFieldIntegrator(field, field.getOne()); } @Test diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java index 6263e7c03..0630fcc17 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldIntegratorTest.java @@ -27,13 +27,13 @@ public class HighamHall54FieldIntegratorTest extends EmbeddedRungeKuttaFieldInte protected > EmbeddedRungeKuttaFieldIntegrator createIntegrator(Field field, final double minStep, final double maxStep, final double scalAbsoluteTolerance, final double scalRelativeTolerance) { - return new HighamHall54FieldIntegrator<>(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); + return new HighamHall54FieldIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); } protected > EmbeddedRungeKuttaFieldIntegrator createIntegrator(Field field, final double minStep, final double maxStep, final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance) { - return new HighamHall54FieldIntegrator<>(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); + return new HighamHall54FieldIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); } @Override diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java index 7559e9875..12c9473f1 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54FieldStepInterpolatorTest.java @@ -34,7 +34,7 @@ public class HighamHall54FieldStepInterpolatorTest extends RungeKuttaFieldStepIn FieldODEStateAndDerivative softPreviousState, FieldODEStateAndDerivative softCurrentState, FieldEquationsMapper mapper) { - return new HighamHall54FieldStepInterpolator<>(field, forward, yDotK, + return new HighamHall54FieldStepInterpolator(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState, mapper); @@ -42,7 +42,7 @@ public class HighamHall54FieldStepInterpolatorTest extends RungeKuttaFieldStepIn protected > FieldButcherArrayProvider createButcherArrayProvider(final Field field) { - return new HighamHall54FieldIntegrator<>(field, 0, 1, 1, 1); + return new HighamHall54FieldIntegrator(field, 0, 1, 1, 1); } @Test diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java index 31db1769c..9f459cfe6 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java @@ -30,7 +30,7 @@ public class LutherFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstract protected > RungeKuttaFieldIntegrator createIntegrator(Field field, T step) { - return new LutherFieldIntegrator<>(field, step); + return new LutherFieldIntegrator(field, step); } @Override diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java index 1a0d5e2f0..e35e1ecad 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldStepInterpolatorTest.java @@ -34,7 +34,7 @@ public class LutherFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpol FieldODEStateAndDerivative softPreviousState, FieldODEStateAndDerivative softCurrentState, FieldEquationsMapper mapper) { - return new LutherFieldStepInterpolator<>(field, forward, yDotK, + return new LutherFieldStepInterpolator(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState, mapper); @@ -42,7 +42,7 @@ public class LutherFieldStepInterpolatorTest extends RungeKuttaFieldStepInterpol protected > FieldButcherArrayProvider createButcherArrayProvider(final Field field) { - return new LutherFieldIntegrator<>(field, field.getOne()); + return new LutherFieldIntegrator(field, field.getOne()); } @Test diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegratorTest.java index 0f64075d1..d983146c5 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldIntegratorTest.java @@ -26,7 +26,7 @@ public class MidpointFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstra protected > RungeKuttaFieldIntegrator createIntegrator(Field field, T step) { - return new MidpointFieldIntegrator<>(field, step); + return new MidpointFieldIntegrator(field, step); } @Override diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldStepInterpolatorTest.java index ef0aa9cca..b1008e58b 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldStepInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointFieldStepInterpolatorTest.java @@ -34,7 +34,7 @@ public class MidpointFieldStepInterpolatorTest extends RungeKuttaFieldStepInterp FieldODEStateAndDerivative softPreviousState, FieldODEStateAndDerivative softCurrentState, FieldEquationsMapper mapper) { - return new MidpointFieldStepInterpolator<>(field, forward, yDotK, + return new MidpointFieldStepInterpolator(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState, mapper); @@ -42,7 +42,7 @@ public class MidpointFieldStepInterpolatorTest extends RungeKuttaFieldStepInterp protected > FieldButcherArrayProvider createButcherArrayProvider(final Field field) { - return new MidpointFieldIntegrator<>(field, field.getOne()); + return new MidpointFieldIntegrator(field, field.getOne()); } @Test diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegratorAbstractTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegratorAbstractTest.java index a6d480cef..788f732ad 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegratorAbstractTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldIntegratorAbstractTest.java @@ -151,8 +151,8 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { y0[i] = field.getOne().add(i); } - FieldODEStateAndDerivative result = integrator.integrate(new FieldExpandableODE<>(ode), - new FieldODEState<>(t0, y0), + FieldODEStateAndDerivative result = integrator.integrate(new FieldExpandableODE(ode), + new FieldODEState(t0, y0), tEvent); Assert.assertEquals(tEvent.getReal(), result.getTime().getReal(), epsilonT); T[] y = result.getState(); @@ -180,8 +180,8 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { return Action.CONTINUE; } }, Double.POSITIVE_INFINITY, 1.0e-20, 100); - result = integrator.integrate(new FieldExpandableODE<>(ode), - new FieldODEState<>(t0, y0), + result = integrator.integrate(new FieldExpandableODE(ode), + new FieldODEState(t0, y0), tEvent.add(120)); Assert.assertEquals(tEvent.add(120).getReal(), result.getTime().getReal(), epsilonT); y = result.getState(); @@ -201,17 +201,17 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { MaxCountExceededException, NoBracketingException { RungeKuttaFieldIntegrator integrator = createIntegrator(field, field.getZero().add(0.01)); try { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); - integrator.integrate(new FieldExpandableODE<>(pb), - new FieldODEState<>(field.getZero(), MathArrays.buildArray(field, pb.getDimension() + 10)), + TestFieldProblem1 pb = new TestFieldProblem1(field); + 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"); } catch(DimensionMismatchException ie) { } try { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); - integrator.integrate(new FieldExpandableODE<>(pb), - new FieldODEState<>(field.getZero(), MathArrays.buildArray(field, pb.getDimension())), + TestFieldProblem1 pb = new TestFieldProblem1(field); + integrator.integrate(new FieldExpandableODE(pb), + new FieldODEState(field.getZero(), MathArrays.buildArray(field, pb.getDimension())), field.getZero()); Assert.fail("an exception should have been thrown"); } catch(NumberIsTooSmallException ie) { @@ -231,12 +231,12 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { @SuppressWarnings("unchecked") TestFieldProblemAbstract[] allProblems = (TestFieldProblemAbstract[]) Array.newInstance(TestFieldProblemAbstract.class, 6); - allProblems[0] = new TestFieldProblem1<>(field); - allProblems[1] = new TestFieldProblem2<>(field); - allProblems[2] = new TestFieldProblem3<>(field); - allProblems[3] = new TestFieldProblem4<>(field); - allProblems[4] = new TestFieldProblem5<>(field); - allProblems[5] = new TestFieldProblem6<>(field); + allProblems[0] = new TestFieldProblem1(field); + allProblems[1] = new TestFieldProblem2(field); + allProblems[2] = new TestFieldProblem3(field); + allProblems[3] = new TestFieldProblem4(field); + allProblems[4] = new TestFieldProblem5(field); + allProblems[5] = new TestFieldProblem6(field); for (TestFieldProblemAbstract pb : allProblems) { T previousValueError = null; @@ -246,7 +246,7 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { T step = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(FastMath.pow(2.0, -i)); RungeKuttaFieldIntegrator integ = createIntegrator(field, step); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); FieldEventHandler[] functions = pb.getEventsHandlers(); for (int l = 0; l < functions.length; ++l) { @@ -254,7 +254,7 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { Double.POSITIVE_INFINITY, 1.0e-6 * step.getReal(), 1000); } Assert.assertEquals(functions.length, integ.getEventHandlers().size()); - FieldODEStateAndDerivative stop = integ.integrate(new FieldExpandableODE<>(pb), + FieldODEStateAndDerivative stop = integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); if (functions.length == 0) { @@ -292,13 +292,13 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { throws DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException, NoBracketingException { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); + TestFieldProblem1 pb = new TestFieldProblem1(field); T step = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.001); RungeKuttaFieldIntegrator integ = createIntegrator(field, step); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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(), epsilonLast); Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue); @@ -318,13 +318,13 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { throws DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException, NoBracketingException { - TestFieldProblem1 pb = new TestFieldProblem1<>(field); + TestFieldProblem1 pb = new TestFieldProblem1(field); T step = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.2); RungeKuttaFieldIntegrator integ = createIntegrator(field, step); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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.assertTrue(handler.getLastError().getReal() > belowLast); Assert.assertTrue(handler.getMaximalValueError().getReal() > belowMaxValue); @@ -344,13 +344,13 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { throws DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException, NoBracketingException { - TestFieldProblem5 pb = new TestFieldProblem5<>(field); + TestFieldProblem5 pb = new TestFieldProblem5(field); T step = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.001).abs(); RungeKuttaFieldIntegrator integ = createIntegrator(field, step); - TestFieldProblemHandler handler = new TestFieldProblemHandler<>(pb, integ); + 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(), epsilonLast); Assert.assertEquals(0, handler.getMaximalValueError().getReal(), epsilonMaxValue); @@ -366,12 +366,12 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { throws DimensionMismatchException, NumberIsTooSmallException, MaxCountExceededException, NoBracketingException { - final TestFieldProblem3 pb = new TestFieldProblem3<>(field, field.getZero().add(0.9)); + final TestFieldProblem3 pb = new TestFieldProblem3(field, field.getZero().add(0.9)); T step = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.0003); RungeKuttaFieldIntegrator integ = createIntegrator(field, step); - integ.addStepHandler(new KeplerHandler<>(pb, expectedMaxError, epsilon)); - integ.integrate(new FieldExpandableODE<>(pb), pb.getInitialState(), pb.getFinalTime()); + integ.addStepHandler(new KeplerHandler(pb, expectedMaxError, epsilon)); + integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); } private static class KeplerHandler> implements FieldStepHandler { @@ -424,7 +424,7 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { public void init(FieldODEStateAndDerivative s0, T t) { } }); - integ.integrate(new FieldExpandableODE<>(new FirstOrderFieldDifferentialEquations() { + integ.integrate(new FieldExpandableODE(new FirstOrderFieldDifferentialEquations() { public void init(T t0, T[] y0, T t) { } public T[] computeDerivatives(T t, T[] y) { @@ -435,7 +435,7 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { public int getDimension() { return 1; } - }), new FieldODEState<>(field.getZero(), MathArrays.buildArray(field, 1)), field.getZero().add(5.0)); + }), new FieldODEState(field.getZero(), MathArrays.buildArray(field, 1)), field.getZero().add(5.0)); } @Test @@ -443,7 +443,7 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { protected > void doTestSingleStep(final Field field, final double epsilon) { - final TestFieldProblem3 pb = new TestFieldProblem3<>(field, field.getZero().add(0.9)); + final TestFieldProblem3 pb = new TestFieldProblem3(field, field.getZero().add(0.9)); T h = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.0003); RungeKuttaFieldIntegrator integ = createIntegrator(field, field.getZero().add(Double.NaN)); @@ -489,7 +489,7 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { }; - integ.integrate(new FieldExpandableODE<>(equations), new FieldODEState<>(t0, y0), t); + integ.integrate(new FieldExpandableODE(equations), new FieldODEState(t0, y0), t); } @@ -497,14 +497,14 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { public abstract void testUnstableDerivative(); protected > void doTestUnstableDerivative(Field field, double epsilon) { - final StepFieldProblem stepProblem = new StepFieldProblem<>(field, + final StepFieldProblem stepProblem = new StepFieldProblem(field, field.getZero().add(0.0), field.getZero().add(1.0), 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); } @@ -513,7 +513,7 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { public abstract void testDerivativesConsistency(); protected > void doTestDerivativesConsistency(final Field field, double epsilon) { - TestFieldProblem3 pb = new TestFieldProblem3<>(field); + TestFieldProblem3 pb = new TestFieldProblem3(field); T step = pb.getFinalTime().subtract(pb.getInitialState().getTime()).multiply(0.001); RungeKuttaFieldIntegrator integ = createIntegrator(field, step); StepInterpolatorTestUtils.checkDerivativesConsistency(integ, pb, 1.0e-10); @@ -546,8 +546,8 @@ public abstract class RungeKuttaFieldIntegratorAbstractTest { RungeKuttaFieldIntegrator integrator = createIntegrator(omega.getField(), t.subtract(t0).multiply(0.001)); FieldODEStateAndDerivative result = - integrator.integrate(new FieldExpandableODE<>(sinCos), - new FieldODEState<>(t0, y0), + integrator.integrate(new FieldExpandableODE(sinCos), + new FieldODEState(t0, y0), t); // check values diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldStepInterpolatorAbstractTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldStepInterpolatorAbstractTest.java index ca77ac397..0205a8dab 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldStepInterpolatorAbstractTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaFieldStepInterpolatorAbstractTest.java @@ -52,7 +52,7 @@ public abstract class RungeKuttaFieldStepInterpolatorAbstractTest { 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); @@ -77,7 +77,7 @@ public abstract class RungeKuttaFieldStepInterpolatorAbstractTest { 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; @@ -103,7 +103,7 @@ public abstract class RungeKuttaFieldStepInterpolatorAbstractTest { double epsilonSin, double epsilonCos, double epsilonSinDot, double epsilonCosDot) { - FirstOrderFieldDifferentialEquations eqn = new SinCos<>(field); + FirstOrderFieldDifferentialEquations eqn = new SinCos(field); RungeKuttaFieldStepInterpolator fieldInterpolator = setUpInterpolator(field, eqn, 0.0, new double[] { 0.0, 1.0 }, 0.125); RungeKuttaStepInterpolator regularInterpolator = convertInterpolator(fieldInterpolator, eqn); @@ -160,7 +160,7 @@ public abstract class RungeKuttaFieldStepInterpolatorAbstractTest { fieldY[i] = field.getZero().add(y0[i]); } fieldYDotK[0] = eqn.computeDerivatives(t, fieldY); - FieldODEStateAndDerivative s0 = new FieldODEStateAndDerivative<>(t, fieldY, fieldYDotK[0]); + FieldODEStateAndDerivative s0 = new FieldODEStateAndDerivative(t, fieldY, fieldYDotK[0]); // perform one integration step, in order to get consistent derivatives T h = field.getZero().add(t1 - t0); @@ -182,11 +182,11 @@ public abstract class RungeKuttaFieldStepInterpolatorAbstractTest { fieldY[i] = fieldY[i].add(h.multiply(b[s].multiply(fieldYDotK[s][i]))); } } - FieldODEStateAndDerivative s1 = new FieldODEStateAndDerivative<>(t, fieldY, + FieldODEStateAndDerivative s1 = new FieldODEStateAndDerivative(t, fieldY, eqn.computeDerivatives(t, fieldY)); return createInterpolator(field, t1 > t0, fieldYDotK, s0, s1, s0, s1, - new FieldExpandableODE<>(eqn).getMapper()); + new FieldExpandableODE(eqn).getMapper()); } diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldIntegratorTest.java index 1739a2813..fd481ba6e 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldIntegratorTest.java @@ -26,7 +26,7 @@ public class ThreeEighthesFieldIntegratorTest extends RungeKuttaFieldIntegratorA protected > RungeKuttaFieldIntegrator createIntegrator(Field field, T step) { - return new ThreeEighthesFieldIntegrator<>(field, step); + return new ThreeEighthesFieldIntegrator(field, step); } @Override diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldStepInterpolatorTest.java index 601a32fb1..86ed2f9f8 100644 --- a/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldStepInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesFieldStepInterpolatorTest.java @@ -34,7 +34,7 @@ public class ThreeEighthesFieldStepInterpolatorTest extends RungeKuttaFieldStepI FieldODEStateAndDerivative softPreviousState, FieldODEStateAndDerivative softCurrentState, FieldEquationsMapper mapper) { - return new ThreeEighthesFieldStepInterpolator<>(field, forward, yDotK, + return new ThreeEighthesFieldStepInterpolator(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState, mapper); @@ -42,7 +42,7 @@ public class ThreeEighthesFieldStepInterpolatorTest extends RungeKuttaFieldStepI protected > FieldButcherArrayProvider createButcherArrayProvider(final Field field) { - return new ThreeEighthesFieldIntegrator<>(field, field.getOne()); + return new ThreeEighthesFieldIntegrator(field, field.getOne()); } @Test diff --git a/src/test/java/org/apache/commons/math4/ode/sampling/DummyFieldStepInterpolator.java b/src/test/java/org/apache/commons/math4/ode/sampling/DummyFieldStepInterpolator.java index cda8f2c19..f5467459d 100644 --- a/src/test/java/org/apache/commons/math4/ode/sampling/DummyFieldStepInterpolator.java +++ b/src/test/java/org/apache/commons/math4/ode/sampling/DummyFieldStepInterpolator.java @@ -40,7 +40,7 @@ public class DummyFieldStepInterpolator> final FieldODEStateAndDerivative newSoftPreviousState, final FieldODEStateAndDerivative newSoftCurrentState, final FieldEquationsMapper newMapper) { - return new DummyFieldStepInterpolator<>(newForward, + return new DummyFieldStepInterpolator(newForward, newGlobalPreviousState, newGlobalCurrentState, newSoftPreviousState, newSoftCurrentState, newMapper); 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 d3d5fcaff..5c592d3df 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()); } } diff --git a/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTestBase.java b/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTestBase.java index 6f6bfbec0..195532197 100644 --- a/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTestBase.java +++ b/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTestBase.java @@ -255,7 +255,7 @@ public abstract class StepNormalizerOutputTestBase double[] y = {0.0}; double start = reverse ? getEnd() : getStart(); double end = reverse ? getStart() : getEnd(); - output = new ArrayList<>(); + output = new ArrayList(); integ.integrate(this, start, y, end, y); double[] actual = new double[output.size()]; for(int i = 0; i < actual.length; i++) { diff --git a/src/test/java/org/apache/commons/math4/optim/SimplePointCheckerTest.java b/src/test/java/org/apache/commons/math4/optim/SimplePointCheckerTest.java index 262bb6082..e496e9e2a 100644 --- a/src/test/java/org/apache/commons/math4/optim/SimplePointCheckerTest.java +++ b/src/test/java/org/apache/commons/math4/optim/SimplePointCheckerTest.java @@ -32,7 +32,7 @@ public class SimplePointCheckerTest { public void testIterationCheck() { final int max = 10; final SimplePointChecker checker - = new SimplePointChecker<>(1e-1, 1e-2, max); + = new SimplePointChecker(1e-1, 1e-2, max); Assert.assertTrue(checker.converged(max, null, null)); Assert.assertTrue(checker.converged(max + 1, null, null)); } @@ -40,7 +40,7 @@ public class SimplePointCheckerTest { @Test public void testIterationCheckDisabled() { final SimplePointChecker checker - = new SimplePointChecker<>(1e-8, 1e-8); + = new SimplePointChecker(1e-8, 1e-8); final PointValuePair a = new PointValuePair(new double[] { 1d }, 1d); final PointValuePair b = new PointValuePair(new double[] { 10d }, 10d); diff --git a/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java b/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java index 503f782d3..987ab6c69 100644 --- a/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java +++ b/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java @@ -54,7 +54,7 @@ public class SimplexSolverTest { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 10, -57, -9, -24}, 0); - ArrayList constraints = new ArrayList<>(); + ArrayList constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] {0.5, -5.5, -2.5, 9}, Relationship.LEQ, 0)); constraints.add(new LinearConstraint(new double[] {0.5, -1.5, -0.5, 1}, Relationship.LEQ, 0)); @@ -75,7 +75,7 @@ public class SimplexSolverTest { LinearObjectiveFunction f = new LinearObjectiveFunction( new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0); - ArrayList constraints = new ArrayList<>(); + ArrayList constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] {0.0, 39.0, 23.0, 96.0, 15.0, 48.0, 9.0, 21.0, 48.0, 36.0, 76.0, 19.0, 88.0, 17.0, 16.0, 36.0,}, Relationship.GEQ, 15.0)); constraints.add(new LinearConstraint(new double[] {0.0, 59.0, 93.0, 12.0, 29.0, 78.0, 73.0, 87.0, 32.0, 70.0, 68.0, 24.0, 11.0, 26.0, 65.0, 25.0,}, Relationship.GEQ, 29.0)); @@ -97,7 +97,7 @@ public class SimplexSolverTest { LinearObjectiveFunction f = new LinearObjectiveFunction( new double[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 0.0); - ArrayList constraints = new ArrayList<>(); + ArrayList constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] {0.0, 16.0, 14.0, 69.0, 1.0, 85.0, 52.0, 43.0, 64.0, 97.0, 14.0, 74.0, 89.0, 28.0, 94.0, 58.0, 13.0, 22.0, 21.0, 17.0, 30.0, 25.0, 1.0, 59.0, 91.0, 78.0, 12.0, 74.0, 56.0, 3.0, 88.0,}, Relationship.GEQ, 91.0)); constraints.add(new LinearConstraint(new double[] {0.0, 60.0, 40.0, 81.0, 71.0, 72.0, 46.0, 45.0, 38.0, 48.0, 40.0, 17.0, 33.0, 85.0, 64.0, 32.0, 84.0, 3.0, 54.0, 44.0, 71.0, 67.0, 90.0, 95.0, 54.0, 99.0, 99.0, 29.0, 52.0, 98.0, 9.0,}, Relationship.GEQ, 54.0)); @@ -120,7 +120,7 @@ public class SimplexSolverTest { public void testMath781() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 2, 6, 7 }, 0); - ArrayList constraints = new ArrayList<>(); + ArrayList constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1, 2, 1 }, Relationship.LEQ, 2)); constraints.add(new LinearConstraint(new double[] { -1, 1, 1 }, Relationship.LEQ, -1)); constraints.add(new LinearConstraint(new double[] { 2, -3, 1 }, Relationship.LEQ, -1)); @@ -139,7 +139,7 @@ public class SimplexSolverTest { @Test public void testMath713NegativeVariable() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {1.0, 1.0}, 0.0d); - ArrayList constraints = new ArrayList<>(); + ArrayList constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] {1, 0}, Relationship.EQ, 1)); double epsilon = 1e-6; @@ -154,7 +154,7 @@ public class SimplexSolverTest { @Test public void testMath434NegativeVariable() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {0.0, 0.0, 1.0}, 0.0d); - ArrayList constraints = new ArrayList<>(); + ArrayList constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] {1, 1, 0}, Relationship.EQ, 5)); constraints.add(new LinearConstraint(new double[] {0, 0, 1}, Relationship.GEQ, -10)); @@ -174,7 +174,7 @@ public class SimplexSolverTest { double epsilon = 1e-6; LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {1.0, 0.0}, 0.0); - ArrayList constraints = new ArrayList<>(); + ArrayList constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] {epsilon/2, 0.5}, Relationship.EQ, 0)); constraints.add(new LinearConstraint(new double[] {1e-3, 0.1}, Relationship.EQ, 10)); @@ -189,7 +189,7 @@ public class SimplexSolverTest { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {1.0}, 0.0); double epsilon = 1e-6; - ArrayList constraints = new ArrayList<>(); + ArrayList constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] {200}, Relationship.GEQ, 1)); constraints.add(new LinearConstraint(new double[] {100}, Relationship.GEQ, 0.499900001)); @@ -205,7 +205,7 @@ public class SimplexSolverTest { public void testMath434PivotRowSelection2() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {0.0d, 1.0d, 1.0d, 0.0d, 0.0d, 0.0d, 0.0d}, 0.0d); - ArrayList constraints = new ArrayList<>(); + ArrayList constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] {1.0d, -0.1d, 0.0d, 0.0d, 0.0d, 0.0d, 0.0d}, Relationship.EQ, -0.1d)); constraints.add(new LinearConstraint(new double[] {1.0d, 0.0d, 0.0d, 0.0d, 0.0d, 0.0d, 0.0d}, Relationship.GEQ, -1e-18d)); constraints.add(new LinearConstraint(new double[] {0.0d, 1.0d, 0.0d, 0.0d, 0.0d, 0.0d, 0.0d}, Relationship.GEQ, 0.0d)); @@ -230,7 +230,7 @@ public class SimplexSolverTest { @Test public void testMath272() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 2, 2, 1 }, 0); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1, 1, 0 }, Relationship.GEQ, 1)); constraints.add(new LinearConstraint(new double[] { 1, 0, 1 }, Relationship.GEQ, 1)); constraints.add(new LinearConstraint(new double[] { 0, 1, 0 }, Relationship.GEQ, 1)); @@ -248,7 +248,7 @@ public class SimplexSolverTest { @Test public void testMath286() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 0.2, 0.7, 0.3, 0.6, 0.4 }, 0 ); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, Relationship.EQ, 23.0)); constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, Relationship.EQ, 23.0)); constraints.add(new LinearConstraint(new double[] { 1, 0, 0, 0, 0, 0 }, Relationship.GEQ, 10.0)); @@ -270,7 +270,7 @@ public class SimplexSolverTest { @Test public void testDegeneracy() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 0.7 }, 0 ); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1, 1 }, Relationship.LEQ, 18.0)); constraints.add(new LinearConstraint(new double[] { 1, 0 }, Relationship.GEQ, 10.0)); constraints.add(new LinearConstraint(new double[] { 0, 1 }, Relationship.GEQ, 8.0)); @@ -284,7 +284,7 @@ public class SimplexSolverTest { @Test public void testMath288() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 7, 3, 0, 0 }, 0 ); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 3, 0, -5, 0 }, Relationship.LEQ, 0.0)); constraints.add(new LinearConstraint(new double[] { 2, 0, 0, -5 }, Relationship.LEQ, 0.0)); constraints.add(new LinearConstraint(new double[] { 0, 3, 0, -5 }, Relationship.LEQ, 0.0)); @@ -300,7 +300,7 @@ public class SimplexSolverTest { @Test public void testMath290GEQ() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, 5 }, 0 ); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 2, 0 }, Relationship.GEQ, -1.0)); SimplexSolver solver = new SimplexSolver(); PointValuePair solution = solver.optimize(DEFAULT_MAX_ITER, f, new LinearConstraintSet(constraints), @@ -313,7 +313,7 @@ public class SimplexSolverTest { @Test(expected=NoFeasibleSolutionException.class) public void testMath290LEQ() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, 5 }, 0 ); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 2, 0 }, Relationship.LEQ, -1.0)); SimplexSolver solver = new SimplexSolver(); solver.optimize(DEFAULT_MAX_ITER, f, new LinearConstraintSet(constraints), @@ -323,7 +323,7 @@ public class SimplexSolverTest { @Test public void testMath293() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 0.8, 0.2, 0.7, 0.3, 0.4, 0.6}, 0 ); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, Relationship.EQ, 30.0)); constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, Relationship.EQ, 30.0)); constraints.add(new LinearConstraint(new double[] { 0.8, 0.2, 0.0, 0.0, 0.0, 0.0 }, Relationship.GEQ, 10.0)); @@ -347,7 +347,7 @@ public class SimplexSolverTest { double valC = 0.4 * solution1.getPoint()[4] + 0.6 * solution1.getPoint()[5]; f = new LinearObjectiveFunction(new double[] { 0.8, 0.2, 0.7, 0.3, 0.4, 0.6}, 0 ); - constraints = new ArrayList<>(); + constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1, 0, 1, 0, 1, 0 }, Relationship.EQ, 30.0)); constraints.add(new LinearConstraint(new double[] { 0, 1, 0, 1, 0, 1 }, Relationship.EQ, 30.0)); constraints.add(new LinearConstraint(new double[] { 0.8, 0.2, 0.0, 0.0, 0.0, 0.0 }, Relationship.GEQ, valA)); @@ -374,7 +374,7 @@ public class SimplexSolverTest { } private List createMath930Constraints() { - List constraints = new ArrayList<>(); + List constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] {1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 0}, Relationship.GEQ, 0.0)); constraints.add(new LinearConstraint(new double[] {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1}, Relationship.GEQ, 0.0)); constraints.add(new LinearConstraint(new double[] {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1}, Relationship.LEQ, 0.0)); @@ -479,7 +479,7 @@ public class SimplexSolverTest { public void testSimplexSolver() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 15, 10 }, 7); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1, 0 }, Relationship.LEQ, 2)); constraints.add(new LinearConstraint(new double[] { 0, 1 }, Relationship.LEQ, 3)); constraints.add(new LinearConstraint(new double[] { 1, 1 }, Relationship.EQ, 4)); @@ -495,7 +495,7 @@ public class SimplexSolverTest { @Test public void testSingleVariableAndConstraint() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 3 }, 0); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1 }, Relationship.LEQ, 10)); SimplexSolver solver = new SimplexSolver(); @@ -512,7 +512,7 @@ public class SimplexSolverTest { @Test public void testModelWithNoArtificialVars() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 15, 10 }, 0); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1, 0 }, Relationship.LEQ, 2)); constraints.add(new LinearConstraint(new double[] { 0, 1 }, Relationship.LEQ, 3)); constraints.add(new LinearConstraint(new double[] { 1, 1 }, Relationship.LEQ, 4)); @@ -528,7 +528,7 @@ public class SimplexSolverTest { @Test public void testMinimization() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { -2, 1 }, -5); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1, 2 }, Relationship.LEQ, 6)); constraints.add(new LinearConstraint(new double[] { 3, 2 }, Relationship.LEQ, 12)); constraints.add(new LinearConstraint(new double[] { 0, 1 }, Relationship.GEQ, 0)); @@ -544,7 +544,7 @@ public class SimplexSolverTest { @Test public void testSolutionWithNegativeDecisionVariable() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { -2, 1 }, 0); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1, 1 }, Relationship.GEQ, 6)); constraints.add(new LinearConstraint(new double[] { 1, 2 }, Relationship.LEQ, 14)); @@ -559,7 +559,7 @@ public class SimplexSolverTest { @Test(expected = NoFeasibleSolutionException.class) public void testInfeasibleSolution() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 15 }, 0); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1 }, Relationship.LEQ, 1)); constraints.add(new LinearConstraint(new double[] { 1 }, Relationship.GEQ, 3)); @@ -571,7 +571,7 @@ public class SimplexSolverTest { @Test(expected = UnboundedSolutionException.class) public void testUnboundedSolution() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 15, 10 }, 0); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1, 0 }, Relationship.EQ, 2)); SimplexSolver solver = new SimplexSolver(); @@ -582,7 +582,7 @@ public class SimplexSolverTest { @Test public void testRestrictVariablesToNonNegative() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 409, 523, 70, 204, 339 }, 0); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 43, 56, 345, 56, 5 }, Relationship.LEQ, 4567456)); constraints.add(new LinearConstraint(new double[] { 12, 45, 7, 56, 23 }, Relationship.LEQ, 56454)); constraints.add(new LinearConstraint(new double[] { 8, 768, 0, 34, 7456 }, Relationship.LEQ, 1923421)); @@ -604,7 +604,7 @@ public class SimplexSolverTest { public void testEpsilon() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 10, 5, 1 }, 0); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 9, 8, 0 }, Relationship.EQ, 17)); constraints.add(new LinearConstraint(new double[] { 0, 7, 8 }, Relationship.LEQ, 7)); constraints.add(new LinearConstraint(new double[] { 10, 0, 2 }, Relationship.LEQ, 10)); @@ -621,7 +621,7 @@ public class SimplexSolverTest { @Test public void testTrivialModel() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 1, 1 }, 0); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 1, 1 }, Relationship.EQ, 0)); SimplexSolver solver = new SimplexSolver(); @@ -657,7 +657,7 @@ public class SimplexSolverTest { 1, 1, 1, 1, 1, 1}; LinearObjectiveFunction f = new LinearObjectiveFunction(objective, 0); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(equationFromString(objective.length, "x0 + x1 + x2 + x3 - x12 = 0")); constraints.add(equationFromString(objective.length, "x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 - x13 = 0")); constraints.add(equationFromString(objective.length, "x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 >= 49")); @@ -765,7 +765,7 @@ public class SimplexSolverTest { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 7, 3, 0, 0 }, 0 ); - List constraints = new ArrayList<>(); + List constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] { 3, 0, -5, 0 }, Relationship.LEQ, 0.0)); constraints.add(new LinearConstraint(new double[] { 2, 0, 0, -5 }, Relationship.LEQ, 0.0)); constraints.add(new LinearConstraint(new double[] { 0, 3, 0, -5 }, Relationship.LEQ, 0.0)); @@ -805,7 +805,7 @@ public class SimplexSolverTest { // x1,x2,x3 >= 0 LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] { 2, 15, 18 }, 0); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); // this constraint is wrong, the dimension is less than expected one constraints.add(new LinearConstraint(new double[] { -1, 2 - 6 }, Relationship.LEQ, -10)); constraints.add(new LinearConstraint(new double[] { 0, 1, 2 }, Relationship.LEQ, 6)); diff --git a/src/test/java/org/apache/commons/math4/optim/linear/SimplexTableauTest.java b/src/test/java/org/apache/commons/math4/optim/linear/SimplexTableauTest.java index be774c4cc..e0c99da4c 100644 --- a/src/test/java/org/apache/commons/math4/optim/linear/SimplexTableauTest.java +++ b/src/test/java/org/apache/commons/math4/optim/linear/SimplexTableauTest.java @@ -65,7 +65,7 @@ public class SimplexTableauTest { @Test public void testTableauWithNoArtificialVars() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {15, 10}, 0); - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] {1, 0}, Relationship.LEQ, 2)); constraints.add(new LinearConstraint(new double[] {0, 1}, Relationship.LEQ, 3)); constraints.add(new LinearConstraint(new double[] {1, 1}, Relationship.LEQ, 4)); @@ -94,7 +94,7 @@ public class SimplexTableauTest { } private Collection createConstraints() { - Collection constraints = new ArrayList<>(); + Collection constraints = new ArrayList(); constraints.add(new LinearConstraint(new double[] {1, 0}, Relationship.LEQ, 2)); constraints.add(new LinearConstraint(new double[] {0, 1}, Relationship.LEQ, 3)); constraints.add(new LinearConstraint(new double[] {1, 1}, Relationship.EQ, 4)); diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/CircleScalar.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/CircleScalar.java index 0c802543a..4c2acaa32 100644 --- a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/CircleScalar.java +++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/CircleScalar.java @@ -32,7 +32,7 @@ public class CircleScalar { private ArrayList points; public CircleScalar() { - points = new ArrayList<>(); + points = new ArrayList(); } public void addPoint(double px, double py) { diff --git a/src/test/java/org/apache/commons/math4/primes/PrimesTest.java b/src/test/java/org/apache/commons/math4/primes/PrimesTest.java index 831a86ee6..26bcd37f9 100644 --- a/src/test/java/org/apache/commons/math4/primes/PrimesTest.java +++ b/src/test/java/org/apache/commons/math4/primes/PrimesTest.java @@ -140,7 +140,7 @@ public class PrimesTest { } return out; } - static final HashSet PRIMES_SET = new HashSet<>(); + static final HashSet PRIMES_SET = new HashSet(); static { for (int p : PRIMES) { PRIMES_SET.add(p); diff --git a/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java b/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java index d4d5bc215..4854979c0 100644 --- a/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java +++ b/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java @@ -62,7 +62,7 @@ public final class EmpiricalDistributionTest extends RealDistributionAbstractTes super.setUp(); empiricalDistribution = new EmpiricalDistribution(100); url = getClass().getResource("testData.txt"); - final ArrayList list = new ArrayList<>(); + final ArrayList list = new ArrayList(); try { empiricalDistribution2 = new EmpiricalDistribution(100); BufferedReader in = diff --git a/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java index d7d7bb59d..2982efb35 100644 --- a/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java +++ b/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java @@ -483,7 +483,7 @@ public class RandomDataGeneratorTest { * [binBounds[binCount - 2], upper = binBounds[binCount - 1]), [upper, +inf) * */ - List binBounds = new ArrayList<>(); + List binBounds = new ArrayList(); binBounds.add(lower); int bound = lower + binWidth; while (bound < upper - binWidth) { @@ -872,14 +872,14 @@ public class RandomDataGeneratorTest { long[] observed = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; double[] expected = { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }; - HashSet cPop = new HashSet<>(); // {0,1,2,3,4} + HashSet cPop = new HashSet(); // {0,1,2,3,4} for (int i = 0; i < 5; i++) { cPop.add(Integer.toString(i)); } Object[] sets = new Object[10]; // 2-sets from 5 for (int i = 0; i < 10; i++) { - HashSet hs = new HashSet<>(); + HashSet hs = new HashSet(); hs.add(c[i][0]); hs.add(c[i][1]); sets[i] = hs; @@ -898,7 +898,7 @@ public class RandomDataGeneratorTest { testStatistic.chiSquare(expected, observed) < 27.88); // Make sure sample of size = size of collection returns same collection - HashSet hs = new HashSet<>(); + HashSet hs = new HashSet(); hs.add("one"); Object[] one = randomData.nextSample(hs, 1); String oneString = (String) one[0]; @@ -916,7 +916,7 @@ public class RandomDataGeneratorTest { // Make sure we fail for empty collection try { - hs = new HashSet<>(); + hs = new HashSet(); one = randomData.nextSample(hs, 0); Assert.fail("n = k = 0, expecting MathIllegalArgumentException"); } catch (MathIllegalArgumentException ex) { @@ -928,7 +928,7 @@ public class RandomDataGeneratorTest { private int findSample(Object[] u, Object[] samp) { for (int i = 0; i < u.length; i++) { HashSet set = (HashSet) u[i]; - HashSet sampSet = new HashSet<>(); + HashSet sampSet = new HashSet(); for (int j = 0; j < samp.length; j++) { sampSet.add(samp[j]); } diff --git a/src/test/java/org/apache/commons/math4/random/SynchronizedRandomGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/SynchronizedRandomGeneratorTest.java index f4ec2cdf7..b66a1272b 100644 --- a/src/test/java/org/apache/commons/math4/random/SynchronizedRandomGeneratorTest.java +++ b/src/test/java/org/apache/commons/math4/random/SynchronizedRandomGeneratorTest.java @@ -95,7 +95,7 @@ public class SynchronizedRandomGeneratorTest { final RandomGenerator rng = new MersenneTwister(); final RandomGenerator wrapper = sync ? new SynchronizedRandomGenerator(rng) : rng; - final List> tasks = new ArrayList<>(); + final List> tasks = new ArrayList>(); for (int i = 0; i < numGenerators; i++) { tasks.add(new Callable() { @Override diff --git a/src/test/java/org/apache/commons/math4/stat/FrequencyTest.java b/src/test/java/org/apache/commons/math4/stat/FrequencyTest.java index 7263a1e54..444c57ae9 100644 --- a/src/test/java/org/apache/commons/math4/stat/FrequencyTest.java +++ b/src/test/java/org/apache/commons/math4/stat/FrequencyTest.java @@ -367,7 +367,7 @@ public final class FrequencyTest { Frequency h = new Frequency(); h.addValue(THREE_LONG); - List coll = new ArrayList<>(); + List coll = new ArrayList(); coll.add(g); coll.add(h); f.merge(coll); diff --git a/src/test/java/org/apache/commons/math4/stat/data/CertifiedDataAbstractTest.java b/src/test/java/org/apache/commons/math4/stat/data/CertifiedDataAbstractTest.java index 74262b923..32cfbdd02 100644 --- a/src/test/java/org/apache/commons/math4/stat/data/CertifiedDataAbstractTest.java +++ b/src/test/java/org/apache/commons/math4/stat/data/CertifiedDataAbstractTest.java @@ -48,7 +48,7 @@ public abstract class CertifiedDataAbstractTest { public void setUp() throws IOException { descriptives = new DescriptiveStatistics(); summaries = new SummaryStatistics(); - certifiedValues = new HashMap<>(); + certifiedValues = new HashMap(); loadData(); } diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java index 94c980d2b..5324ecf4f 100644 --- a/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java +++ b/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java @@ -147,7 +147,7 @@ public class AggregateSummaryStatisticsTest { for (int i = 0; i < nSamples; i++) { subSampleStats[i] = new SummaryStatistics(); } - Collection aggregate = new ArrayList<>(); + Collection aggregate = new ArrayList(); for (int i = 0; i < nSamples; i++) { for (int j = 0; j < subSamples[i].length; j++) { subSampleStats[i].addValue(subSamples[i][j]); @@ -183,7 +183,7 @@ public class AggregateSummaryStatisticsTest { for (int i = 0; i < nSamples; i++) { subSampleStats[i] = new SummaryStatistics(); } - Collection aggregate = new ArrayList<>(); + Collection aggregate = new ArrayList(); for (int i = 0; i < nSamples; i++) { for (int j = 0; j < subSamples[i].length; j++) { subSampleStats[i].addValue(subSamples[i][j]); @@ -213,7 +213,7 @@ public class AggregateSummaryStatisticsTest { for (int i = 0; i < 5; i++) { subSampleStats[i] = new SummaryStatistics(); } - Collection aggregate = new ArrayList<>(); + Collection aggregate = new ArrayList(); for (int i = 0; i < 5; i++) { for (int j = 0; j < subSamples[i].length; j++) { subSampleStats[i].addValue(subSamples[i][j]); @@ -242,7 +242,7 @@ public class AggregateSummaryStatisticsTest { for (int i = 0; i < 4; i++) { subSampleStats[i] = new SummaryStatistics(); } - Collection aggregate = new ArrayList<>(); + Collection aggregate = new ArrayList(); for (int i = 0; i < 4; i++) { for (int j = 0; j < subSamples[i].length; j++) { subSampleStats[i].addValue(subSamples[i][j]); diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java b/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java index 19b9b9f92..7bdd8009b 100644 --- a/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java +++ b/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java @@ -47,7 +47,7 @@ public class ListUnivariateImpl extends DescriptiveStatistics implements Seriali * No argument Constructor */ public ListUnivariateImpl(){ - this(new ArrayList<>()); + this(new ArrayList()); } /** diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImplTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImplTest.java index 2e22fc38e..964d06618 100644 --- a/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImplTest.java +++ b/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImplTest.java @@ -49,7 +49,7 @@ public final class ListUnivariateImplTest { /** test stats */ @Test public void testStats() { - List externalList = new ArrayList<>(); + List externalList = new ArrayList(); DescriptiveStatistics u = new ListUnivariateImpl( externalList ); @@ -72,7 +72,7 @@ public final class ListUnivariateImplTest { @Test public void testN0andN1Conditions() { - List list = new ArrayList<>(); + List list = new ArrayList(); DescriptiveStatistics u = new ListUnivariateImpl( list ); @@ -105,7 +105,7 @@ public final class ListUnivariateImplTest { @Test public void testProductAndGeometricMean() { - ListUnivariateImpl u = new ListUnivariateImpl(new ArrayList<>()); + ListUnivariateImpl u = new ListUnivariateImpl(new ArrayList()); u.setWindowSize(10); u.addValue( 1.0 ); diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/MixedListUnivariateImplTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/MixedListUnivariateImplTest.java index 7d3ab049e..410a2e1b8 100644 --- a/src/test/java/org/apache/commons/math4/stat/descriptive/MixedListUnivariateImplTest.java +++ b/src/test/java/org/apache/commons/math4/stat/descriptive/MixedListUnivariateImplTest.java @@ -59,7 +59,7 @@ public final class MixedListUnivariateImplTest { /** test stats */ @Test public void testStats() { - List externalList = new ArrayList<>(); + List externalList = new ArrayList(); DescriptiveStatistics u = new ListUnivariateImpl(externalList,transformers); @@ -82,7 +82,7 @@ public final class MixedListUnivariateImplTest { @Test public void testN0andN1Conditions() { - DescriptiveStatistics u = new ListUnivariateImpl(new ArrayList<>(),transformers); + DescriptiveStatistics u = new ListUnivariateImpl(new ArrayList(),transformers); Assert.assertTrue( "Mean of n = 0 set should be NaN", @@ -112,7 +112,7 @@ public final class MixedListUnivariateImplTest { @Test public void testSkewAndKurtosis() { ListUnivariateImpl u = - new ListUnivariateImpl(new ArrayList<>(), transformers); + new ListUnivariateImpl(new ArrayList(), transformers); u.addObject("12.5"); u.addObject(Integer.valueOf(12)); @@ -146,7 +146,7 @@ public final class MixedListUnivariateImplTest { @Test public void testProductAndGeometricMean() { - ListUnivariateImpl u = new ListUnivariateImpl(new ArrayList<>(),transformers); + ListUnivariateImpl u = new ListUnivariateImpl(new ArrayList(),transformers); u.setWindowSize(10); u.addValue(1.0); diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/UnivariateStatisticAbstractTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/UnivariateStatisticAbstractTest.java index c3542b291..6f12b1e18 100644 --- a/src/test/java/org/apache/commons/math4/stat/descriptive/UnivariateStatisticAbstractTest.java +++ b/src/test/java/org/apache/commons/math4/stat/descriptive/UnivariateStatisticAbstractTest.java @@ -188,7 +188,7 @@ public abstract class UnivariateStatisticAbstractTest { // and fill valuesList with values from values array with // values[i] repeated weights[i] times, each i final RealDistribution valueDist = new NormalDistribution(mu, sigma); - List valuesList = new ArrayList<>(); + List valuesList = new ArrayList(); for (int i = 0; i < len; i++) { double value = valueDist.sample(); values[i] = value; diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java index bab2ec708..dfdcd4ece 100644 --- a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java +++ b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java @@ -209,7 +209,7 @@ public class PSquarePercentileTest extends public void testHashCodeInMarkers() { PSquarePercentile p = new PSquarePercentile(95); PSquarePercentile p2 = new PSquarePercentile(95); - Set s = new HashSet<>(); + Set s = new HashSet(); s.add(p); s.add(p2); Assert.assertEquals(1, s.size()); @@ -237,7 +237,7 @@ public class PSquarePercentileTest extends 95.1959, 95.1442, 95.0610, 95.1591, 95.1195, 95.1772, 95.0925, 95.1990, 95.1682 }), 0.0); Assert.assertTrue(m1.equals(m2)); - Set setMarkers = new LinkedHashSet<>(); + Set setMarkers = new LinkedHashSet(); Assert.assertTrue(setMarkers.add(m1)); Assert.assertFalse(setMarkers.add(m2)); Assert.assertEquals(1, setMarkers.size()); diff --git a/src/test/java/org/apache/commons/math4/stat/inference/OneWayAnovaTest.java b/src/test/java/org/apache/commons/math4/stat/inference/OneWayAnovaTest.java index cf35f3067..3442382c3 100644 --- a/src/test/java/org/apache/commons/math4/stat/inference/OneWayAnovaTest.java +++ b/src/test/java/org/apache/commons/math4/stat/inference/OneWayAnovaTest.java @@ -47,7 +47,7 @@ public class OneWayAnovaTest { @Test public void testAnovaFValue() { // Target comparison values computed using R version 2.6.0 (Linux version) - List threeClasses = new ArrayList<>(); + List threeClasses = new ArrayList(); threeClasses.add(classA); threeClasses.add(classB); threeClasses.add(classC); @@ -55,14 +55,14 @@ public class OneWayAnovaTest { Assert.assertEquals("ANOVA F-value", 24.67361709460624, testStatistic.anovaFValue(threeClasses), 1E-12); - List twoClasses = new ArrayList<>(); + List twoClasses = new ArrayList(); twoClasses.add(classA); twoClasses.add(classB); Assert.assertEquals("ANOVA F-value", 0.0150579150579, testStatistic.anovaFValue(twoClasses), 1E-12); - List emptyContents = new ArrayList<>(); + List emptyContents = new ArrayList(); emptyContents.add(emptyArray); emptyContents.add(classC); try { @@ -72,7 +72,7 @@ public class OneWayAnovaTest { // expected } - List tooFew = new ArrayList<>(); + List tooFew = new ArrayList(); tooFew.add(classA); try { testStatistic.anovaFValue(tooFew); @@ -86,7 +86,7 @@ public class OneWayAnovaTest { @Test public void testAnovaPValue() { // Target comparison values computed using R version 2.6.0 (Linux version) - List threeClasses = new ArrayList<>(); + List threeClasses = new ArrayList(); threeClasses.add(classA); threeClasses.add(classB); threeClasses.add(classC); @@ -94,7 +94,7 @@ public class OneWayAnovaTest { Assert.assertEquals("ANOVA P-value", 6.959446E-06, testStatistic.anovaPValue(threeClasses), 1E-12); - List twoClasses = new ArrayList<>(); + List twoClasses = new ArrayList(); twoClasses.add(classA); twoClasses.add(classB); @@ -106,7 +106,7 @@ public class OneWayAnovaTest { @Test public void testAnovaPValueSummaryStatistics() { // Target comparison values computed using R version 2.6.0 (Linux version) - List threeClasses = new ArrayList<>(); + List threeClasses = new ArrayList(); SummaryStatistics statsA = new SummaryStatistics(); for (double a : classA) { statsA.addValue(a); @@ -126,7 +126,7 @@ public class OneWayAnovaTest { Assert.assertEquals("ANOVA P-value", 6.959446E-06, testStatistic.anovaPValue(threeClasses, true), 1E-12); - List twoClasses = new ArrayList<>(); + List twoClasses = new ArrayList(); twoClasses.add(statsA); twoClasses.add(statsB); @@ -138,14 +138,14 @@ public class OneWayAnovaTest { @Test public void testAnovaTest() { // Target comparison values computed using R version 2.3.1 (Linux version) - List threeClasses = new ArrayList<>(); + List threeClasses = new ArrayList(); threeClasses.add(classA); threeClasses.add(classB); threeClasses.add(classC); Assert.assertTrue("ANOVA Test P<0.01", testStatistic.anovaTest(threeClasses, 0.01)); - List twoClasses = new ArrayList<>(); + List twoClasses = new ArrayList(); twoClasses.add(classA); twoClasses.add(classB); diff --git a/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java b/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java index 59914e050..b22131e2d 100644 --- a/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java +++ b/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java @@ -457,7 +457,7 @@ public class TestUtilsTest { private double[] classC = {110.0, 115.0, 111.0, 117.0, 128.0}; - private List classes = new ArrayList<>(); + private List classes = new ArrayList(); private OneWayAnova oneWayAnova = new OneWayAnova(); @Test diff --git a/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java b/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java index 1dd31cecc..fece22515 100644 --- a/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java +++ b/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java @@ -125,7 +125,7 @@ public class ArithmeticUtilsTest { @Test public void testGcdConsistency() { int[] primeList = {19, 23, 53, 67, 73, 79, 101, 103, 111, 131}; - ArrayList primes = new ArrayList<>(); + ArrayList primes = new ArrayList(); for (int i = 0; i < primeList.length; i++) { primes.add(Integer.valueOf(primeList[i])); } diff --git a/src/test/java/org/apache/commons/math4/util/CombinatoricsUtilsTest.java b/src/test/java/org/apache/commons/math4/util/CombinatoricsUtilsTest.java index faaf78666..0ad8a02e5 100644 --- a/src/test/java/org/apache/commons/math4/util/CombinatoricsUtilsTest.java +++ b/src/test/java/org/apache/commons/math4/util/CombinatoricsUtilsTest.java @@ -38,7 +38,7 @@ import org.junit.Test; public class CombinatoricsUtilsTest { /** cached binomial coefficients */ - private static final List> binomialCache = new ArrayList<>(); + private static final List> binomialCache = new ArrayList>(); /** Verify that b(0,0) = 1 */ @Test diff --git a/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java b/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java index d38d42e5b..77a0c7cb1 100644 --- a/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java +++ b/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java @@ -212,7 +212,7 @@ public class FastMathStrictComparisonTest { @Parameters public static List data() throws Exception { String singleMethod = System.getProperty("testMethod"); - List list = new ArrayList<>(); + List list = new ArrayList(); for(Method mathMethod : StrictMath.class.getDeclaredMethods()) { method: if (Modifier.isPublic(mathMethod.getModifiers())){// Only test public methods diff --git a/src/test/java/org/apache/commons/math4/util/IntegerSequenceTest.java b/src/test/java/org/apache/commons/math4/util/IntegerSequenceTest.java index 4b29906a1..25eec4f15 100644 --- a/src/test/java/org/apache/commons/math4/util/IntegerSequenceTest.java +++ b/src/test/java/org/apache/commons/math4/util/IntegerSequenceTest.java @@ -33,7 +33,7 @@ public class IntegerSequenceTest { final int max = 7; final int step = 2; - final List seq = new ArrayList<>(); + final List seq = new ArrayList(); final IntegerSequence.Range r = IntegerSequence.range(start, max, step); final int numTimes = 3; @@ -53,7 +53,7 @@ public class IntegerSequenceTest { final int max = 7; final int step = 2; - final List seq = new ArrayList<>(); + final List seq = new ArrayList(); final IntegerSequence.Range r = IntegerSequence.range(start, max, step); for (Integer i : r) { seq.add(i); @@ -72,7 +72,7 @@ public class IntegerSequenceTest { final int max = -1; final int step = 2; - final List seq = new ArrayList<>(); + final List seq = new ArrayList(); final IntegerSequence.Range r = IntegerSequence.range(start, max, step); for (Integer i : r) { seq.add(i); @@ -91,7 +91,7 @@ public class IntegerSequenceTest { final int max = -8; final int step = -3; - final List seq = new ArrayList<>(); + final List seq = new ArrayList(); final IntegerSequence.Range r = IntegerSequence.range(start, max, step); for (Integer i : r) { seq.add(i); @@ -110,7 +110,7 @@ public class IntegerSequenceTest { final int max = 1; final int step = -1; - final List seq = new ArrayList<>(); + final List seq = new ArrayList(); final IntegerSequence.Range r = IntegerSequence.range(start, max, step); for (Integer i : r) { seq.add(i); @@ -126,7 +126,7 @@ public class IntegerSequenceTest { final int start = -2; final int end = 4; - final List seq = new ArrayList<>(); + final List seq = new ArrayList(); for (Integer i : IntegerSequence.range(start, end)) { seq.add(i); } @@ -141,7 +141,7 @@ public class IntegerSequenceTest { final int start = 2; final int end = 0; - final List seq = new ArrayList<>(); + final List seq = new ArrayList(); final IntegerSequence.Range r = IntegerSequence.range(start, end); for (Integer i : r) { seq.add(i); @@ -157,7 +157,7 @@ public class IntegerSequenceTest { final int max = -1; final int step = -1; - final List seq = new ArrayList<>(); + final List seq = new ArrayList(); final IntegerSequence.Range r = IntegerSequence.range(start, max, step); for (Integer i : r) { seq.add(i); diff --git a/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java b/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java index eea856025..0841868cd 100644 --- a/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java +++ b/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java @@ -37,7 +37,7 @@ import org.junit.Test; @SuppressWarnings("boxing") public class OpenIntToDoubleHashMapTest { - private Map javaMap = new HashMap<>(); + private Map javaMap = new HashMap(); @Before public void setUp() throws Exception { @@ -60,7 +60,7 @@ public class OpenIntToDoubleHashMapTest { } private Map generate() { - Map map = new HashMap<>(); + Map map = new HashMap(); Random r = new Random(); for (int i = 0; i < 2000; ++i) map.put(r.nextInt(), r.nextDouble()); @@ -168,7 +168,7 @@ public class OpenIntToDoubleHashMapTest { OpenIntToDoubleHashMap map = createFromJavaMap(); int mapSize = javaMap.size(); int count = 0; - Set keysInMap = new HashSet<>(javaMap.keySet()); + Set keysInMap = new HashSet(javaMap.keySet()); for (Map.Entry mapEntry : javaMap.entrySet()) { keysInMap.remove(mapEntry.getKey()); map.remove(mapEntry.getKey()); @@ -206,7 +206,7 @@ public class OpenIntToDoubleHashMapTest { * Returns a map with at least 100 elements where each element is absent from javaMap. */ private Map generateAbsent() { - Map generated = new HashMap<>(); + Map generated = new HashMap(); do { generated.putAll(generate()); for (Integer key : javaMap.keySet()) diff --git a/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java b/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java index d7de53c08..6df12dd46 100644 --- a/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java +++ b/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java @@ -38,7 +38,7 @@ import org.junit.Test; @SuppressWarnings("boxing") public class OpenIntToFieldTest { - private Map javaMap = new HashMap<>(); + private Map javaMap = new HashMap(); private FractionField field = FractionField.getInstance(); @Before @@ -62,7 +62,7 @@ public class OpenIntToFieldTest { } private Map generate() { - Map map = new HashMap<>(); + Map map = new HashMap(); Random r = new Random(); double dd=0; for (int i = 0; i < 2000; ++i) @@ -76,7 +76,7 @@ public class OpenIntToFieldTest { } private OpenIntToFieldHashMap createFromJavaMap(Field field) { - OpenIntToFieldHashMap map = new OpenIntToFieldHashMap<>(field); + OpenIntToFieldHashMap map = new OpenIntToFieldHashMap(field); for (Map.Entry mapEntry : javaMap.entrySet()) { map.put(mapEntry.getKey(), mapEntry.getValue()); } @@ -85,19 +85,19 @@ public class OpenIntToFieldTest { @Test public void testPutAndGetWith0ExpectedSize() { - OpenIntToFieldHashMap map = new OpenIntToFieldHashMap<>(field,0); + OpenIntToFieldHashMap map = new OpenIntToFieldHashMap(field,0); assertPutAndGet(map); } @Test public void testPutAndGetWithExpectedSize() { - OpenIntToFieldHashMap map = new OpenIntToFieldHashMap<>(field,500); + OpenIntToFieldHashMap map = new OpenIntToFieldHashMap(field,500); assertPutAndGet(map); } @Test public void testPutAndGet() { - OpenIntToFieldHashMap map = new OpenIntToFieldHashMap<>(field); + OpenIntToFieldHashMap map = new OpenIntToFieldHashMap(field); assertPutAndGet(map); } @@ -149,7 +149,7 @@ public class OpenIntToFieldTest { @Test public void testGetFromEmpty() { - OpenIntToFieldHashMap map = new OpenIntToFieldHashMap<>(field); + OpenIntToFieldHashMap map = new OpenIntToFieldHashMap(field); Assert.assertTrue(field.getZero().equals(map.get(5))); Assert.assertTrue(field.getZero().equals(map.get(0))); Assert.assertTrue(field.getZero().equals(map.get(50))); @@ -176,7 +176,7 @@ public class OpenIntToFieldTest { OpenIntToFieldHashMap map = createFromJavaMap(field); int mapSize = javaMap.size(); int count = 0; - Set keysInMap = new HashSet<>(javaMap.keySet()); + Set keysInMap = new HashSet(javaMap.keySet()); for (Map.Entry mapEntry : javaMap.entrySet()) { keysInMap.remove(mapEntry.getKey()); map.remove(mapEntry.getKey()); @@ -192,7 +192,7 @@ public class OpenIntToFieldTest { @Test public void testRemoveFromEmpty() { - OpenIntToFieldHashMap map = new OpenIntToFieldHashMap<>(field); + OpenIntToFieldHashMap map = new OpenIntToFieldHashMap(field); Assert.assertTrue(field.getZero().equals(map.remove(50))); } @@ -214,7 +214,7 @@ public class OpenIntToFieldTest { * Returns a map with at least 100 elements where each element is absent from javaMap. */ private Map generateAbsent() { - Map generated = new HashMap<>(); + Map generated = new HashMap(); do { generated.putAll(generate()); for (Integer key : javaMap.keySet()) @@ -226,7 +226,7 @@ public class OpenIntToFieldTest { @Test public void testCopy() { OpenIntToFieldHashMap copy = - new OpenIntToFieldHashMap<>(createFromJavaMap(field)); + new OpenIntToFieldHashMap(createFromJavaMap(field)); Assert.assertEquals(javaMap.size(), copy.size()); for (Map.Entry mapEntry : javaMap.entrySet()) @@ -292,7 +292,7 @@ public class OpenIntToFieldTest { */ @Test public void testPutKeysWithCollisions() { - OpenIntToFieldHashMap map = new OpenIntToFieldHashMap<>(field); + OpenIntToFieldHashMap map = new OpenIntToFieldHashMap(field); int key1 = -1996012590; Fraction value1 = new Fraction(1); map.put(key1, value1); @@ -316,7 +316,7 @@ public class OpenIntToFieldTest { */ @Test public void testPutKeysWithCollision2() { - OpenIntToFieldHashMapmap = new OpenIntToFieldHashMap<>(field); + OpenIntToFieldHashMapmap = new OpenIntToFieldHashMap(field); int key1 = 837989881; Fraction value1 = new Fraction(1); map.put(key1, value1); diff --git a/src/test/java/org/apache/commons/math4/util/PairTest.java b/src/test/java/org/apache/commons/math4/util/PairTest.java index ba6798ef3..904c93cbc 100644 --- a/src/test/java/org/apache/commons/math4/util/PairTest.java +++ b/src/test/java/org/apache/commons/math4/util/PairTest.java @@ -25,7 +25,7 @@ public class PairTest { @Test public void testAccessor() { final Pair p - = new Pair<>(new Integer(1), new Double(2)); + = new Pair(new Integer(1), new Double(2)); Assert.assertEquals(new Integer(1), p.getKey()); Assert.assertEquals(2, p.getValue().doubleValue(), Math.ulp(1d)); } @@ -33,7 +33,7 @@ public class PairTest { @Test public void testAccessor2() { final Pair p - = new Pair<>(new Integer(1), new Double(2)); + = new Pair(new Integer(1), new Double(2)); // Check that both APIs refer to the same data. @@ -43,19 +43,19 @@ public class PairTest { @Test public void testEquals() { - Pair p1 = new Pair<>(null, null); + Pair p1 = new Pair(null, null); Assert.assertFalse(p1.equals(null)); - Pair p2 = new Pair<>(null, null); + Pair p2 = new Pair(null, null); Assert.assertTrue(p1.equals(p2)); - p1 = new Pair<>(new Integer(1), new Double(2)); + p1 = new Pair(new Integer(1), new Double(2)); Assert.assertFalse(p1.equals(p2)); - p2 = new Pair<>(new Integer(1), new Double(2)); + p2 = new Pair(new Integer(1), new Double(2)); Assert.assertTrue(p1.equals(p2)); - Pair p3 = new Pair<>(new Integer(1), new Float(2)); + Pair p3 = new Pair(new Integer(1), new Float(2)); Assert.assertFalse(p1.equals(p3)); } @@ -64,8 +64,8 @@ public class PairTest { final MyInteger m1 = new MyInteger(1); final MyInteger m2 = new MyInteger(1); - final Pair p1 = new Pair<>(m1, m1); - final Pair p2 = new Pair<>(m2, m2); + final Pair p1 = new Pair(m1, m1); + final Pair p2 = new Pair(m2, m2); // Same contents, same hash code. Assert.assertTrue(p1.hashCode() == p2.hashCode()); @@ -76,15 +76,15 @@ public class PairTest { @Test public void testToString() { - Assert.assertEquals("[null, null]", new Pair<>(null, null).toString()); - Assert.assertEquals("[foo, 3]", new Pair<>("foo", 3).toString()); + Assert.assertEquals("[null, null]", new Pair(null, null).toString()); + Assert.assertEquals("[foo, 3]", new Pair("foo", 3).toString()); } @Test public void testCreate() { final Pair p1 = Pair.create("foo", 3); Assert.assertNotNull(p1); - final Pair p2 = new Pair<>("foo", 3); + final Pair p2 = new Pair("foo", 3); Assert.assertEquals(p2, p1); }