http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java ---------------------------------------------------------------------- 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 17097f5..e3b1959 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<WeightedObservedPoint> points = new ArrayList<WeightedObservedPoint>(); + final List<WeightedObservedPoint> points = new ArrayList<>(); for (int i = 0; i < y.length; i++) { points.add(new WeightedObservedPoint(1, i, y[i])); }
http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java ---------------------------------------------------------------------- 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 377726d..016bf8b 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<double[]>(); + points = new ArrayList<>(); xSigma = xError; ySigma = yError; resolution = searchResolution; http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java ---------------------------------------------------------------------- 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 3c88431..87a2b6f 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<Vector2D> points; public CircleVectorial() { - points = new ArrayList<Vector2D>(); + points = new ArrayList<>(); } public void addPoint(double px, double py) { http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java ---------------------------------------------------------------------- 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 b34dcaf..bffb95b 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<RealVector, RealMatrix> value(RealVector notUsed) { - return new Pair<RealVector, RealMatrix>(null, null); + return new Pair<>(null, null); } }; @@ -276,7 +276,7 @@ public class EvaluationTest { final MultivariateJacobianFunction m2 = new ValueAndJacobianFunction() { public Pair<RealVector, RealMatrix> value(RealVector notUsed) { - return new Pair<RealVector, RealMatrix>(null, null); + return new Pair<>(null, null); } public RealVector computeValue(final double[] params) { return null; http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTestValidation.java ---------------------------------------------------------------------- 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 6642854..3c637ae 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<double[]> paramsAndChi2 = new ArrayList<double[]>(gridSize * gridSize); + final List<double[]> paramsAndChi2 = new ArrayList<>(gridSize * gridSize); final double slopeRange = 10 * sigma.getEntry(0); final double offsetRange = 10 * sigma.getEntry(1); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java ---------------------------------------------------------------------- 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 6198eb7..9b9c55d 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<Double> count; public BevingtonProblem() { - time = new ArrayList<Double>(); - count = new ArrayList<Double>(); + time = new ArrayList<>(); + count = new ArrayList<>(); } public void addPoint(double t, double c) { http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDataset.java ---------------------------------------------------------------------- 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 f78b318..08c60f7 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<String> lines = new ArrayList<String>(); + final ArrayList<String> lines = new ArrayList<>(); for (String line = in.readLine(); line != null; line = in.readLine()) { lines.add(line); } http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/fitting/leastsquares/StraightLineProblem.java ---------------------------------------------------------------------- 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 b59e703..7ce8323 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<double[]>(); + points = new ArrayList<>(); sigma = error; } http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/genetics/ChromosomeTest.java ---------------------------------------------------------------------- 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 126d5c3..3c1a6ed 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<Chromosome> popChr = new ArrayList<Chromosome>(); + List<Chromosome> popChr = new ArrayList<>(); popChr.add(c1); popChr.add(c2); popChr.add(c3); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/genetics/FitnessCachingTest.java ---------------------------------------------------------------------- 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 71ae818..0903c49 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<Chromosome> popList = new LinkedList<Chromosome>(); + List<Chromosome> popList = new LinkedList<>(); for (int i=0; i<POPULATION_SIZE; i++) { BinaryChromosome randChrom = new DummyCountingBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(DIMENSION)); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java b/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java index a18b864..e383e34 100644 --- a/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java +++ b/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java @@ -92,7 +92,7 @@ public class GeneticAlgorithmTestBinary { * Initializes a random population. */ private static ElitisticListPopulation randomPopulation() { - List<Chromosome> popList = new LinkedList<Chromosome>(); + List<Chromosome> popList = new LinkedList<>(); for (int i=0; i<POPULATION_SIZE; i++) { BinaryChromosome randChrom = new FindOnes(BinaryChromosome.randomBinaryRepresentation(DIMENSION)); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestPermutations.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestPermutations.java b/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestPermutations.java index 4ce2bb1..e4ccd50 100644 --- a/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestPermutations.java +++ b/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestPermutations.java @@ -53,7 +53,7 @@ public class GeneticAlgorithmTestPermutations { private static final int TOURNAMENT_ARITY = 2; // numbers from 0 to N-1 - private static final List<Integer> sequence = new ArrayList<Integer>(); + private static final List<Integer> sequence = new ArrayList<>(); static { for (int i=0; i<DIMENSION; i++) { sequence.add(i); @@ -101,7 +101,7 @@ public class GeneticAlgorithmTestPermutations { * Initializes a random population */ private static ElitisticListPopulation randomPopulation() { - List<Chromosome> popList = new ArrayList<Chromosome>(); + List<Chromosome> popList = new ArrayList<>(); for (int i=0; i<POPULATION_SIZE; i++) { Chromosome randChrom = new MinPermutations(RandomKey.randomPermutation(DIMENSION)); popList.add(randChrom); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java b/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java index 6fa323e..f13fb91 100644 --- a/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java +++ b/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java @@ -50,7 +50,7 @@ public class ListPopulationTest { } }; - ArrayList<Chromosome> chromosomes = new ArrayList<Chromosome> (); + ArrayList<Chromosome> 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<Chromosome> chromosomes = new ArrayList<Chromosome> (); + final ArrayList<Chromosome> 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<Chromosome> chromosomes = new ArrayList<Chromosome> (); + final ArrayList<Chromosome> 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<Chromosome> chromosomes = new ArrayList<Chromosome> (); + final ArrayList<Chromosome> 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<Chromosome> chromosomes = new ArrayList<Chromosome> (); + final ArrayList<Chromosome> 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<Chromosome> chromosomes = new ArrayList<Chromosome>(); + final ArrayList<Chromosome> 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<Chromosome> chromosomes = new ArrayList<Chromosome> (); + final ArrayList<Chromosome> chromosomes = new ArrayList<> (); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); chromosomes.add(new DummyBinaryChromosome(BinaryChromosome.randomBinaryRepresentation(3))); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java ---------------------------------------------------------------------- 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 4f05d81..2a1231f 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<Integer> npc = new NPointCrossover<Integer>(order); + NPointCrossover<Integer> 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 http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/genetics/OnePointCrossoverTest.java ---------------------------------------------------------------------- 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 6f431e2..482aad0 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<Integer> opc = new OnePointCrossover<Integer>(); + OnePointCrossover<Integer> opc = new OnePointCrossover<>(); // how to test a stochastic method? for (int i=0; i<20; i++) { http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java ---------------------------------------------------------------------- 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 9379da1..2290fab 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<Integer>(); for (int i = 0; i < 20; i++) { - final Set<Integer> parentSet1 = new HashSet<Integer>(Arrays.asList(p1)); - final Set<Integer> parentSet2 = new HashSet<Integer>(Arrays.asList(p2)); + final Set<Integer> parentSet1 = new HashSet<>(Arrays.asList(p1)); + final Set<Integer> parentSet2 = new HashSet<>(Arrays.asList(p2)); final ChromosomePair pair = cp.crossover(p1c, p2c); http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/genetics/UniformCrossoverTest.java ---------------------------------------------------------------------- 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 45e2a2b..73c6052 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<Integer> p1 = new ArrayList<Integer>(LEN); - private static final List<Integer> p2 = new ArrayList<Integer>(LEN); + private static final List<Integer> p1 = new ArrayList<>(LEN); + private static final List<Integer> p2 = new ArrayList<>(LEN); @SuppressWarnings("boxing") @BeforeClass http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java ---------------------------------------------------------------------- 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 3729574..f0daa4c 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<Euclidean2D, Vector2D> encloser = - new WelzlEncloser<Euclidean2D, Vector2D>(1.0e-10, generator); + new WelzlEncloser<>(1.0e-10, generator); EnclosingBall<Euclidean2D, Vector2D> ball = encloser.enclose(null); Assert.assertTrue(ball.getRadius() < 0); } @@ -46,7 +46,7 @@ public class WelzlEncloser2DTest { public void testNoPoints() { DiskGenerator generator = new DiskGenerator(); WelzlEncloser<Euclidean2D, Vector2D> encloser = - new WelzlEncloser<Euclidean2D, Vector2D>(1.0e-10, generator); + new WelzlEncloser<>(1.0e-10, generator); EnclosingBall<Euclidean2D, Vector2D> ball = encloser.enclose(new ArrayList<Vector2D>()); 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<Vector2D> points = new ArrayList<Vector2D>(); + List<Vector2D> 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<Vector2D> buildList(final double ... coordinates) { - List<Vector2D> list = new ArrayList<Vector2D>(coordinates.length / 2); + List<Vector2D> 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<Vector2D> reducedSupport = new ArrayList<Vector2D>(); + List<Vector2D> reducedSupport = new ArrayList<>(); int count = 0; for (Vector2D s : disk.getSupport()) { if (count++ != i) { @@ -151,7 +151,7 @@ public class WelzlEncloser2DTest { private EnclosingBall<Euclidean2D, Vector2D> checkDisk(List<Vector2D> points) { WelzlEncloser<Euclidean2D, Vector2D> encloser = - new WelzlEncloser<Euclidean2D, Vector2D>(1.0e-10, new DiskGenerator()); + new WelzlEncloser<>(1.0e-10, new DiskGenerator()); EnclosingBall<Euclidean2D, Vector2D> disk = encloser.enclose(points); // all points are enclosed http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser3DTest.java ---------------------------------------------------------------------- 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 aaa4c43..f8ef012 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<Euclidean3D, Vector3D> encloser = - new WelzlEncloser<Euclidean3D, Vector3D>(1.0e-10, generator); + new WelzlEncloser<>(1.0e-10, generator); EnclosingBall<Euclidean3D, Vector3D> ball = encloser.enclose(null); Assert.assertTrue(ball.getRadius() < 0); } @@ -48,7 +48,7 @@ public class WelzlEncloser3DTest { public void testNoPoints() { SphereGenerator generator = new SphereGenerator(); WelzlEncloser<Euclidean3D, Vector3D> encloser = - new WelzlEncloser<Euclidean3D, Vector3D>(1.0e-10, generator); + new WelzlEncloser<>(1.0e-10, generator); EnclosingBall<Euclidean3D, Vector3D> ball = encloser.enclose(new ArrayList<Vector3D>()); 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<Euclidean3D, Vector3D> encloser = - new WelzlEncloser<Euclidean3D, Vector3D>(1.0e-10, new SphereGenerator()); + new WelzlEncloser<>(1.0e-10, new SphereGenerator()); EnclosingBall<Euclidean3D, Vector3D> 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<Euclidean3D, Vector3D> encloser = - new WelzlEncloser<Euclidean3D, Vector3D>(1.0e-10, new SphereGenerator()); + new WelzlEncloser<>(1.0e-10, new SphereGenerator()); EnclosingBall<Euclidean3D, Vector3D> 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<Vector3D> points = new ArrayList<Vector3D>(); + List<Vector3D> 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<Vector3D> reducedSupport = new ArrayList<Vector3D>(); + List<Vector3D> reducedSupport = new ArrayList<>(); int count = 0; for (Vector3D s : sphere.getSupport()) { if (count++ != i) { @@ -158,7 +158,7 @@ public class WelzlEncloser3DTest { private EnclosingBall<Euclidean3D, Vector3D> checkSphere(List<Vector3D> points) { WelzlEncloser<Euclidean3D, Vector3D> encloser = - new WelzlEncloser<Euclidean3D, Vector3D>(1.0e-10, new SphereGenerator()); + new WelzlEncloser<>(1.0e-10, new SphereGenerator()); EnclosingBall<Euclidean3D, Vector3D> Sphere = encloser.enclose(points); // all points are enclosed http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java ---------------------------------------------------------------------- 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 a8b00dc..b7c8399 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<Euclidean1D> factory = new RegionFactory<Euclidean1D>(); + RegionFactory<Euclidean1D> 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)), http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDSTest.java ---------------------------------------------------------------------- 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 5b352eb..d9308fd 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<DerivativeStructure> r = new FieldRotation<DerivativeStructure>(createAxis(10, 10, 10), createAngle(2 * FastMath.PI / 3)); + FieldRotation<DerivativeStructure> 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<DerivativeStructure>(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<DerivativeStructure>(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<DerivativeStructure>(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<DerivativeStructure> r = new FieldRotation<DerivativeStructure>(createAxis(10, 10, 10), + FieldRotation<DerivativeStructure> 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<DerivativeStructure>(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<DerivativeStructure>(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<DerivativeStructure>(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<DerivativeStructure> r = new FieldRotation<DerivativeStructure>(createAxis(10, 10, 10), + FieldRotation<DerivativeStructure> 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<DerivativeStructure>(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<DerivativeStructure>(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<DerivativeStructure>(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<DerivativeStructure> u = createVector(3, 2, 1); FieldVector3D<DerivativeStructure> v = createVector(-4, 2, 2); - FieldRotation<DerivativeStructure> r = new FieldRotation<DerivativeStructure>(u, v); + FieldRotation<DerivativeStructure> r = new FieldRotation<>(u, v); checkVector(r.applyTo(u.scalarMultiply(v.getNorm())), v.scalarMultiply(u.getNorm())); - checkAngle(new FieldRotation<DerivativeStructure>(u, u.negate()).getAngle(), FastMath.PI); + checkAngle(new FieldRotation<>(u, u.negate()).getAngle(), FastMath.PI); try { - new FieldRotation<DerivativeStructure>(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<DerivativeStructure> u2 = createVector(0, 5, 0); FieldVector3D<DerivativeStructure> v1 = createVector(0, 0, 2); FieldVector3D<DerivativeStructure> v2 = createVector(-2, 0, 2); - FieldRotation<DerivativeStructure> r = new FieldRotation<DerivativeStructure>(u1, u2, v1, v2); + FieldRotation<DerivativeStructure> 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<DerivativeStructure>(u1, u2, u1.negate(), u2.negate()); + r = new FieldRotation<>(u1, u2, u1.negate(), u2.negate()); FieldVector3D<DerivativeStructure> 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<DerivativeStructure>(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<DerivativeStructure>(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<DerivativeStructure>(u1, u2, u1, u2), 1, 0, 0, 0); + checkRotationDS(new FieldRotation<>(u1, u2, u1, u2), 1, 0, 0, 0); try { - new FieldRotation<DerivativeStructure>(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<DerivativeStructure>(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<DerivativeStructure>(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<DerivativeStructure>(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<DerivativeStructure> r = new FieldRotation<DerivativeStructure>(CardanOrders[i], + FieldRotation<DerivativeStructure> 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<DerivativeStructure> r = new FieldRotation<DerivativeStructure>(EulerOrders[i], + FieldRotation<DerivativeStructure> 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<DerivativeStructure> r = - new FieldRotation<DerivativeStructure>(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<DerivativeStructure> r = - new FieldRotation<DerivativeStructure>(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<DerivativeStructure> r = - new FieldRotation<DerivativeStructure>(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<DerivativeStructure> r = - new FieldRotation<DerivativeStructure>(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<DerivativeStructure> r1 = new FieldRotation<DerivativeStructure>(createVector(2, -3, 5), + FieldRotation<DerivativeStructure> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); double n = 23.5; - FieldRotation<DerivativeStructure> r2 = new FieldRotation<DerivativeStructure>(r1.getQ0().multiply(n), r1.getQ1().multiply(n), + FieldRotation<DerivativeStructure> 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<DerivativeStructure> r1 = new FieldRotation<DerivativeStructure>(createVector(2, -3, 5), + FieldRotation<DerivativeStructure> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation<DerivativeStructure> r2 = new FieldRotation<DerivativeStructure>(createVector(-1, 3, 2), + FieldRotation<DerivativeStructure> r2 = new FieldRotation<>(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation<DerivativeStructure> r3 = r2.applyTo(r1); @@ -816,10 +816,10 @@ public class FieldRotationDSTest { @Test public void testComposeVectorOperator() throws MathIllegalArgumentException { - FieldRotation<DerivativeStructure> r1 = new FieldRotation<DerivativeStructure>(createVector(2, -3, 5), + FieldRotation<DerivativeStructure> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation<DerivativeStructure> r2 = new FieldRotation<DerivativeStructure>(createVector(-1, 3, 2), + FieldRotation<DerivativeStructure> r2 = new FieldRotation<>(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation<DerivativeStructure> r3 = r2.compose(r1, RotationConvention.VECTOR_OPERATOR); @@ -845,10 +845,10 @@ public class FieldRotationDSTest { @Test public void testComposeFrameTransform() throws MathIllegalArgumentException { - FieldRotation<DerivativeStructure> r1 = new FieldRotation<DerivativeStructure>(createVector(2, -3, 5), + FieldRotation<DerivativeStructure> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.FRAME_TRANSFORM); - FieldRotation<DerivativeStructure> r2 = new FieldRotation<DerivativeStructure>(createVector(-1, 3, 2), + FieldRotation<DerivativeStructure> r2 = new FieldRotation<>(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.FRAME_TRANSFORM); FieldRotation<DerivativeStructure> r3 = r2.compose(r1, RotationConvention.FRAME_TRANSFORM); @@ -874,10 +874,10 @@ public class FieldRotationDSTest { @Test public void testApplyInverseToRotation() throws MathIllegalArgumentException { - FieldRotation<DerivativeStructure> r1 = new FieldRotation<DerivativeStructure>(createVector(2, -3, 5), + FieldRotation<DerivativeStructure> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation<DerivativeStructure> r2 = new FieldRotation<DerivativeStructure>(createVector(-1, 3, 2), + FieldRotation<DerivativeStructure> r2 = new FieldRotation<>(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation<DerivativeStructure> r3 = r2.applyInverseTo(r1); @@ -902,10 +902,10 @@ public class FieldRotationDSTest { @Test public void testComposeInverseVectorOperator() throws MathIllegalArgumentException { - FieldRotation<DerivativeStructure> r1 = new FieldRotation<DerivativeStructure>(createVector(2, -3, 5), + FieldRotation<DerivativeStructure> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation<DerivativeStructure> r2 = new FieldRotation<DerivativeStructure>(createVector(-1, 3, 2), + FieldRotation<DerivativeStructure> r2 = new FieldRotation<>(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation<DerivativeStructure> r3 = r2.composeInverse(r1, RotationConvention.VECTOR_OPERATOR); @@ -931,10 +931,10 @@ public class FieldRotationDSTest { @Test public void testComposeInverseframeTransform() throws MathIllegalArgumentException { - FieldRotation<DerivativeStructure> r1 = new FieldRotation<DerivativeStructure>(createVector(2, -3, 5), + FieldRotation<DerivativeStructure> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.FRAME_TRANSFORM); - FieldRotation<DerivativeStructure> r2 = new FieldRotation<DerivativeStructure>(createVector(-1, 3, 2), + FieldRotation<DerivativeStructure> r2 = new FieldRotation<>(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.FRAME_TRANSFORM); FieldRotation<DerivativeStructure> 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<DerivativeStructure> r = new FieldRotation<DerivativeStructure>(createVector(unit[0], unit[1], unit[2]), + FieldRotation<DerivativeStructure> 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<DerivativeStructure>(ruArray)); + checkVector(ruds, new FieldVector3D<>(ruArray)); checkVector(rIuds, rIu); - checkVector(rIuds, new FieldVector3D<DerivativeStructure>(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<DerivativeStructure> r1Prime = new FieldRotation<DerivativeStructure>(new DerivativeStructure(4, 1, 0, r1.getQ0()), + FieldRotation<DerivativeStructure> 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<DerivativeStructure> r2 = new FieldRotation<DerivativeStructure>(createVector(unit2[0], unit2[1], unit2[2]), + FieldRotation<DerivativeStructure> 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<DerivativeStructure> r = new FieldRotation<DerivativeStructure>(createAxis(kx, ky, kz), + FieldRotation<DerivativeStructure> 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<DerivativeStructure> r = new FieldRotation<DerivativeStructure>(createAxis(2, -3, 5), + FieldRotation<DerivativeStructure> 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<DerivativeStructure> r = new FieldRotation<DerivativeStructure>(createVector(2, -3, 5), + FieldRotation<DerivativeStructure> 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<DerivativeStructure>(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<DerivativeStructure> u2 =createVector( -5712344449280879.0 / 2097152.0, -2275058564560979.0 / 1048576.0, 4423475992255071.0 / 65536.0); - FieldRotation<DerivativeStructure> rot = new FieldRotation<DerivativeStructure>(u1, u2, createVector(1, 0, 0),createVector(0, 0, 1)); + FieldRotation<DerivativeStructure> 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<DerivativeStructure> v1 = createVector(0.9999999999999999, 0.0, 0.0); FieldVector3D<DerivativeStructure> v2 = createVector(0.0, 0.0, -1.0); - FieldRotation<DerivativeStructure> quat = new FieldRotation<DerivativeStructure>(u1, u2, v1, v2); + FieldRotation<DerivativeStructure> 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<DerivativeStructure> createRotation(double q0, double q1, double q2, double q3, boolean needsNormalization) { - return new FieldRotation<DerivativeStructure>(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<DerivativeStructure>(mds, threshold); + return new FieldRotation<>(mds, threshold); } private FieldVector3D<DerivativeStructure> createVector(double x, double y, double z) { - return new FieldVector3D<DerivativeStructure>(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<DerivativeStructure> createAxis(double x, double y, double z) { - return new FieldVector3D<DerivativeStructure>(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)); } http://git-wip-us.apache.org/repos/asf/commons-math/blob/8b5f4535/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDfpTest.java ---------------------------------------------------------------------- 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 e7df1b0..386e643 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<Dfp> r = new FieldRotation<Dfp>(createAxis(10, 10, 10), createAngle(2 * FastMath.PI / 3)); + FieldRotation<Dfp> 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<Dfp>(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<Dfp>(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<Dfp>(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<Dfp> r = new FieldRotation<Dfp>(createAxis(10, 10, 10), + FieldRotation<Dfp> 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<Dfp>(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<Dfp>(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<Dfp>(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<Dfp> r = new FieldRotation<Dfp>(createAxis(10, 10, 10), + FieldRotation<Dfp> 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<Dfp>(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<Dfp>(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<Dfp>(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<Dfp> u = createVector(3, 2, 1); FieldVector3D<Dfp> v = createVector(-4, 2, 2); - FieldRotation<Dfp> r = new FieldRotation<Dfp>(u, v); + FieldRotation<Dfp> r = new FieldRotation<>(u, v); checkVector(r.applyTo(u.scalarMultiply(v.getNorm())), v.scalarMultiply(u.getNorm())); - checkAngle(new FieldRotation<Dfp>(u, u.negate()).getAngle(), FastMath.PI); + checkAngle(new FieldRotation<>(u, u.negate()).getAngle(), FastMath.PI); try { - new FieldRotation<Dfp>(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<Dfp> u2 = createVector(0, 5, 0); FieldVector3D<Dfp> v1 = createVector(0, 0, 2); FieldVector3D<Dfp> v2 = createVector(-2, 0, 2); - FieldRotation<Dfp> r = new FieldRotation<Dfp>(u1, u2, v1, v2); + FieldRotation<Dfp> 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<Dfp>(u1, u2, u1.negate(), u2.negate()); + r = new FieldRotation<>(u1, u2, u1.negate(), u2.negate()); FieldVector3D<Dfp> 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<Dfp>(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<Dfp>(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<Dfp>(u1, u2, u1, u2), 1, 0, 0, 0); + checkRotationDS(new FieldRotation<>(u1, u2, u1, u2), 1, 0, 0, 0); try { - new FieldRotation<Dfp>(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<Dfp>(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<Dfp>(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<Dfp>(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<Dfp> r = new FieldRotation<Dfp>(CardanOrders[i], + FieldRotation<Dfp> 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<Dfp> r = new FieldRotation<Dfp>(EulerOrders[i], + FieldRotation<Dfp> 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<Dfp> r = new FieldRotation<Dfp>(CardanOrders[i], + FieldRotation<Dfp> 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<Dfp> r = new FieldRotation<Dfp>(EulerOrders[i], + FieldRotation<Dfp> 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<Dfp> r = new FieldRotation<Dfp>(CardanOrders[i], + FieldRotation<Dfp> 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<Dfp> r = new FieldRotation<Dfp>(EulerOrders[i], + FieldRotation<Dfp> 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<Dfp> r1 = new FieldRotation<Dfp>(createVector(2, -3, 5), + FieldRotation<Dfp> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); double n = 23.5; - FieldRotation<Dfp> r2 = new FieldRotation<Dfp>(r1.getQ0().multiply(n), r1.getQ1().multiply(n), + FieldRotation<Dfp> 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<Dfp> r1 = new FieldRotation<Dfp>(createVector(2, -3, 5), + FieldRotation<Dfp> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation<Dfp> r2 = new FieldRotation<Dfp>(createVector(-1, 3, 2), + FieldRotation<Dfp> r2 = new FieldRotation<>(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation<Dfp> r3 = r2.applyTo(r1); @@ -653,10 +653,10 @@ public class FieldRotationDfpTest { @Test public void testComposeVectorOperator() throws MathIllegalArgumentException { - FieldRotation<Dfp> r1 = new FieldRotation<Dfp>(createVector(2, -3, 5), + FieldRotation<Dfp> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation<Dfp> r2 = new FieldRotation<Dfp>(createVector(-1, 3, 2), + FieldRotation<Dfp> r2 = new FieldRotation<>(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation<Dfp> r3 = r2.compose(r1, RotationConvention.VECTOR_OPERATOR); @@ -682,10 +682,10 @@ public class FieldRotationDfpTest { @Test public void testComposeFrameTransform() throws MathIllegalArgumentException { - FieldRotation<Dfp> r1 = new FieldRotation<Dfp>(createVector(2, -3, 5), + FieldRotation<Dfp> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.FRAME_TRANSFORM); - FieldRotation<Dfp> r2 = new FieldRotation<Dfp>(createVector(-1, 3, 2), + FieldRotation<Dfp> r2 = new FieldRotation<>(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.FRAME_TRANSFORM); FieldRotation<Dfp> r3 = r2.compose(r1, RotationConvention.FRAME_TRANSFORM); @@ -713,10 +713,10 @@ public class FieldRotationDfpTest { @Test public void testApplyInverseToRotation() throws MathIllegalArgumentException { - FieldRotation<Dfp> r1 = new FieldRotation<Dfp>(createVector(2, -3, 5), + FieldRotation<Dfp> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation<Dfp> r2 = new FieldRotation<Dfp>(createVector(-1, 3, 2), + FieldRotation<Dfp> r2 = new FieldRotation<>(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation<Dfp> r3 = r2.applyInverseTo(r1); @@ -741,10 +741,10 @@ public class FieldRotationDfpTest { @Test public void testComposeInverseVectorOperator() throws MathIllegalArgumentException { - FieldRotation<Dfp> r1 = new FieldRotation<Dfp>(createVector(2, -3, 5), + FieldRotation<Dfp> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.VECTOR_OPERATOR); - FieldRotation<Dfp> r2 = new FieldRotation<Dfp>(createVector(-1, 3, 2), + FieldRotation<Dfp> r2 = new FieldRotation<>(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.VECTOR_OPERATOR); FieldRotation<Dfp> r3 = r2.composeInverse(r1, RotationConvention.VECTOR_OPERATOR); @@ -770,10 +770,10 @@ public class FieldRotationDfpTest { @Test public void testComposeInverseFrameTransform() throws MathIllegalArgumentException { - FieldRotation<Dfp> r1 = new FieldRotation<Dfp>(createVector(2, -3, 5), + FieldRotation<Dfp> r1 = new FieldRotation<>(createVector(2, -3, 5), createAngle(1.7), RotationConvention.FRAME_TRANSFORM); - FieldRotation<Dfp> r2 = new FieldRotation<Dfp>(createVector(-1, 3, 2), + FieldRotation<Dfp> r2 = new FieldRotation<>(createVector(-1, 3, 2), createAngle(0.3), RotationConvention.FRAME_TRANSFORM); FieldRotation<Dfp> 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<Dfp> r = new FieldRotation<Dfp>(createVector(unit[0], unit[1], unit[2]), + FieldRotation<Dfp> 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<Dfp>(ruArray)); + checkVector(ruds, new FieldVector3D<>(ruArray)); checkVector(rIuds, rIu); - checkVector(rIuds, new FieldVector3D<Dfp>(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<Dfp> r1Prime = new FieldRotation<Dfp>(field.newDfp(r1.getQ0()), + FieldRotation<Dfp> 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<Dfp> r2 = new FieldRotation<Dfp>(createVector(unit2[0], unit2[1], unit2[2]), + FieldRotation<Dfp> 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<Dfp> r = new FieldRotation<Dfp>(createAxis(2, -3, 5), + FieldRotation<Dfp> 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<Dfp> r = new FieldRotation<Dfp>(createVector(2, -3, 5), + FieldRotation<Dfp> 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<Dfp>(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<Dfp> u = createVector(FastMath.cos(lambda) * FastMath.cos(phi), @@ -964,7 +964,7 @@ public class FieldRotationDfpTest { FieldVector3D<Dfp> u2 =createVector( -5712344449280879.0 / 2097152.0, -2275058564560979.0 / 1048576.0, 4423475992255071.0 / 65536.0); - FieldRotation<Dfp> rot = new FieldRotation<Dfp>(u1, u2, createVector(1, 0, 0),createVector(0, 0, 1)); + FieldRotation<Dfp> 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<Dfp> v1 = createVector(0.9999999999999999, 0.0, 0.0); FieldVector3D<Dfp> v2 = createVector(0.0, 0.0, -1.0); - FieldRotation<Dfp> quat = new FieldRotation<Dfp>(u1, u2, v1, v2); + FieldRotation<Dfp> 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<Dfp> createRotation(double q0, double q1, double q2, double q3, boolean needsNormalization) { DfpField field = new DfpField(20); - return new FieldRotation<Dfp>(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<Dfp>(mds, threshold); + return new FieldRotation<>(mds, threshold); } private FieldVector3D<Dfp> createVector(double x, double y, double z) { DfpField field = new DfpField(20); - return new FieldVector3D<Dfp>(field.newDfp(x), field.newDfp(y), field.newDfp(z)); + return new FieldVector3D<>(field.newDfp(x), field.newDfp(y), field.newDfp(z)); } private FieldVector3D<Dfp> createAxis(double x, double y, double z) { DfpField field = new DfpField(20); - return new FieldVector3D<Dfp>(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) {