commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1150381 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/geometry/euclidean/threed/ test/java/org/apache/commons/math/geometry/euclidean/threed/ test/java/org/apache/commons/math/geometry/euclidean/twod/ test/java/org...
Date Sun, 24 Jul 2011 14:31:53 GMT
Author: sebb
Date: Sun Jul 24 14:31:52 2011
New Revision: 1150381

URL: http://svn.apache.org/viewvc?rev=1150381&view=rev
Log:
Unnecessary casts

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/PolyhedronsSet.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/PlaneTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/PolyhedronsSetTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/twod/LineTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/twod/PolygonsSetTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/partitioning/utilities/AVLTreeTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/PolyhedronsSet.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/PolyhedronsSet.java?rev=1150381&r1=1150380&r2=1150381&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/PolyhedronsSet.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/PolyhedronsSet.java
Sun Jul 24 14:31:52 2011
@@ -341,11 +341,11 @@ public class PolyhedronsSet extends Abst
                 final Plane    oPlane = (Plane) original;
                 final Plane    tPlane = (Plane) transformed;
                 final Vector3D p00    = oPlane.getOrigin();
-                final Vector3D p10    = (Vector3D) oPlane.toSpace(new Vector2D(1.0, 0.0));
-                final Vector3D p01    = (Vector3D) oPlane.toSpace(new Vector2D(0.0, 1.0));
-                final Vector2D  tP00   = (Vector2D) tPlane.toSubSpace(apply(p00));
-                final Vector2D  tP10   = (Vector2D) tPlane.toSubSpace(apply(p10));
-                final Vector2D  tP01   = (Vector2D) tPlane.toSubSpace(apply(p01));
+                final Vector3D p10    = oPlane.toSpace(new Vector2D(1.0, 0.0));
+                final Vector3D p01    = oPlane.toSpace(new Vector2D(0.0, 1.0));
+                final Vector2D  tP00   = tPlane.toSubSpace(apply(p00));
+                final Vector2D  tP10   = tPlane.toSubSpace(apply(p10));
+                final Vector2D  tP01   = tPlane.toSubSpace(apply(p01));
                 final AffineTransform at =
                     new AffineTransform(tP10.getX() - tP00.getX(), tP10.getY() - tP00.getY(),
                                         tP01.getX() - tP00.getX(), tP01.getY() - tP00.getY(),
@@ -407,7 +407,7 @@ public class PolyhedronsSet extends Abst
 
                 final Plane   oPlane = (Plane) original;
                 final Plane   tPlane = (Plane) transformed;
-                final Vector2D shift  = (Vector2D) tPlane.toSubSpace(apply(oPlane.getOrigin()));
+                final Vector2D shift  = tPlane.toSubSpace(apply(oPlane.getOrigin()));
                 final AffineTransform at =
                     AffineTransform.getTranslateInstance(shift.getX(), shift.getY());
 

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/PlaneTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/PlaneTest.java?rev=1150381&r1=1150380&r2=1150381&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/PlaneTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/PlaneTest.java
Sun Jul 24 14:31:52 2011
@@ -130,7 +130,7 @@ public class PlaneTest {
         Vector3D p2  = new Vector3D (3.4, -5.8, 1.2);
         Plane    pA  = new Plane(p1, p2, new Vector3D (-2.0, 4.3, 0.7));
         Plane    pB  = new Plane(p1, new Vector3D (11.4, -3.8, 5.1), p2);
-        Line     l   = (Line) pA.intersection(pB);
+        Line     l   = pA.intersection(pB);
         Assert.assertTrue(l.contains(p1));
         Assert.assertTrue(l.contains(p2));
         Assert.assertNull(pA.intersection(pA));

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/PolyhedronsSetTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/PolyhedronsSetTest.java?rev=1150381&r1=1150380&r2=1150381&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/PolyhedronsSetTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/threed/PolyhedronsSetTest.java
Sun Jul 24 14:31:52 2011
@@ -128,7 +128,7 @@ public class PolyhedronsSetTest {
                          1.0, c,
                          1.0, r.applyTo(barycenter.subtract(c)));
         Assert.assertEquals(0.0,
-                            newB.subtract((Vector3D) tree.getBarycenter()).getNorm(),
+                            newB.subtract(tree.getBarycenter()).getNorm(),
                             1.0e-10);
 
         final Vector3D[] expectedV = new Vector3D[] {
@@ -172,7 +172,7 @@ public class PolyhedronsSetTest {
                     ((PolygonsSet) facet.getRemainingRegion()).getVertices();
                 Assert.assertEquals(1, vertices.length);
                 for (int i = 0; i < vertices[0].length; ++i) {
-                    Vector3D v = (Vector3D) plane.toSpace(vertices[0][i]);
+                    Vector3D v = plane.toSpace(vertices[0][i]);
                     double d = Double.POSITIVE_INFINITY;
                     for (int k = 0; k < expectedV.length; ++k) {
                         d = FastMath.min(d, v.subtract(expectedV[k]).getNorm());

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/twod/LineTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/twod/LineTest.java?rev=1150381&r1=1150380&r2=1150381&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/twod/LineTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/twod/LineTest.java
Sun Jul 24 14:31:52 2011
@@ -42,16 +42,16 @@ public class LineTest {
     public void testAbscissa() {
         Line l = new Line(new Vector2D(2, 1), new Vector2D(-2, -2));
         Assert.assertEquals(0.0,
-                            ((Vector1D) l.toSubSpace(new Vector2D(-3,  4))).getX(),
+                            (l.toSubSpace(new Vector2D(-3,  4))).getX(),
                             1.0e-10);
         Assert.assertEquals(0.0,
-                            ((Vector1D) l.toSubSpace(new Vector2D( 3, -4))).getX(),
+                            (l.toSubSpace(new Vector2D( 3, -4))).getX(),
                             1.0e-10);
         Assert.assertEquals(-5.0,
-                            ((Vector1D) l.toSubSpace(new Vector2D( 7, -1))).getX(),
+                            (l.toSubSpace(new Vector2D( 7, -1))).getX(),
                             1.0e-10);
         Assert.assertEquals( 5.0,
-                             ((Vector1D) l.toSubSpace(new Vector2D(-1, -7))).getX(),
+                             (l.toSubSpace(new Vector2D(-1, -7))).getX(),
                              1.0e-10);
     }
 
@@ -67,12 +67,12 @@ public class LineTest {
         Line l = new Line(new Vector2D(2, 1), new Vector2D(-2, -2));
         for (double a = -2.0; a < 2.0; a += 0.2) {
             Vector1D pA = new Vector1D(a);
-            Vector2D point = (Vector2D) l.toSpace(pA);
-            Assert.assertEquals(a, ((Vector1D) l.toSubSpace(point)).getX(), 1.0e-10);
+            Vector2D point = l.toSpace(pA);
+            Assert.assertEquals(a, (l.toSubSpace(point)).getX(), 1.0e-10);
             Assert.assertEquals(0.0, l.getOffset(point),   1.0e-10);
             for (double o = -2.0; o < 2.0; o += 0.2) {
                 point = l.getPointAt(pA, o);
-                Assert.assertEquals(a, ((Vector1D) l.toSubSpace(point)).getX(), 1.0e-10);
+                Assert.assertEquals(a, (l.toSubSpace(point)).getX(), 1.0e-10);
                 Assert.assertEquals(o, l.getOffset(point),   1.0e-10);
             }
         }
@@ -120,7 +120,7 @@ public class LineTest {
     public void testIntersection() {
         Line    l1 = new Line(new Vector2D( 0, 1), new Vector2D(1, 2));
         Line    l2 = new Line(new Vector2D(-1, 2), new Vector2D(2, 1));
-        Vector2D p  = (Vector2D) l1.intersection(l2);
+        Vector2D p  = l1.intersection(l2);
         Assert.assertEquals(0.5, p.getX(), 1.0e-10);
         Assert.assertEquals(1.5, p.getY(), 1.0e-10);
     }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/twod/PolygonsSetTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/twod/PolygonsSetTest.java?rev=1150381&r1=1150380&r2=1150381&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/twod/PolygonsSetTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/euclidean/twod/PolygonsSetTest.java
Sun Jul 24 14:31:52 2011
@@ -232,18 +232,18 @@ public class PolygonsSetTest {
         SubLine s1 = (SubLine) set.intersection(l1.wholeHyperplane());
         List<Interval> i1 = ((IntervalsSet) s1.getRemainingRegion()).asList();
         Assert.assertEquals(2, i1.size());
-        Interval v10 = (Interval) i1.get(0);
-        Vector2D p10Lower = (Vector2D) l1.toSpace(new Vector1D(v10.getLower()));
+        Interval v10 = i1.get(0);
+        Vector2D p10Lower = l1.toSpace(new Vector1D(v10.getLower()));
         Assert.assertEquals(0.0, p10Lower.getX(), 1.0e-10);
         Assert.assertEquals(1.5, p10Lower.getY(), 1.0e-10);
-        Vector2D p10Upper = (Vector2D) l1.toSpace(new Vector1D(v10.getUpper()));
+        Vector2D p10Upper = l1.toSpace(new Vector1D(v10.getUpper()));
         Assert.assertEquals(0.5, p10Upper.getX(), 1.0e-10);
         Assert.assertEquals(2.0, p10Upper.getY(), 1.0e-10);
-        Interval v11 = (Interval) i1.get(1);
-        Vector2D p11Lower = (Vector2D) l1.toSpace(new Vector1D(v11.getLower()));
+        Interval v11 = i1.get(1);
+        Vector2D p11Lower = l1.toSpace(new Vector1D(v11.getLower()));
         Assert.assertEquals(1.0, p11Lower.getX(), 1.0e-10);
         Assert.assertEquals(2.5, p11Lower.getY(), 1.0e-10);
-        Vector2D p11Upper = (Vector2D) l1.toSpace(new Vector1D(v11.getUpper()));
+        Vector2D p11Upper = l1.toSpace(new Vector1D(v11.getUpper()));
         Assert.assertEquals(1.5, p11Upper.getX(), 1.0e-10);
         Assert.assertEquals(3.0, p11Upper.getY(), 1.0e-10);
 
@@ -251,11 +251,11 @@ public class PolygonsSetTest {
         SubLine s2 = (SubLine) set.intersection(l2.wholeHyperplane());
         List<Interval> i2 = ((IntervalsSet) s2.getRemainingRegion()).asList();
         Assert.assertEquals(1, i2.size());
-        Interval v20 = (Interval) i2.get(0);
-        Vector2D p20Lower = (Vector2D) l2.toSpace(new Vector1D(v20.getLower()));
+        Interval v20 = i2.get(0);
+        Vector2D p20Lower = l2.toSpace(new Vector1D(v20.getLower()));
         Assert.assertEquals(1.0, p20Lower.getX(), 1.0e-10);
         Assert.assertEquals(2.0, p20Lower.getY(), 1.0e-10);
-        Vector2D p20Upper = (Vector2D) l2.toSpace(new Vector1D(v20.getUpper()));
+        Vector2D p20Upper = l2.toSpace(new Vector1D(v20.getUpper()));
         Assert.assertEquals(3.0, p20Upper.getX(), 1.0e-10);
         Assert.assertEquals(2.0, p20Upper.getY(), 1.0e-10);
 
@@ -818,8 +818,8 @@ public class PolygonsSetTest {
     }
 
     private double intersectionAbscissa(Line l0, Line l1) {
-        Vector2D p = (Vector2D) l0.intersection(l1);
-        return ((Vector1D) l0.toSubSpace(p)).getX();
+        Vector2D p = l0.intersection(l1);
+        return (l0.toSubSpace(p)).getX();
     }
 
     private SubHyperplane<Euclidean2D> buildHalfLine(Vector2D start, Vector2D end,
@@ -827,17 +827,17 @@ public class PolygonsSetTest {
         Line   line  = new Line(start, end);
         double lower = startIsVirtual
         ? Double.NEGATIVE_INFINITY
-        : ((Vector1D) line.toSubSpace(start)).getX();
+        : (line.toSubSpace(start)).getX();
         double upper = startIsVirtual
-        ? ((Vector1D) line.toSubSpace(end)).getX()
+        ? (line.toSubSpace(end)).getX()
         : Double.POSITIVE_INFINITY;
         return new SubLine(line, new IntervalsSet(lower, upper));
     }
 
     private SubHyperplane<Euclidean2D> buildSegment(Vector2D start, Vector2D end) {
         Line   line  = new Line(start, end);
-        double lower = ((Vector1D) line.toSubSpace(start)).getX();
-        double upper = ((Vector1D) line.toSubSpace(end)).getX();
+        double lower = (line.toSubSpace(start)).getX();
+        double upper = (line.toSubSpace(end)).getX();
         return new SubLine(line, new IntervalsSet(lower, upper));
     }
 
@@ -853,9 +853,9 @@ public class PolygonsSetTest {
                                    double tolerance) {
         Line line = new Line(p1, p2);
         if (line.getOffset(p) < tolerance) {
-            double x  = ((Vector1D) line.toSubSpace(p)).getX();
-            double x1 = ((Vector1D) line.toSubSpace(p1)).getX();
-            double x2 = ((Vector1D) line.toSubSpace(p2)).getX();
+            double x  = (line.toSubSpace(p)).getX();
+            double x1 = (line.toSubSpace(p1)).getX();
+            double x2 = (line.toSubSpace(p2)).getX();
             return (((x - x1) * (x - x2) <= 0.0)
                     || (p1.distance(p) < tolerance)
                     || (p2.distance(p) < tolerance));

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/partitioning/utilities/AVLTreeTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/partitioning/utilities/AVLTreeTest.java?rev=1150381&r1=1150380&r2=1150381&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/partitioning/utilities/AVLTreeTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/geometry/partitioning/utilities/AVLTreeTest.java
Sun Jul 24 14:31:52 2011
@@ -157,7 +157,7 @@ public class AVLTreeTest {
     }
 
     private int value(AVLTree<Integer>.Node node) {
-        return ((Integer) node.getElement()).intValue();
+        return node.getElement().intValue();
     }
 
     private void checkOrder(AVLTree<Integer> tree) {



Mime
View raw message