You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2011/11/04 10:54:30 UTC
svn commit: r1197468 - in /commons/proper/math/trunk/src:
main/java/org/apache/commons/math/geometry/euclidean/oned/
main/java/org/apache/commons/math/geometry/euclidean/threed/
main/java/org/apache/commons/math/geometry/euclidean/twod/ main/java/org/a...
Author: sebb
Date: Fri Nov 4 09:54:30 2011
New Revision: 1197468
URL: http://svn.apache.org/viewvc?rev=1197468&view=rev
Log:
Unnecessary casts
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/oned/IntervalsSet.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/OutlineExtractor.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/Plane.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/SubPlane.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/SubLine.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/partitioning/AbstractRegion.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/oned/IntervalsSet.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/oned/IntervalsSet.java?rev=1197468&r1=1197467&r2=1197468&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/oned/IntervalsSet.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/oned/IntervalsSet.java Fri Nov 4 09:54:30 2011
@@ -234,7 +234,7 @@ public class IntervalsSet extends Abstra
if ((checkPoint(low, loc) == Location.INSIDE) &&
(checkPoint(high, loc) == Location.INSIDE)) {
// merge the last interval added and the first one of the high sub-tree
- x = ((Interval) list.remove(list.size() - 1)).getLower();
+ x = list.remove(list.size() - 1).getLower();
}
recurseList(high, list, x, upper);
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/OutlineExtractor.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/OutlineExtractor.java?rev=1197468&r1=1197467&r2=1197468&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/OutlineExtractor.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/OutlineExtractor.java Fri Nov 4 09:54:30 2011
@@ -199,13 +199,13 @@ public class OutlineExtractor {
for (Vector2D[] loop : vertices) {
final boolean closed = loop[0] != null;
int previous = closed ? (loop.length - 1) : 1;
- Vector3D previous3D = (Vector3D) plane.toSpace(loop[previous]);
+ Vector3D previous3D = plane.toSpace(loop[previous]);
int current = (previous + 1) % loop.length;
Vector2D pPoint = new Vector2D(previous3D.dotProduct(u),
previous3D.dotProduct(v));
while (current < loop.length) {
- final Vector3D current3D = (Vector3D) plane.toSpace(loop[current]);
+ final Vector3D current3D = plane.toSpace(loop[current]);
final Vector2D cPoint = new Vector2D(current3D.dotProduct(u),
current3D.dotProduct(v));
final org.apache.commons.math.geometry.euclidean.twod.Line line =
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/Plane.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/Plane.java?rev=1197468&r1=1197467&r2=1197468&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/Plane.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/Plane.java Fri Nov 4 09:54:30 2011
@@ -308,7 +308,7 @@ public class Plane implements Hyperplane
if (FastMath.abs(dot) < 1.0e-10) {
return null;
}
- final Vector3D point = (Vector3D) line.toSpace(Vector1D.ZERO);
+ final Vector3D point = line.toSpace(Vector1D.ZERO);
final double k = -(originOffset + w.dotProduct(point)) / dot;
return new Vector3D(1.0, point, k, direction);
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/SubPlane.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/SubPlane.java?rev=1197468&r1=1197467&r2=1197468&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/SubPlane.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/threed/SubPlane.java Fri Nov 4 09:54:30 2011
@@ -55,7 +55,7 @@ public class SubPlane extends AbstractSu
final Plane otherPlane = (Plane) hyperplane;
final Plane thisPlane = (Plane) getHyperplane();
- final Line inter = (Line) otherPlane.intersection(thisPlane);
+ final Line inter = otherPlane.intersection(thisPlane);
if (inter == null) {
// the hyperplanes are parallel,
@@ -98,7 +98,7 @@ public class SubPlane extends AbstractSu
final Plane otherPlane = (Plane) hyperplane;
final Plane thisPlane = (Plane) getHyperplane();
- final Line inter = (Line) otherPlane.intersection(thisPlane);
+ final Line inter = otherPlane.intersection(thisPlane);
if (inter == null) {
// the hyperplanes are parallel
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/SubLine.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/SubLine.java?rev=1197468&r1=1197467&r2=1197468&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/SubLine.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/euclidean/twod/SubLine.java Fri Nov 4 09:54:30 2011
@@ -164,7 +164,7 @@ public class SubLine extends AbstractSub
// the lines do intersect
final boolean direct = FastMath.sin(thisLine.getAngle() - otherLine.getAngle()) < 0;
- final Vector1D x = (Vector1D) thisLine.toSubSpace(crossing);
+ final Vector1D x = thisLine.toSubSpace(crossing);
return getRemainingRegion().side(new OrientedPoint(x, direct));
}
@@ -187,7 +187,7 @@ public class SubLine extends AbstractSub
// the lines do intersect
final boolean direct = FastMath.sin(thisLine.getAngle() - otherLine.getAngle()) < 0;
- final Vector1D x = (Vector1D) thisLine.toSubSpace(crossing);
+ final Vector1D x = thisLine.toSubSpace(crossing);
final SubHyperplane<Euclidean1D> subPlus = new OrientedPoint(x, !direct).wholeHyperplane();
final SubHyperplane<Euclidean1D> subMinus = new OrientedPoint(x, direct).wholeHyperplane();
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/partitioning/AbstractRegion.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/partitioning/AbstractRegion.java?rev=1197468&r1=1197467&r2=1197468&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/partitioning/AbstractRegion.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/geometry/partitioning/AbstractRegion.java Fri Nov 4 09:54:30 2011
@@ -605,7 +605,7 @@ public abstract class AbstractRegion<S e
* transform to the instance
*/
public AbstractRegion<S, T> applyTransform(final Transform<S, T> transform) {
- return (AbstractRegion<S, T>) buildNew(recurseTransform(getTree(false), transform));
+ return buildNew(recurseTransform(getTree(false), transform));
}
/** Recursively transform an inside/outside BSP-tree.
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java?rev=1197468&r1=1197467&r2=1197468&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java Fri Nov 4 09:54:30 2011
@@ -956,7 +956,7 @@ public class ArrayRealVectorTest {
Assert.assertEquals("compare values ", v1.subtract(v2).getNorm(),dist_2, normTolerance);
//octave = sqrt(sumsq(v1-v2))
- double dist_3 = v1.getDistance((RealVector) v2);
+ double dist_3 = v1.getDistance(v2);
Assert.assertEquals("compare values ", v1.subtract(v2).getNorm(),dist_3, normTolerance);
//octave = ???
@@ -966,7 +966,7 @@ public class ArrayRealVectorTest {
double d_getL1Distance_2 = v1.getL1Distance(v2_t);
Assert.assertEquals("compare values ", 9d, d_getL1Distance_2, normTolerance);
- double d_getL1Distance_3 = v1.getL1Distance((RealVector) v2);
+ double d_getL1Distance_3 = v1.getL1Distance(v2);
Assert.assertEquals("compare values ", 9d, d_getL1Distance_3, normTolerance);
//octave = ???
@@ -976,7 +976,7 @@ public class ArrayRealVectorTest {
double d_getLInfDistance_2 = v1. getLInfDistance(v2_t);
Assert.assertEquals("compare values ", 3d, d_getLInfDistance_2, normTolerance);
- double d_getLInfDistance_3 = v1. getLInfDistance((RealVector) v2);
+ double d_getLInfDistance_3 = v1. getLInfDistance(v2);
Assert.assertEquals("compare values ", 3d, d_getLInfDistance_3, normTolerance);
//octave = v1 + v2
@@ -1007,7 +1007,7 @@ public class ArrayRealVectorTest {
double[] result_ebeMultiply_2 = {4d, 10d, 18d};
assertClose("compare vect" ,v_ebeMultiply_2.toArray(),result_ebeMultiply_2,normTolerance);
- RealVector v_ebeMultiply_3 = v1.ebeMultiply((RealVector) v2);
+ RealVector v_ebeMultiply_3 = v1.ebeMultiply(v2);
double[] result_ebeMultiply_3 = {4d, 10d, 18d};
assertClose("compare vect" ,v_ebeMultiply_3.toArray(),result_ebeMultiply_3,normTolerance);
@@ -1020,7 +1020,7 @@ public class ArrayRealVectorTest {
double[] result_ebeDivide_2 = {0.25d, 0.4d, 0.5d};
assertClose("compare vect" ,v_ebeDivide_2.toArray(),result_ebeDivide_2,normTolerance);
- RealVector v_ebeDivide_3 = v1.ebeDivide((RealVector) v2);
+ RealVector v_ebeDivide_3 = v1.ebeDivide(v2);
double[] result_ebeDivide_3 = {0.25d, 0.4d, 0.5d};
assertClose("compare vect" ,v_ebeDivide_3.toArray(),result_ebeDivide_3,normTolerance);
@@ -1038,7 +1038,7 @@ public class ArrayRealVectorTest {
RealMatrix m_outerProduct_2 = v1.outerProduct(v2_t);
Assert.assertEquals("compare val ",4d, m_outerProduct_2.getEntry(0,0), normTolerance);
- RealMatrix m_outerProduct_3 = v1.outerProduct((RealVector) v2);
+ RealMatrix m_outerProduct_3 = v1.outerProduct(v2);
Assert.assertEquals("compare val ",4d, m_outerProduct_3.getEntry(0,0), normTolerance);
RealVector v_unitVector = v1.unitVector();
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java?rev=1197468&r1=1197467&r2=1197468&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/random/EmpiricalDistributionTest.java Fri Nov 4 09:54:30 2011
@@ -105,7 +105,7 @@ public final class EmpiricalDistribution
Assert.assertEquals(empiricalDistribution2.getSampleStats().getStandardDeviation(),
1.0173699343977738,10E-7);
- double[] bounds = ((EmpiricalDistributionImpl) empiricalDistribution2).getGeneratorUpperBounds();
+ double[] bounds = empiricalDistribution2.getGeneratorUpperBounds();
Assert.assertEquals(bounds.length, 100);
Assert.assertEquals(bounds[99], 1.0, 10e-12);