replaced string comparison with instanceof

This commit is contained in:
Redecouverte 2011-02-28 00:52:26 +01:00
parent 0d80265ff2
commit 676e744c02
2 changed files with 4 additions and 4 deletions

View File

@ -164,7 +164,7 @@ public List<ProtectedRegion> getIntersectingRegions(List<ProtectedRegion> region
} }
// Check whether the other regions points are inside the current region // Check whether the other regions points are inside the current region
if (region.getTypeName() == "polygon") { if (region instanceof ProtectedPolygonalRegion) {
for (i2 = 0; i < ((ProtectedPolygonalRegion)region).getPoints().size(); i++) { for (i2 = 0; i < ((ProtectedPolygonalRegion)region).getPoints().size(); i++) {
BlockVector2D pt2Dr = ((ProtectedPolygonalRegion)region).getPoints().get(i2); BlockVector2D pt2Dr = ((ProtectedPolygonalRegion)region).getPoints().get(i2);
int minYr = ((ProtectedPolygonalRegion)region).minY; int minYr = ((ProtectedPolygonalRegion)region).minY;
@ -177,7 +177,7 @@ public List<ProtectedRegion> getIntersectingRegions(List<ProtectedRegion> region
continue; continue;
} }
} }
} else if (region.getTypeName() == "cuboid") { } else if (region instanceof ProtectedCuboidRegion) {
BlockVector ptcMin = region.getMinimumPoint(); BlockVector ptcMin = region.getMinimumPoint();
BlockVector ptcMax = region.getMaximumPoint(); BlockVector ptcMax = region.getMaximumPoint();

View File

@ -171,7 +171,7 @@ public List<ProtectedRegion> getIntersectingRegions(List<ProtectedRegion> region
} }
// Check whether the other regions points are inside the current region // Check whether the other regions points are inside the current region
if (region.getTypeName() == "polygon") { if (region instanceof ProtectedPolygonalRegion) {
for (i2 = 0; i < ((ProtectedPolygonalRegion)region).getPoints().size(); i++) { for (i2 = 0; i < ((ProtectedPolygonalRegion)region).getPoints().size(); i++) {
BlockVector2D pt2Dr = ((ProtectedPolygonalRegion)region).getPoints().get(i2); BlockVector2D pt2Dr = ((ProtectedPolygonalRegion)region).getPoints().get(i2);
int minYr = ((ProtectedPolygonalRegion)region).minY; int minYr = ((ProtectedPolygonalRegion)region).minY;
@ -184,7 +184,7 @@ public List<ProtectedRegion> getIntersectingRegions(List<ProtectedRegion> region
continue; continue;
} }
} }
} else if (region.getTypeName() == "cuboid") { } else if (region instanceof ProtectedCuboidRegion) {
BlockVector ptcMin = region.getMinimumPoint(); BlockVector ptcMin = region.getMinimumPoint();
BlockVector ptcMax = region.getMaximumPoint(); BlockVector ptcMax = region.getMaximumPoint();