From af55bc00575cb140f1d52ca2e82ab2aceb23e86e Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Thu, 6 Jan 2011 14:11:32 +0000 Subject: [PATCH] Unnecessary casts git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1055885 13f79535-47bb-0310-9956-ffa450edef68 --- .../complex/ComplexFormatAbstractTest.java | 24 +++++++++---------- .../geometry/Vector3DFormatAbstractTest.java | 24 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/test/java/org/apache/commons/math/complex/ComplexFormatAbstractTest.java b/src/test/java/org/apache/commons/math/complex/ComplexFormatAbstractTest.java index 98ab1edc6..01a647945 100644 --- a/src/test/java/org/apache/commons/math/complex/ComplexFormatAbstractTest.java +++ b/src/test/java/org/apache/commons/math/complex/ComplexFormatAbstractTest.java @@ -159,7 +159,7 @@ public abstract class ComplexFormatAbstractTest { String source = "1 + 1i"; Complex expected = new Complex(1, 1); try { - Complex actual = (Complex)complexFormat.parse(source); + Complex actual = complexFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -171,7 +171,7 @@ public abstract class ComplexFormatAbstractTest { String source = "1" + getDecimalCharacter() + "23 + 1" + getDecimalCharacter() + "43i"; Complex expected = new Complex(1.23, 1.43); try { - Complex actual = (Complex)complexFormat.parse(source); + Complex actual = complexFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -183,7 +183,7 @@ public abstract class ComplexFormatAbstractTest { String source = "1" + getDecimalCharacter() + "2323 + 1" + getDecimalCharacter() + "4343i"; Complex expected = new Complex(1.2323, 1.4343); try { - Complex actual = (Complex)complexFormat.parse(source); + Complex actual = complexFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -195,7 +195,7 @@ public abstract class ComplexFormatAbstractTest { String source = "-1" + getDecimalCharacter() + "2323 + 1" + getDecimalCharacter() + "4343i"; Complex expected = new Complex(-1.2323, 1.4343); try { - Complex actual = (Complex)complexFormat.parse(source); + Complex actual = complexFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -207,7 +207,7 @@ public abstract class ComplexFormatAbstractTest { String source = "1" + getDecimalCharacter() + "2323 - 1" + getDecimalCharacter() + "4343i"; Complex expected = new Complex(1.2323, -1.4343); try { - Complex actual = (Complex)complexFormat.parse(source); + Complex actual = complexFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -219,7 +219,7 @@ public abstract class ComplexFormatAbstractTest { String source = "-1" + getDecimalCharacter() + "2323 - 1" + getDecimalCharacter() + "4343i"; Complex expected = new Complex(-1.2323, -1.4343); try { - Complex actual = (Complex)complexFormat.parse(source); + Complex actual = complexFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -231,7 +231,7 @@ public abstract class ComplexFormatAbstractTest { String source = "0" + getDecimalCharacter() + "0 - 1" + getDecimalCharacter() + "4343i"; Complex expected = new Complex(0.0, -1.4343); try { - Complex actual = (Complex)complexFormat.parse(source); + Complex actual = complexFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -243,7 +243,7 @@ public abstract class ComplexFormatAbstractTest { String source = "-1" + getDecimalCharacter() + "2323"; Complex expected = new Complex(-1.2323, 0); try { - Complex actual = (Complex)complexFormat.parse(source); + Complex actual = complexFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -255,7 +255,7 @@ public abstract class ComplexFormatAbstractTest { String source = "-1" + getDecimalCharacter() + "2323 - 1" + getDecimalCharacter() + "4343j"; Complex expected = new Complex(-1.2323, -1.4343); try { - Complex actual = (Complex)complexFormatJ.parse(source); + Complex actual = complexFormatJ.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -267,7 +267,7 @@ public abstract class ComplexFormatAbstractTest { String source = "(NaN) + (NaN)i"; Complex expected = new Complex(Double.NaN, Double.NaN); try { - Complex actual = (Complex)complexFormat.parse(source); + Complex actual = complexFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -279,7 +279,7 @@ public abstract class ComplexFormatAbstractTest { String source = "(Infinity) + (Infinity)i"; Complex expected = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); try { - Complex actual = (Complex)complexFormat.parse(source); + Complex actual = complexFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -291,7 +291,7 @@ public abstract class ComplexFormatAbstractTest { String source = "(-Infinity) - (Infinity)i"; Complex expected = new Complex(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); try { - Complex actual = (Complex)complexFormat.parse(source); + Complex actual = complexFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); diff --git a/src/test/java/org/apache/commons/math/geometry/Vector3DFormatAbstractTest.java b/src/test/java/org/apache/commons/math/geometry/Vector3DFormatAbstractTest.java index 5fc0f5780..5e75922fd 100644 --- a/src/test/java/org/apache/commons/math/geometry/Vector3DFormatAbstractTest.java +++ b/src/test/java/org/apache/commons/math/geometry/Vector3DFormatAbstractTest.java @@ -164,7 +164,7 @@ public abstract class Vector3DFormatAbstractTest { String source = "{1; 1; 1}"; Vector3D expected = new Vector3D(1, 1, 1); try { - Vector3D actual = (Vector3D) vector3DFormat.parse(source); + Vector3D actual = vector3DFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -193,7 +193,7 @@ public abstract class Vector3DFormatAbstractTest { "63}"; Vector3D expected = new Vector3D(1.23, 1.43, 1.63); try { - Vector3D actual = (Vector3D) vector3DFormat.parse(source); + Vector3D actual = vector3DFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -209,7 +209,7 @@ public abstract class Vector3DFormatAbstractTest { "6333}"; Vector3D expected = new Vector3D(1.2323, 1.4343, 1.6333); try { - Vector3D actual = (Vector3D) vector3DFormat.parse(source); + Vector3D actual = vector3DFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -225,7 +225,7 @@ public abstract class Vector3DFormatAbstractTest { "6333}"; Vector3D expected = new Vector3D(-1.2323, 1.4343, 1.6333); try { - Vector3D actual = (Vector3D) vector3DFormat.parse(source); + Vector3D actual = vector3DFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -241,7 +241,7 @@ public abstract class Vector3DFormatAbstractTest { "6333}"; Vector3D expected = new Vector3D(1.2323, -1.4343, 1.6333); try { - Vector3D actual = (Vector3D) vector3DFormat.parse(source); + Vector3D actual = vector3DFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -257,7 +257,7 @@ public abstract class Vector3DFormatAbstractTest { "6333}"; Vector3D expected = new Vector3D(1.2323, 1.4343, -1.6333); try { - Vector3D actual = (Vector3D) vector3DFormat.parse(source); + Vector3D actual = vector3DFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -273,7 +273,7 @@ public abstract class Vector3DFormatAbstractTest { "6333}"; Vector3D expected = new Vector3D(-1.2323, -1.4343, -1.6333); try { - Vector3D actual = (Vector3D) vector3DFormat.parse(source); + Vector3D actual = vector3DFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -289,7 +289,7 @@ public abstract class Vector3DFormatAbstractTest { "6333}"; Vector3D expected = new Vector3D(0.0, -1.4343, 1.6333); try { - Vector3D actual = (Vector3D) vector3DFormat.parse(source); + Vector3D actual = vector3DFormat.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -305,7 +305,7 @@ public abstract class Vector3DFormatAbstractTest { "6333]"; Vector3D expected = new Vector3D(1.2323, 1.4343, 1.6333); try { - Vector3D actual = (Vector3D) vector3DFormatSquare.parse(source); + Vector3D actual = vector3DFormatSquare.parse(source); Assert.assertEquals(expected, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -316,7 +316,7 @@ public abstract class Vector3DFormatAbstractTest { public void testParseNan() { String source = "{(NaN); (NaN); (NaN)}"; try { - Vector3D actual = (Vector3D) vector3DFormat.parse(source); + Vector3D actual = vector3DFormat.parse(source); Assert.assertEquals(Vector3D.NaN, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -327,7 +327,7 @@ public abstract class Vector3DFormatAbstractTest { public void testParsePositiveInfinity() { String source = "{(Infinity); (Infinity); (Infinity)}"; try { - Vector3D actual = (Vector3D)vector3DFormat.parse(source); + Vector3D actual = vector3DFormat.parse(source); Assert.assertEquals(Vector3D.POSITIVE_INFINITY, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage()); @@ -338,7 +338,7 @@ public abstract class Vector3DFormatAbstractTest { public void testParseNegativeInfinity() { String source = "{(-Infinity); (-Infinity); (-Infinity)}"; try { - Vector3D actual = (Vector3D)vector3DFormat.parse(source); + Vector3D actual = vector3DFormat.parse(source); Assert.assertEquals(Vector3D.NEGATIVE_INFINITY, actual); } catch (MathParseException ex) { Assert.fail(ex.getMessage());