This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 6ec2776f7ee13659e5c1e3f9f7f86d4ac7ccd67e Author: Martin Desruisseaux <[email protected]> AuthorDate: Sat Mar 2 15:43:14 2019 +0100 Replace some !isInfinite(x) && !isNaN(x) pairs by isFinite(x). --- .../src/main/java/org/apache/sis/geometry/Envelopes.java | 4 ++-- .../src/main/java/org/apache/sis/geometry/Shapes2D.java | 2 +- .../org/apache/sis/internal/referencing/provider/MapProjection.java | 2 +- .../sis/referencing/operation/projection/MapProjectionTestCase.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java index f224383..3bb6332 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java @@ -742,7 +742,7 @@ poles: for (int i=0; i<dimension; i++, dimensionBitMask <<= 1) { boolean testMax = false; // Tells if we are testing the minimal or maximal value. do { final double extremum = testMax ? axis.getMaximumValue() : axis.getMinimumValue(); - if (Double.isInfinite(extremum) || Double.isNaN(extremum)) { + if (!Double.isFinite(extremum)) { /* * The axis is unbounded. It should always be the case when the target CRS is * a map projection, in which case this loop will finish soon and this method @@ -983,7 +983,7 @@ poles: for (int i=0; i<dimension; i++, dimensionBitMask <<= 1) { int dimension = envelope.getDimension(); while (dimension != 0) { final double length = envelope.getSpan(dimension - 1); - if (!Double.isNaN(length) && !Double.isInfinite(length)) { + if (Double.isFinite(length)) { break; } dimension--; diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Shapes2D.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Shapes2D.java index 9814dde..6280a06 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Shapes2D.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Shapes2D.java @@ -475,7 +475,7 @@ public final class Shapes2D extends Static { continue; } final double extremum = (border & 1) == 0 ? axis.getMinimumValue() : axis.getMaximumValue(); - if (Double.isInfinite(extremum) || Double.isNaN(extremum)) { + if (!Double.isFinite(extremum)) { continue; } if (targetPt == null) { diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java index 378cb6a..f83a469 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java @@ -192,7 +192,7 @@ public abstract class MapProjection extends AbstractProvider { public static void validate(final ParameterDescriptor<? extends Number> descriptor, final double value) throws IllegalArgumentException { - if (Double.isNaN(value) || Double.isInfinite(value)) { + if (!Double.isFinite(value)) { throw new IllegalArgumentException(Resources.format(Resources.Keys.IllegalParameterValue_2, descriptor.getName(), value)); } diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java index 074024f..46e8e99 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java @@ -154,7 +154,7 @@ abstract strictfp class MapProjectionTestCase extends MathTransformTestCase { coordinate[1] = φ; ((NormalizedProjection) transform).transform(coordinate, 0, coordinate, 0, false); final double y = coordinate[1]; - if (!isNaN(y) && !Double.isInfinite(y)) { + if (Double.isFinite(y)) { assertEquals(0, coordinate[0], tolerance); } return y;
