diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBaseDistanceShape.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBaseDistanceShape.java
index ec9b6b779e2..82e811ad6b5 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBaseDistanceShape.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBaseDistanceShape.java
@@ -44,7 +44,7 @@ public abstract class GeoBaseDistanceShape extends GeoBaseMembershipShape implem
@Override
public double computeDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
if (!isWithin(x,y,z)) {
- return Double.MAX_VALUE;
+ return Double.POSITIVE_INFINITY;
}
return distance(distanceStyle, x, y, z);
}
@@ -54,14 +54,14 @@ public abstract class GeoBaseDistanceShape extends GeoBaseMembershipShape implem
@Override
public void getDistanceBounds(final Bounds bounds, final DistanceStyle distanceStyle, final double distanceValue) {
- if (distanceValue == Double.MAX_VALUE) {
+ if (distanceValue == Double.POSITIVE_INFINITY) {
getBounds(bounds);
return;
}
distanceBounds(bounds, distanceStyle, distanceValue);
}
- /** Called by a {@code getDistanceBounds} method if distanceValue is not Double.MAX_VALUE. */
+ /** Called by a {@code getDistanceBounds} method if distanceValue is not Double.POSITIVE_INFINITY. */
protected abstract void distanceBounds(final Bounds bounds, final DistanceStyle distanceStyle, final double distanceValue);
}
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
index 23014f78966..694c96b14e4 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
@@ -171,7 +171,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
final GeoPoint[] ZIntersectionsY = travelPlaneFixedZ.findIntersections(planetModel, testPointFixedYPlane);
// There will be multiple intersection points found. We choose the one that has the lowest total distance, as measured in delta X, delta Y, and delta Z.
- double bestDistance = Double.MAX_VALUE;
+ double bestDistance = Double.POSITIVE_INFINITY;
double firstLegValue = 0.0;
double secondLegValue = 0.0;
Plane firstLegPlane = null;
@@ -323,7 +323,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
}
assert bestDistance > 0.0 : "Best distance should not be zero unless on single plane";
- assert bestDistance < Double.MAX_VALUE : "Couldn't find an intersection point of any kind";
+ assert bestDistance < Double.POSITIVE_INFINITY : "Couldn't find an intersection point of any kind";
final DualCrossingEdgeIterator edgeIterator = new DualCrossingEdgeIterator(firstLegPlane, firstLegAbovePlane, firstLegBelowPlane, secondLegPlane, x, y, z, intersectionPoint);
if (!firstLegTree.traverse(edgeIterator, firstLegValue)) {
@@ -390,7 +390,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
@Override
protected double outsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
- double minimumDistance = Double.MAX_VALUE;
+ double minimumDistance = Double.POSITIVE_INFINITY;
for (final Edge shapeStartEdge : shapeStartEdges) {
Edge shapeEdge = shapeStartEdge;
while (true) {
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoCompositeMembershipShape.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoCompositeMembershipShape.java
index 9747edad6fa..6600a343a1f 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoCompositeMembershipShape.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoCompositeMembershipShape.java
@@ -85,7 +85,7 @@ public class GeoCompositeMembershipShape implements GeoMembershipShape {
public double computeOutsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
if (isWithin(x,y,z))
return 0.0;
- double distance = Double.MAX_VALUE;
+ double distance = Double.POSITIVE_INFINITY;
for (GeoMembershipShape shape : shapes) {
final double normalDistance = shape.computeOutsideDistance(distanceStyle, x, y, z);
if (normalDistance < distance) {
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConcavePolygon.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConcavePolygon.java
index c18d40f75d4..0d8f6150b3c 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConcavePolygon.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConcavePolygon.java
@@ -409,7 +409,7 @@ class GeoConcavePolygon extends GeoBasePolygon {
@Override
protected double outsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
- double minimumDistance = Double.MAX_VALUE;
+ double minimumDistance = Double.POSITIVE_INFINITY;
for (final GeoPoint edgePoint : points) {
final double newDist = distanceStyle.computeDistance(edgePoint, x,y,z);
if (newDist < minimumDistance) {
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConvexPolygon.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConvexPolygon.java
index 6f71d18bb5b..2ed516ada2c 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConvexPolygon.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConvexPolygon.java
@@ -397,7 +397,7 @@ class GeoConvexPolygon extends GeoBasePolygon {
@Override
protected double outsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
- double minimumDistance = Double.MAX_VALUE;
+ double minimumDistance = Double.POSITIVE_INFINITY;
for (final GeoPoint edgePoint : points) {
final double newDist = distanceStyle.computeDistance(edgePoint, x,y,z);
if (newDist < minimumDistance) {
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePoint.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePoint.java
index 9328b4bc304..ab085791745 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePoint.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePoint.java
@@ -129,7 +129,7 @@ class GeoDegeneratePoint extends GeoPoint implements GeoBBox, GeoCircle {
public double computeDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
if (isWithin(x,y,z))
return 0.0;
- return Double.MAX_VALUE;
+ return Double.POSITIVE_INFINITY;
}
@Override
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDistance.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDistance.java
index cf8fa230c00..51c258ae51e 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDistance.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDistance.java
@@ -26,13 +26,13 @@ package org.apache.lucene.spatial3d.geom;
public interface GeoDistance extends Membership {
// The following methods compute distances from the shape to a point
- // expected to be INSIDE the shape. Typically a value of Double.MAX_VALUE
+ // expected to be INSIDE the shape. Typically a value of Double.POSITIVE_INFINITY
// is returned for points that happen to be outside the shape.
/**
* Compute this shape's internal "distance" to the GeoPoint.
* Implementations should clarify how this is computed when it's non-obvious.
- * A return value of Double.MAX_VALUE should be returned for
+ * A return value of Double.POSITIVE_INFINITY should be returned for
* points outside of the shape.
*
* @param distanceStyle is the distance style.
@@ -46,7 +46,7 @@ public interface GeoDistance extends Membership {
/**
* Compute this shape's internal "distance" to the GeoPoint.
* Implementations should clarify how this is computed when it's non-obvious.
- * A return value of Double.MAX_VALUE should be returned for
+ * A return value of Double.POSITIVE_INFINITY should be returned for
* points outside of the shape.
*
* @param x is the point's unit x coordinate (using U.S. convention).
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
index b24d5afb913..0f067176b6a 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
@@ -201,7 +201,7 @@ class GeoStandardPath extends GeoBasePath {
double currentDistance = 0.0;
for (PathSegment segment : segments) {
double distance = segment.pathDistance(planetModel, distanceStyle, x,y,z);
- if (distance != Double.MAX_VALUE)
+ if (distance != Double.POSITIVE_INFINITY)
return currentDistance + distance;
currentDistance += segment.fullPathDistance(distanceStyle);
}
@@ -210,13 +210,13 @@ class GeoStandardPath extends GeoBasePath {
currentDistance = 0.0;
for (SegmentEndpoint endpoint : endPoints) {
double distance = endpoint.pathDistance(distanceStyle, x, y, z);
- if (distance != Double.MAX_VALUE)
+ if (distance != Double.POSITIVE_INFINITY)
return currentDistance + distance;
if (segmentIndex < segments.size())
currentDistance += segments.get(segmentIndex++).fullPathDistance(distanceStyle);
}
- return Double.MAX_VALUE;
+ return Double.POSITIVE_INFINITY;
}
@Override
@@ -227,7 +227,7 @@ class GeoStandardPath extends GeoBasePath {
@Override
protected double outsideDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
- double minDistance = Double.MAX_VALUE;
+ double minDistance = Double.POSITIVE_INFINITY;
for (final SegmentEndpoint endpoint : endPoints) {
final double newDistance = endpoint.outsideDistance(distanceStyle, x,y,z);
if (newDistance < minDistance)
@@ -518,7 +518,7 @@ class GeoStandardPath extends GeoBasePath {
*/
public double pathDistance(final DistanceStyle distanceStyle, final double x, final double y, final double z) {
if (!isWithin(x,y,z))
- return Double.MAX_VALUE;
+ return Double.POSITIVE_INFINITY;
return distanceStyle.computeDistance(this.point, x, y, z);
}
@@ -713,7 +713,7 @@ class GeoStandardPath extends GeoBasePath {
*/
public double pathDistance(final PlanetModel planetModel, final DistanceStyle distanceStyle, final double x, final double y, final double z) {
if (!isWithin(x,y,z))
- return Double.MAX_VALUE;
+ return Double.POSITIVE_INFINITY;
// (1) Compute normalizedPerpPlane. If degenerate, then return point distance from start to point.
// Want no allocations or expensive operations! so we do this the hard way
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java
index 8dc9be54d5e..567d12ee4d1 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java
@@ -294,7 +294,7 @@ public class Plane extends Vector {
if (evaluateIsZero(x,y,z)) {
if (meetsAllBounds(x,y,z, bounds))
return 0.0;
- return Double.MAX_VALUE;
+ return Double.POSITIVE_INFINITY;
}
// First, compute the perpendicular plane.
@@ -307,7 +307,7 @@ public class Plane extends Vector {
final GeoPoint[] intersectionPoints = findIntersections(planetModel, perpPlane);
// For each point, compute a linear distance, and take the minimum of them
- double minDistance = Double.MAX_VALUE;
+ double minDistance = Double.POSITIVE_INFINITY;
for (final GeoPoint intersectionPoint : intersectionPoints) {
if (meetsAllBounds(intersectionPoint, bounds)) {
@@ -347,7 +347,7 @@ public class Plane extends Vector {
final double perpZ = z - dist * this.z;
if (!meetsAllBounds(perpX, perpY, perpZ, bounds)) {
- return Double.MAX_VALUE;
+ return Double.POSITIVE_INFINITY;
}
return Math.abs(dist);
@@ -373,7 +373,7 @@ public class Plane extends Vector {
*/
public double normalDistanceSquared(final double x, final double y, final double z, final Membership... bounds) {
final double normal = normalDistance(x,y,z,bounds);
- if (normal == Double.MAX_VALUE)
+ if (normal == Double.POSITIVE_INFINITY)
return normal;
return normal * normal;
}
@@ -406,7 +406,7 @@ public class Plane extends Vector {
if (evaluateIsZero(x,y,z)) {
if (meetsAllBounds(x,y,z, bounds))
return 0.0;
- return Double.MAX_VALUE;
+ return Double.POSITIVE_INFINITY;
}
// First, compute the perpendicular plane.
@@ -419,7 +419,7 @@ public class Plane extends Vector {
final GeoPoint[] intersectionPoints = findIntersections(planetModel, perpPlane);
// For each point, compute a linear distance, and take the minimum of them
- double minDistance = Double.MAX_VALUE;
+ double minDistance = Double.POSITIVE_INFINITY;
for (final GeoPoint intersectionPoint : intersectionPoints) {
if (meetsAllBounds(intersectionPoint, bounds)) {
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoCircleTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoCircleTest.java
index ff2252cb7b0..84100cdc07e 100755
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoCircleTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoCircleTest.java
@@ -27,9 +27,9 @@ public class GeoCircleTest extends LuceneTestCase {
GeoPoint gp;
c = GeoCircleFactory.makeGeoCircle(PlanetModel.SPHERE, 0.0, -0.5, 0.1);
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
- assertEquals(Double.MAX_VALUE, c.computeDistance(DistanceStyle.ARC,gp), 0.0);
- assertEquals(Double.MAX_VALUE, c.computeDistance(DistanceStyle.NORMAL,gp), 0.0);
- assertEquals(Double.MAX_VALUE, c.computeDistance(DistanceStyle.NORMAL,gp), 0.0);
+ assertEquals(Double.POSITIVE_INFINITY, c.computeDistance(DistanceStyle.ARC,gp), 0.0);
+ assertEquals(Double.POSITIVE_INFINITY, c.computeDistance(DistanceStyle.NORMAL,gp), 0.0);
+ assertEquals(Double.POSITIVE_INFINITY, c.computeDistance(DistanceStyle.NORMAL,gp), 0.0);
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.5);
assertEquals(0.0, c.computeDistance(DistanceStyle.ARC,gp), 0.000001);
assertEquals(0.0, c.computeDistance(DistanceStyle.NORMAL,gp), 0.000001);
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPathTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPathTest.java
index e68e3f48779..96c7ea7f2d2 100755
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPathTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPathTest.java
@@ -36,13 +36,13 @@ public class GeoPathTest {
p.addPoint(0.0, 0.2);
p.done();
gp = new GeoPoint(PlanetModel.SPHERE, Math.PI * 0.5, 0.15);
- assertEquals(Double.MAX_VALUE, p.computeDistance(DistanceStyle.ARC,gp), 0.0);
+ assertEquals(Double.POSITIVE_INFINITY, p.computeDistance(DistanceStyle.ARC,gp), 0.0);
gp = new GeoPoint(PlanetModel.SPHERE, 0.05, 0.15);
assertEquals(0.15 + 0.05, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.12);
assertEquals(0.12 + 0.0, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
gp = new GeoPoint(PlanetModel.SPHERE, -0.15, 0.05);
- assertEquals(Double.MAX_VALUE, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
+ assertEquals(Double.POSITIVE_INFINITY, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.25);
assertEquals(0.20 + 0.05, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.05);
@@ -65,9 +65,9 @@ public class GeoPathTest {
p.addPoint(Math.PI * 0.25, -0.5);
p.done();
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
- assertEquals(Double.MAX_VALUE, p.computeDistance(DistanceStyle.ARC,gp), 0.0);
+ assertEquals(Double.POSITIVE_INFINITY, p.computeDistance(DistanceStyle.ARC,gp), 0.0);
gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -1.0);
- assertEquals(Double.MAX_VALUE, p.computeDistance(DistanceStyle.ARC,gp), 0.0);
+ assertEquals(Double.POSITIVE_INFINITY, p.computeDistance(DistanceStyle.ARC,gp), 0.0);
gp = new GeoPoint(PlanetModel.SPHERE, Math.PI * 0.25 + 0.05, -0.5);
assertEquals(Math.PI * 0.5 + 0.05, p.computeDistance(DistanceStyle.ARC,gp), 0.000001);
gp = new GeoPoint(PlanetModel.SPHERE, -Math.PI * 0.25 - 0.05, -0.5);