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 d3085dbba514f5c333ab7dbe61cb5ffe0770b014 Author: Martin Desruisseaux <[email protected]> AuthorDate: Mon Jun 10 17:35:55 2019 +0200 Rename ComparisonMode.APPROXIMATIVE as APPROXIMATE. https://issues.apache.org/jira/browse/SIS-440 --- .../org/apache/sis/console/IdentifierCommand.java | 6 ++-- .../apache/sis/console/IdentifierState.properties | 2 +- .../sis/console/IdentifierState_fr.properties | 2 +- .../java/org/apache/sis/xml/NilReasonTest.java | 4 +-- .../gazetteer/MilitaryGridReferenceSystem.java | 2 +- .../internal/referencing/DefinitionVerifier.java | 2 +- .../sis/parameter/DefaultParameterValueGroup.java | 2 +- .../parameter/UnmodifiableParameterValueGroup.java | 2 +- .../sis/referencing/AbstractIdentifiedObject.java | 6 ++-- .../apache/sis/referencing/IdentifiedObjects.java | 4 +-- .../sis/referencing/crs/DefaultDerivedCRS.java | 2 +- .../sis/referencing/crs/DefaultProjectedCRS.java | 2 +- .../sis/referencing/datum/DefaultEllipsoid.java | 2 +- .../factory/IdentifiedObjectFinder.java | 6 ++-- .../operation/CoordinateOperationRegistry.java | 2 +- .../sis/referencing/operation/matrix/Matrices.java | 4 +-- .../referencing/operation/matrix/MatrixSIS.java | 2 +- .../projection/LambertConicConformal.java | 12 +++---- .../transform/AbstractLinearTransform.java | 6 ++-- .../operation/transform/AbstractMathTransform.java | 8 ++--- .../parameter/DefaultParameterValueGroupTest.java | 2 +- .../referencing/crs/DefaultProjectedCRSTest.java | 2 +- .../transform/MolodenskyTransformTest.java | 2 +- .../org/apache/sis/internal/util/Numerics.java | 6 ++-- .../org/apache/sis/measure/LinearConverter.java | 2 +- .../java/org/apache/sis/util/ComparisonMode.java | 42 ++++++++++++++++------ .../org/apache/sis/util/LenientComparable.java | 12 +++---- .../main/java/org/apache/sis/util/Utilities.java | 6 ++-- .../org/apache/sis/internal/util/NumericsTest.java | 20 +++++------ .../src/test/java/org/apache/sis/test/Assert.java | 18 +++++----- 30 files changed, 105 insertions(+), 85 deletions(-) diff --git a/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java b/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java index e80e360..9171156 100644 --- a/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java +++ b/application/sis-console/src/main/java/org/apache/sis/console/IdentifierCommand.java @@ -53,7 +53,7 @@ final class IdentifierCommand extends FormattedOutputCommand { * update {@code IdentifierState.properties} accordingly. */ private enum State { - VALID(" "), APPROXIMATIVE("~ "), AXIS_ORDER("! "), MISMATCH("!! "), UNKNOWN("? "); + VALID(" "), APPROXIMATE("~ "), AXIS_ORDER("! "), MISMATCH("!! "), UNKNOWN("? "); /** The string representation. */ final String text; private State(final String p) {this.text = p;}; @@ -185,8 +185,8 @@ final class IdentifierCommand extends FormattedOutputCommand { state = State.AXIS_ORDER; break; } - case APPROXIMATIVE: { - state = State.APPROXIMATIVE; + case APPROXIMATE: { + state = State.APPROXIMATE; rs = def; break; } diff --git a/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState.properties b/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState.properties index 107ba40..bf742b1 100644 --- a/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState.properties +++ b/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState.properties @@ -1,6 +1,6 @@ # Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; # and to You under the Apache License, Version 2.0. -APPROXIMATIVE=Identified object has minor numerical differences compared to definition provided by authority. +APPROXIMATE=Identified object has minor numerical differences compared to definition provided by authority. AXIS_ORDER=Identified object matches definition provided by authority except for coordinate system axes. MISMATCH=Identifier associated to an object that does not match the definition provided by authority. UNKNOWN=Unknown identifier. Exactness can not be verified. diff --git a/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState_fr.properties b/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState_fr.properties index c6933b5..00a6ea8 100644 --- a/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState_fr.properties +++ b/application/sis-console/src/main/resources/org/apache/sis/console/IdentifierState_fr.properties @@ -1,6 +1,6 @@ # Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; # and to You under the Apache License, Version 2.0. -APPROXIMATIVE=L\u2019objet identifi� contient des diff�rences num�riques mineures comparativement � la d�finition fournie par l\u2019autorit�. +APPROXIMATE=L\u2019objet identifi� contient des diff�rences num�riques mineures comparativement � la d�finition fournie par l\u2019autorit�. AXIS_ORDER=L\u2019objet identifi� correspond � la d�finition fournie par l\u2019autorit�, except� les axes du syst�me de coordonn�es. MISMATCH=L\u2019identifiant est associ� � un objet qui ne correspond pas � la d�finition fournie par l\u2019autorit�. UNKNOWN=Identifiant inconnu. Son exactitude ne peut pas �tre v�rifi�e. diff --git a/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonTest.java b/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonTest.java index f20f97d..ce3e27f 100644 --- a/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonTest.java +++ b/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonTest.java @@ -284,7 +284,7 @@ public final strictfp class NilReasonTest extends TestCase { assertFalse(c.equals(e2, ComparisonMode.STRICT)); assertFalse(c.equals(e2, ComparisonMode.BY_CONTRACT)); assertTrue (c.equals(e2, ComparisonMode.IGNORE_METADATA)); - assertTrue (c.equals(e2, ComparisonMode.APPROXIMATIVE)); + assertTrue (c.equals(e2, ComparisonMode.APPROXIMATE)); assertTrue (c.equals(e2, ComparisonMode.DEBUG)); // Following object should alway be different because it does not implement the same interface. @@ -292,7 +292,7 @@ public final strictfp class NilReasonTest extends TestCase { assertFalse(c.equals(r1, ComparisonMode.STRICT)); assertFalse(c.equals(r1, ComparisonMode.BY_CONTRACT)); assertFalse(c.equals(r1, ComparisonMode.IGNORE_METADATA)); - assertFalse(c.equals(r1, ComparisonMode.APPROXIMATIVE)); + assertFalse(c.equals(r1, ComparisonMode.APPROXIMATE)); assertFalse(c.equals(r1, ComparisonMode.DEBUG)); } } diff --git a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java index 1d6a6e8..7667c0a 100644 --- a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java +++ b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java @@ -2035,7 +2035,7 @@ parse: switch (part) { isValid = Math.abs(zoneError) <= 2; // Tolerance in zone numbers for high latitudes. } else { final double rλ = Math.IEEEremainder(λ - ZONER.origin, ZONER.width); // Distance to closest zone change, in degrees of longitude. - final double cv = (minX - ZONER.easting) / (λ - λ0); // Approximative conversion factor from degrees to metres. + final double cv = (minX - ZONER.easting) / (λ - λ0); // Approximate conversion factor from degrees to metres. isValid = (Math.abs(rλ) * cv <= sx); // Be tolerant if distance in metres is less than resolution. if (isValid) { isValid = (zoneError == (rλ < 0 ? -1 : +1)); // Verify also that the error is on the side of the zone change. diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java index bae67aa..183eb62 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DefinitionVerifier.java @@ -189,7 +189,7 @@ public final class DefinitionVerifier { int similarity = 0; final AbstractCRS ca = AbstractCRS.castOrCopy(authoritative); AbstractCRS variant = ca; - while (!variant.equals(crs, ComparisonMode.APPROXIMATIVE)) { + while (!variant.equals(crs, ComparisonMode.APPROXIMATE)) { if (similarity < VARIANTS.length) { variant = ca.forConvention(VARIANTS[similarity++]); } else if (identifier == null) { diff --git a/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java b/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java index 2597fba..5986687 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java @@ -398,7 +398,7 @@ public class DefaultParameterValueGroup extends Parameters implements LenientCom * <ul> * <li>{@link ComparisonMode#STRICT} and {@link ComparisonMode#BY_CONTRACT BY_CONTRACT} * take in account the parameter order.</li> - * <li>{@link ComparisonMode#IGNORE_METADATA} and {@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} + * <li>{@link ComparisonMode#IGNORE_METADATA} and {@link ComparisonMode#APPROXIMATE APPROXIMATE} * ignore the order of parameter values (but not necessarily the order of parameter descriptors).</li> * </ul> * diff --git a/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java b/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java index b256b60..155060f 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java @@ -198,7 +198,7 @@ final class UnmodifiableParameterValueGroup extends Parameters implements Lenien * <ul> * <li>{@link ComparisonMode#STRICT} and {@link ComparisonMode#BY_CONTRACT BY_CONTRACT} * take in account the parameter order.</li> - * <li>{@link ComparisonMode#IGNORE_METADATA} and {@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} + * <li>{@link ComparisonMode#IGNORE_METADATA} and {@link ComparisonMode#APPROXIMATE APPROXIMATE} * ignore the order of parameter values (but not necessarily the order of parameter descriptors).</li> * </ul> * diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java index cd1bb6b..1e606f0 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java @@ -644,10 +644,10 @@ public class AbstractIdentifiedObject extends FormattableObject implements Ident * is considered ignorable metadata while the explicit arguments given to the constructor (if any) are * considered non-ignorable. Note that there is some exceptions to this rule of thumb — see * <cite>When object name matter</cite> below.</td></tr> - * <tr><td>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE}:</td> + * <tr><td>{@link ComparisonMode#APPROXIMATE APPROXIMATE}:</td> * <td>Same as {@code IGNORE_METADATA}, with some tolerance threshold on numerical values.</td></tr> * <tr><td>{@link ComparisonMode#ALLOW_VARIANT ALLOW_VARIANT}:</td> - * <td>Same as {@code APPROXIMATIVE}, but ignores coordinate system axes.</td></tr> + * <td>Same as {@code APPROXIMATE}, but ignores coordinate system axes.</td></tr> * <tr><td>{@link ComparisonMode#DEBUG DEBUG}:</td> * <td>Special mode for figuring out why two objects expected to be equal are not.</td></tr> * </table> @@ -721,7 +721,7 @@ public class AbstractIdentifiedObject extends FormattableObject implements Ident deepEquals(getRemarks(), that.getRemarks(), mode); } case IGNORE_METADATA: - case APPROXIMATIVE: + case APPROXIMATE: case ALLOW_VARIANT: case DEBUG: { return implementsSameInterface(object); diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java index ce6a533..33faa56 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java @@ -395,7 +395,7 @@ public final class IdentifiedObjects extends Static { /** * Looks up a URN, such as {@code "urn:ogc:def:crs:EPSG:9.1:4326"}, of the specified object. * This method searches in all {@linkplain org.apache.sis.referencing.factory.GeodeticAuthorityFactory geodetic - * authority factories} known to SIS for an object {@linkplain org.apache.sis.util.ComparisonMode#APPROXIMATIVE + * authority factories} known to SIS for an object {@linkplain org.apache.sis.util.ComparisonMode#APPROXIMATE * approximately equals} to the specified object. Then there is a choice: * * <ul> @@ -512,7 +512,7 @@ public final class IdentifiedObjects extends Static { /** * Looks up an EPSG code, such as {@code 4326}, of the specified object. This method searches in EPSG factories - * known to SIS for an object {@linkplain org.apache.sis.util.ComparisonMode#APPROXIMATIVE approximately equals} + * known to SIS for an object {@linkplain org.apache.sis.util.ComparisonMode#APPROXIMATE approximately equals} * to the specified object. If such an object is found, then its EPSG identifier is returned. * Otherwise or if there is ambiguity, this method returns {@code null}. * diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java index afeb4fe..32c6bcf 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java @@ -499,7 +499,7 @@ public class DefaultDerivedCRS extends AbstractDerivedCRS<Conversion> implements * In addition to the metadata documented in the * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#equals(Object, ComparisonMode) parent class}, * this method considers coordinate system axes of the {@linkplain #getBaseCRS() base CRS} as metadata. - * This means that if the given {@code ComparisonMode} is {@code IGNORE_METADATA} or {@code APPROXIMATIVE}, + * This means that if the given {@code ComparisonMode} is {@code IGNORE_METADATA} or {@code APPROXIMATE}, * then axis order of the base CRS are ignored * (but <strong>not</strong> axis order of <strong>this</strong> derived CRS). * diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java index 7588d56..f180068 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java @@ -296,7 +296,7 @@ public class DefaultProjectedCRS extends AbstractDerivedCRS<Projection> implemen * In addition to the metadata documented in the * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#equals(Object, ComparisonMode) parent class}, * this method considers coordinate system axes of the {@linkplain #getBaseCRS() base CRS} as metadata. - * This means that if the given {@code ComparisonMode} is {@code IGNORE_METADATA} or {@code APPROXIMATIVE}, + * This means that if the given {@code ComparisonMode} is {@code IGNORE_METADATA} or {@code APPROXIMATE}, * then axis order of the base geographic CRS are ignored * (but <strong>not</strong> axis order of <strong>this</strong> projected CRS). * diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java index bcc59de..e98c4b0 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java @@ -720,7 +720,7 @@ public class DefaultEllipsoid extends AbstractIdentifiedObject implements Ellips if (!Utilities.deepEquals(unit, that.getAxisUnit(), mode)) { return false; } - final UnitConverter c = mode.isApproximative() ? unit.getConverterTo(Units.METRE) : null; + final UnitConverter c = mode.isApproximate() ? unit.getConverterTo(Units.METRE) : null; boolean isMinor = false; double v1 = this.getSemiMajorAxis(); double v2 = that.getSemiMajorAxis(); diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java index 4edfc80..07602e9 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java @@ -120,7 +120,7 @@ public class IdentifiedObjectFinder { * The criterion for determining if a candidate found by {@code IdentifiedObjectFinder} * should be considered equals to the requested object. */ - static final ComparisonMode COMPARISON_MODE = ComparisonMode.APPROXIMATIVE; + static final ComparisonMode COMPARISON_MODE = ComparisonMode.APPROXIMATE; /** * The factory to use for creating objects. This is the factory specified at construction time. @@ -289,7 +289,7 @@ public class IdentifiedObjectFinder { * </ul> * * The created objects which are equal to the specified object in the - * the sense of {@link ComparisonMode#APPROXIMATIVE} are returned. + * the sense of {@link ComparisonMode#APPROXIMATE} are returned. * * @param object the object looked up. * @return the identified objects, or an empty set if not found. @@ -536,7 +536,7 @@ public class IdentifiedObjectFinder { /** * Returns a set of authority codes that <strong>may</strong> identify the same object than the specified one. * The returned set must contains <em>at least</em> the code of every objects that are - * {@linkplain ComparisonMode#APPROXIMATIVE approximately equal} to the specified one. + * {@link ComparisonMode#APPROXIMATE approximately equal} to the specified one. * However the set may conservatively contains the code for more objects if an exact search is too expensive. * * <p>This method is invoked by the default {@link #find(IdentifiedObject)} method implementation. diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java index c522d74..70bca5f 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java @@ -274,7 +274,7 @@ class CoordinateOperationRegistry { final Identifier identifier = IdentifiedObjects.getIdentifier(candidate, registry.getAuthority()); if (identifier != null) { final String code = identifier.getCode(); - if (Utilities.deepEquals(candidate, crs, ComparisonMode.APPROXIMATIVE)) { + if (Utilities.deepEquals(candidate, crs, ComparisonMode.APPROXIMATE)) { codes.add(0, code); // If axis order match, give precedence to that CRS. } else { codes.add(code); diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java index e561bc3..cb1844c 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java @@ -1028,7 +1028,7 @@ public final class Matrices extends Static { * but are not required to be the same implementation class (any {@link Matrix} is okay).</li> * <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA}: same as {@code BY_CONTRACT}, * since matrices have no metadata.</li> - * <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE}: + * <li>{@link ComparisonMode#APPROXIMATE APPROXIMATE}: * the two matrices must have the same size, but the element values can differ up to some threshold. * The threshold value is determined empirically and may change in any future SIS versions. * For more control, use {@link #equals(Matrix, Matrix, double, boolean)} instead.</li> @@ -1048,7 +1048,7 @@ public final class Matrices extends Static { case IGNORE_METADATA: return equals(m1, m2, 0, false); case DEBUG: // Fall through case ALLOW_VARIANT: // Fall through - case APPROXIMATIVE: return equals(m1, m2, Numerics.COMPARISON_THRESHOLD, true); + case APPROXIMATE: return equals(m1, m2, Numerics.COMPARISON_THRESHOLD, true); default: throw new IllegalArgumentException(Errors.format( Errors.Keys.UnknownEnumValue_2, ComparisonMode.class, mode)); } diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java index 29a21ef..28ef560 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/MatrixSIS.java @@ -811,7 +811,7 @@ public abstract class MatrixSIS implements Matrix, LenientComparable, Cloneable, * the two matrices must have the same size and the same element values, * but are not required to be the same implementation class (any {@link Matrix} is okay).</li> * <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA}: same as {@code BY_CONTRACT}. - * <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE}: + * <li>{@link ComparisonMode#APPROXIMATE APPROXIMATE}: * the two matrices must have the same size, but the element values can differ up to some threshold. * The threshold value is determined empirically and may change in any future SIS versions.</li> * </ul> diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java index 7d9d875..ea021fd 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java @@ -475,12 +475,12 @@ public class LambertConicConformal extends ConformalProjection { * if no special checks are applied:</p> * * {@preformat text - * ┌───────┬─────────────────────────────┬───────────────────────────┐ - * │ │ Spherical │ Ellipsoidal │ - * ├───────┼─────────────────────────────┼───────────────────────────┤ - * │ North │ Approximative (y = small) │ Exact answer (y = 0.0) │ - * │ South │ Exact answer (y = +∞) │ Approximative (y = big) │ - * └───────┴─────────────────────────────┴───────────────────────────┘ + * ┌───────┬──────────────────────────┬────────────────────────┐ + * │ │ Spherical │ Ellipsoidal │ + * ├───────┼──────────────────────────┼────────────────────────┤ + * │ North │ Approximate (y = small) │ Exact answer (y = 0.0) │ + * │ South │ Exact answer (y = +∞) │ Approximate (y = big) │ + * └───────┴──────────────────────────┴────────────────────────┘ * } * </div> * diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java index d3593d7..3bfe198 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java @@ -274,8 +274,8 @@ abstract class AbstractLinearTransform extends AbstractMathTransform implements if (object == null) { return false; } - final boolean isApproximative = mode.isApproximative(); - if (!isApproximative && getClass() == object.getClass()) { + final boolean isApproximate = mode.isApproximate(); + if (!isApproximate && getClass() == object.getClass()) { if (!equalsSameClass(object)) { return false; } @@ -341,7 +341,7 @@ abstract class AbstractLinearTransform extends AbstractMathTransform implements } catch (NoninvertibleTransformException e) { // Leave 'mo' to null. } - return Matrices.equals(mt, mo, isApproximative ? Numerics.COMPARISON_THRESHOLD : 0, isApproximative); + return Matrices.equals(mt, mo, isApproximate ? Numerics.COMPARISON_THRESHOLD : 0, isApproximate); } /** diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java index 5664883..9d857db 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java @@ -811,10 +811,10 @@ public abstract class AbstractMathTransform extends FormattableObject return false; } if (tr1 instanceof LenientComparable) { - return ((LenientComparable) tr1).equals(tr2, ComparisonMode.APPROXIMATIVE); + return ((LenientComparable) tr1).equals(tr2, ComparisonMode.APPROXIMATE); } if (tr2 instanceof LenientComparable) { - return ((LenientComparable) tr2).equals(tr1, ComparisonMode.APPROXIMATIVE); + return ((LenientComparable) tr2).equals(tr1, ComparisonMode.APPROXIMATE); } return tr1.equals(tr2); } @@ -916,7 +916,7 @@ public abstract class AbstractMathTransform extends FormattableObject * Compares the specified object with this math transform for equality. * Two math transforms are considered equal if, given identical source positions, their * {@linkplain #transform(DirectPosition,DirectPosition) transformed} positions would be - * equal or {@linkplain ComparisonMode#APPROXIMATIVE approximately} equal. + * equal or {@link ComparisonMode#APPROXIMATE approximately} equal. * This method may conservatively returns {@code false} if unsure. * * <p>The default implementation returns {@code true} if the following conditions are met:</p> @@ -945,7 +945,7 @@ public abstract class AbstractMathTransform extends FormattableObject * If the classes are the same, then the hash codes should be computed in the same way. Since those * codes are cached, this is an efficient way to quickly check if the two objects are different. */ - if (!mode.isApproximative()) { + if (!mode.isApproximate()) { final int tc = hashCode; if (tc != 0) { final int oc = that.hashCode; diff --git a/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java b/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java index 7a053ce..f71a9d2 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java @@ -431,7 +431,7 @@ public final strictfp class DefaultParameterValueGroupTest extends TestCase { assertFalse("STRICT", g1.equals(g2, ComparisonMode.STRICT)); assertFalse("BY_CONTRACT", g1.equals(g2, ComparisonMode.BY_CONTRACT)); assertTrue ("IGNORE_METADATA", g1.equals(g2, ComparisonMode.IGNORE_METADATA)); - assertTrue ("APPROXIMATIVE", g1.equals(g2, ComparisonMode.APPROXIMATIVE)); + assertTrue ("APPROXIMATE", g1.equals(g2, ComparisonMode.APPROXIMATE)); } /** diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java index a69f2f7..19e2dcd 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java @@ -505,7 +505,7 @@ public final strictfp class DefaultProjectedCRSTest extends TestCase { assertFalse("STRICT", ((LenientComparable) standard).equals(normalized, ComparisonMode.STRICT)); assertFalse("BY_CONTRACT", ((LenientComparable) standard).equals(normalized, ComparisonMode.BY_CONTRACT)); assertTrue ("IGNORE_METADATA", ((LenientComparable) standard).equals(normalized, ComparisonMode.IGNORE_METADATA)); - assertTrue ("APPROXIMATIVE", ((LenientComparable) standard).equals(normalized, ComparisonMode.APPROXIMATIVE)); + assertTrue ("APPROXIMATE", ((LenientComparable) standard).equals(normalized, ComparisonMode.APPROXIMATE)); assertTrue ("ALLOW_VARIANT", ((LenientComparable) standard).equals(normalized, ComparisonMode.ALLOW_VARIANT)); } } diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java index ae994d9..256511c 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java @@ -132,7 +132,7 @@ public final strictfp class MolodenskyTransformTest extends MathTransformTestCas final int j = i % stats.length; switch (j) { case 0: Δ *= cos(toRadians(expected[i+1])); // Fall through - case 1: Δ *= 60 * NAUTICAL_MILE; break; // Approximative conversion to metres + case 1: Δ *= 60 * NAUTICAL_MILE; break; // Approximate conversion to metres } Δ *= 100; // Conversion to centimetres. stats[j].accept(abs(Δ)); diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java index d59513b..9c93f14 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java +++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Numerics.java @@ -92,7 +92,7 @@ public final class Numerics extends Static { /** * Relative difference tolerated when comparing floating point numbers using - * {@link org.apache.sis.util.ComparisonMode#APPROXIMATIVE}. + * {@link org.apache.sis.util.ComparisonMode#APPROXIMATE}. * * <p>Historically, this was the relative tolerance threshold for considering two * matrices as equal. This value has been determined empirically in order to allow @@ -303,7 +303,7 @@ public final class Numerics extends Static { /** * Returns {@code true} if the given values are approximately equal given the comparison mode. - * In mode {@code APPROXIMATIVE} or {@code DEBUG}, this method will compute a relative comparison + * In mode {@code APPROXIMATE} or {@code DEBUG}, this method will compute a relative comparison * threshold from the {@link #COMPARISON_THRESHOLD} constant. * * <p>This method does not thrown {@link AssertionError} in {@link ComparisonMode#DEBUG}. @@ -315,7 +315,7 @@ public final class Numerics extends Static { * @return {@code true} if both values are considered equal for the given comparison mode. */ public static boolean epsilonEqual(final double v1, final double v2, final ComparisonMode mode) { - if (mode.isApproximative()) { + if (mode.isApproximate()) { final double mg = max(abs(v1), abs(v2)); if (mg != Double.POSITIVE_INFINITY) { return epsilonEqual(v1, v2, COMPARISON_THRESHOLD * mg); diff --git a/core/sis-utility/src/main/java/org/apache/sis/measure/LinearConverter.java b/core/sis-utility/src/main/java/org/apache/sis/measure/LinearConverter.java index 5c02295..75e7acd 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/measure/LinearConverter.java +++ b/core/sis-utility/src/main/java/org/apache/sis/measure/LinearConverter.java @@ -417,7 +417,7 @@ final class LinearConverter extends AbstractConverter implements LenientComparab */ @Override public boolean equals(final Object other, final ComparisonMode mode) { - if (mode.isApproximative()) { + if (mode.isApproximate()) { return (other instanceof LinearConverter) && equivalent((LinearConverter) other); } else { return equals(other); diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/ComparisonMode.java b/core/sis-utility/src/main/java/org/apache/sis/util/ComparisonMode.java index aed171e..8b12933 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/util/ComparisonMode.java +++ b/core/sis-utility/src/main/java/org/apache/sis/util/ComparisonMode.java @@ -29,7 +29,7 @@ package org.apache.sis.util; * <li>{@link #STRICT} – All attributes of the compared objects shall be strictly equal.</li> * <li>{@link #BY_CONTRACT} – Only the attributes published in the interface contract need to be compared.</li> * <li>{@link #IGNORE_METADATA} – Only the attributes relevant to the object functionality are compared.</li> - * <li>{@link #APPROXIMATIVE} – Only the attributes relevant to the object functionality are compared, + * <li>{@link #APPROXIMATE} – Only the attributes relevant to the object functionality are compared, * with some tolerance threshold on numerical values.</li> * <li>{@link #ALLOW_VARIANT} – For objects not really equal but related (e.g. CRS using different axis order).</li> * <li>{@link #DEBUG} – Special mode for figuring out why two objects expected to be equal are not.</li> @@ -41,7 +41,7 @@ package org.apache.sis.util; * {@link #IGNORE_METADATA} level but not necessarily at the {@link #STRICT} level. * * @author Martin Desruisseaux (Geomatys) - * @version 0.7 + * @version 1.0 * * @see LenientComparable#equals(Object, ComparisonMode) * @see Utilities#deepEquals(Object, Object, ComparisonMode) @@ -132,12 +132,14 @@ public enum ComparisonMode { * A small difference is tolerated between the target coordinates calculated by the two math transforms. * How small is “small” is implementation dependent — the threshold can not be specified in the current * implementation, because of the non-linear nature of map projections. + * + * @since 1.0 */ - APPROXIMATIVE, + APPROXIMATE, /** * Most but not all attributes relevant to the object functionality are compared. - * This comparison mode is equivalent to {@link #APPROXIMATIVE}, except that it + * This comparison mode is equivalent to {@link #APPROXIMATE}, except that it * ignores some attributes that may differ between objects not equal but related. * * <p>The main purpose of this method is to verify if two Coordinate Reference Systems (CRS) @@ -147,7 +149,7 @@ public enum ComparisonMode { * consider two geographic coordinate reference systems with the same attributes except axis order, * where one CRS uses (<var>latitude</var>, <var>longitude</var>) axes * and the other CRS uses (<var>longitude</var>, <var>latitude</var>) axes. - * All comparison modes (even {@code APPROXIMATIVE}) will consider those two CRS as different, + * All comparison modes (even {@code APPROXIMATE}) will consider those two CRS as different, * except this {@code ALLOW_VARIANT} mode which will consider one CRS to be a variant of the other. * </div> * @@ -156,7 +158,7 @@ public enum ComparisonMode { ALLOW_VARIANT, /** - * Same as {@link #APPROXIMATIVE}, except that an {@link AssertionError} is thrown if the two + * Same as {@link #APPROXIMATE}, except that an {@link AssertionError} is thrown if the two * objects are not equal and assertions are enabled. The exception message and stack trace help * to locate which attributes are not equal. This mode is typically used in assertions like below: * @@ -172,8 +174,16 @@ public enum ComparisonMode { DEBUG; /** + * @deprecated Renamed {@link #APPROXIMATE}. + * + * @see <a href="https://issues.apache.org/jira/browse/SIS-440">SIS-440</a> + */ + @Deprecated + public static final ComparisonMode APPROXIMATIVE = APPROXIMATE; + + /** * Returns {@code true} if this comparison ignores metadata. - * This method currently returns {@code true} for {@code IGNORE_METADATA}, {@code APPROXIMATIVE} + * This method currently returns {@code true} for {@code IGNORE_METADATA}, {@code APPROXIMATE} * or {@code DEBUG} only, but this list may be extended in future SIS versions. * * @return whether this comparison ignore metadata. @@ -186,15 +196,25 @@ public enum ComparisonMode { /** * Returns {@code true} if this comparison uses a tolerance threshold. - * This method currently returns {@code true} for {@code APPROXIMATIVE} or {@code DEBUG} only, + * This method currently returns {@code true} for {@code APPROXIMATE} or {@code DEBUG} only, * but this list may be extended in future SIS versions. * * @return whether this comparison uses a tolerance threshold. * - * @since 0.6 + * @since 1.0 + */ + public boolean isApproximate() { + return ordinal() >= APPROXIMATE.ordinal(); + } + + /** + * @deprecated Renamed {@link #isApproximate()}. + * + * @see <a href="https://issues.apache.org/jira/browse/SIS-440">SIS-440</a> */ + @Deprecated public boolean isApproximative() { - return ordinal() >= APPROXIMATIVE.ordinal(); + return isApproximate(); } /** @@ -227,7 +247,7 @@ public enum ComparisonMode { } if (cp.equals(o2, BY_CONTRACT)) return BY_CONTRACT; if (cp.equals(o2, IGNORE_METADATA)) return IGNORE_METADATA; - if (cp.equals(o2, APPROXIMATIVE)) return APPROXIMATIVE; + if (cp.equals(o2, APPROXIMATE)) return APPROXIMATE; if (cp.equals(o2, ALLOW_VARIANT)) return ALLOW_VARIANT; } return null; diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java b/core/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java index 6ba788c..79262ce 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java +++ b/core/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java @@ -36,7 +36,7 @@ package org.apache.sis.util; * <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} – Only the attributes defined * in the GeoAPI interfaces are compared. The above-cited identifiers and {@code xlinks} * attributes are ignored.</li> - * <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} – The same attributes than the above + * <li>{@link ComparisonMode#APPROXIMATE APPROXIMATE} – The same attributes than the above * {@code IGNORE_METADATA} mode are compared, but a slight (implementation dependant) * difference is tolerated in floating point numbers.</li> * </ol> @@ -57,7 +57,7 @@ package org.apache.sis.util; * are ignored because they have no incidence on the coordinate values to be computed by * {@linkplain org.opengis.referencing.operation.ConcatenatedOperation coordinate operations}. * All other attributes that are relevant to coordinate calculations, must be equal.</li> - * <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} – The same attributes than the above + * <li>{@link ComparisonMode#APPROXIMATE APPROXIMATE} – The same attributes than the above * {@code IGNORE_METADATA} mode are compared, but a slight (implementation dependant) * difference is tolerated in floating point numbers.</li> * </ol> @@ -75,7 +75,7 @@ package org.apache.sis.util; * For example a <cite>"Mercator (2SP)"</cite> projection on a sphere with a <cite>standard parallel</cite> * value of 60° produces the same results than a <cite>"Mercator (1SP)"</cite> projection on the same sphere * with a <cite>scale factor</cite> value of 0.5.</li> - * <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} – The same attributes than the above + * <li>{@link ComparisonMode#APPROXIMATE APPROXIMATE} – The same attributes than the above * {@code IGNORE_METADATA} mode are compared, but a slight (implementation dependant) * difference is tolerated in floating point numbers.</li> * </ol> @@ -90,7 +90,7 @@ package org.apache.sis.util; * same implementation class (any {@link org.opengis.referencing.operation.Matrix} is okay).</li> * <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} – Synonymous to the * {@code BY_CONTRACT} mode, because matrixes don't have metadata.</li> - * <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} – The same attributes than the above + * <li>{@link ComparisonMode#APPROXIMATE APPROXIMATE} – The same attributes than the above * {@code BY_CONTRACT} mode are compared, but a slight (implementation dependant) * difference is tolerated in floating point numbers.</li> * </ol> @@ -115,7 +115,7 @@ public interface LenientComparable { * <td>Only the attributes published in the interface contract need to be compared.</td></tr> * <tr><td>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA}:</td> * <td>Only the attributes relevant to the object functionality are compared.</td></tr> - * <tr><td>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE}:</td> + * <tr><td>{@link ComparisonMode#APPROXIMATE APPROXIMATE}:</td> * <td>Only the attributes relevant to the object functionality are compared, * with some tolerance threshold on numerical values.</td></tr> * <tr><td>{@link ComparisonMode#DEBUG DEBUG}:</td> @@ -134,7 +134,7 @@ public interface LenientComparable { * instance.</li> * <li>{@code x.equals(y,m)} and {@code y.equals(z,m)} does <strong>not</strong> implies * {@code x.equals(z,m)}. In particular, the use of a comparison threshold for the - * {@code APPROXIMATIVE} mode is incompatible with the transitivity contract.</li> + * {@code APPROXIMATE} mode is incompatible with the transitivity contract.</li> * </ul> * * @param other the object to compare to {@code this}. diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/Utilities.java b/core/sis-utility/src/main/java/org/apache/sis/util/Utilities.java index 19b6fc2..aacaccb 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/util/Utilities.java +++ b/core/sis-utility/src/main/java/org/apache/sis/util/Utilities.java @@ -98,7 +98,7 @@ public final class Utilities extends Static { * This is a convenience method for the following method call: * * {@preformat java - * return deepEquals(object1, object2, ComparisonMode.APPROXIMATIVE); + * return deepEquals(object1, object2, ComparisonMode.APPROXIMATE); * } * * @param object1 the first object to compare (may be null). @@ -106,10 +106,10 @@ public final class Utilities extends Static { * @return {@code true} if both objects are approximately equal. * * @see #deepEquals(Object, Object, ComparisonMode) - * @see ComparisonMode#APPROXIMATIVE + * @see ComparisonMode#APPROXIMATE */ public static boolean equalsApproximatively(final Object object1, final Object object2) { - return deepEquals(object1, object2, ComparisonMode.APPROXIMATIVE); + return deepEquals(object1, object2, ComparisonMode.APPROXIMATE); } /** diff --git a/core/sis-utility/src/test/java/org/apache/sis/internal/util/NumericsTest.java b/core/sis-utility/src/test/java/org/apache/sis/internal/util/NumericsTest.java index 2ac340f..22c2053 100644 --- a/core/sis-utility/src/test/java/org/apache/sis/internal/util/NumericsTest.java +++ b/core/sis-utility/src/test/java/org/apache/sis/internal/util/NumericsTest.java @@ -100,16 +100,16 @@ public final strictfp class NumericsTest extends TestCase { */ @Test public void testEpsilonEqual() { - assertTrue (epsilonEqual(POSITIVE_INFINITY, POSITIVE_INFINITY, ComparisonMode.APPROXIMATIVE)); - assertTrue (epsilonEqual(NEGATIVE_INFINITY, NEGATIVE_INFINITY, ComparisonMode.APPROXIMATIVE)); - assertFalse(epsilonEqual(POSITIVE_INFINITY, NEGATIVE_INFINITY, ComparisonMode.APPROXIMATIVE)); - assertFalse(epsilonEqual(POSITIVE_INFINITY, NaN, ComparisonMode.APPROXIMATIVE)); - assertTrue (epsilonEqual(NaN, NaN, ComparisonMode.APPROXIMATIVE)); - assertFalse(epsilonEqual( 0, COMPARISON_THRESHOLD / 2, ComparisonMode.APPROXIMATIVE)); - assertTrue (epsilonEqual( 1, 1 + COMPARISON_THRESHOLD / 2, ComparisonMode.APPROXIMATIVE)); - assertFalse(epsilonEqual( 1, 1 + COMPARISON_THRESHOLD * 2, ComparisonMode.APPROXIMATIVE)); - assertTrue (epsilonEqual(-100, -100 + COMPARISON_THRESHOLD * 50, ComparisonMode.APPROXIMATIVE)); - assertFalse(epsilonEqual( 100, 100 + COMPARISON_THRESHOLD * 150, ComparisonMode.APPROXIMATIVE)); + assertTrue (epsilonEqual(POSITIVE_INFINITY, POSITIVE_INFINITY, ComparisonMode.APPROXIMATE)); + assertTrue (epsilonEqual(NEGATIVE_INFINITY, NEGATIVE_INFINITY, ComparisonMode.APPROXIMATE)); + assertFalse(epsilonEqual(POSITIVE_INFINITY, NEGATIVE_INFINITY, ComparisonMode.APPROXIMATE)); + assertFalse(epsilonEqual(POSITIVE_INFINITY, NaN, ComparisonMode.APPROXIMATE)); + assertTrue (epsilonEqual(NaN, NaN, ComparisonMode.APPROXIMATE)); + assertFalse(epsilonEqual( 0, COMPARISON_THRESHOLD / 2, ComparisonMode.APPROXIMATE)); + assertTrue (epsilonEqual( 1, 1 + COMPARISON_THRESHOLD / 2, ComparisonMode.APPROXIMATE)); + assertFalse(epsilonEqual( 1, 1 + COMPARISON_THRESHOLD * 2, ComparisonMode.APPROXIMATE)); + assertTrue (epsilonEqual(-100, -100 + COMPARISON_THRESHOLD * 50, ComparisonMode.APPROXIMATE)); + assertFalse(epsilonEqual( 100, 100 + COMPARISON_THRESHOLD * 150, ComparisonMode.APPROXIMATE)); } /** diff --git a/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java b/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java index 30aef61..36d0edc 100644 --- a/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java +++ b/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java @@ -69,23 +69,23 @@ public strictfp class Assert extends org.opengis.test.Assert { assertFalse("deepEquals(STRICT)", Utilities.deepEquals(o1, o2, ComparisonMode.STRICT)); assertFalse("deepEquals(BY_CONTRACT)", Utilities.deepEquals(o1, o2, ComparisonMode.BY_CONTRACT)); assertFalse("deepEquals(IGNORE_METADATA)", Utilities.deepEquals(o1, o2, ComparisonMode.IGNORE_METADATA)); - assertFalse("deepEquals(APPROXIMATIVE)", Utilities.deepEquals(o1, o2, ComparisonMode.APPROXIMATIVE)); + assertFalse("deepEquals(APPROXIMATE)", Utilities.deepEquals(o1, o2, ComparisonMode.APPROXIMATE)); } /** * Asserts that the two given objects are approximately equal, while slightly different. * More specifically, this method asserts that the given objects are equal according the - * {@link ComparisonMode#APPROXIMATIVE} criterion, but not equal according the + * {@link ComparisonMode#APPROXIMATE} criterion, but not equal according the * {@link ComparisonMode#IGNORE_METADATA} criterion. * * @param expected the expected object. * @param actual the actual object. */ public static void assertAlmostEquals(final Object expected, final Object actual) { - assertFalse("Shall not be strictly equals", Utilities.deepEquals(expected, actual, ComparisonMode.STRICT)); - assertFalse("Shall be slightly different", Utilities.deepEquals(expected, actual, ComparisonMode.IGNORE_METADATA)); - assertTrue ("Shall be approximately equals", Utilities.deepEquals(expected, actual, ComparisonMode.DEBUG)); - assertTrue ("DEBUG inconsistent with APPROXIMATIVE", Utilities.deepEquals(expected, actual, ComparisonMode.APPROXIMATIVE)); + assertFalse("Shall not be strictly equals", Utilities.deepEquals(expected, actual, ComparisonMode.STRICT)); + assertFalse("Shall be slightly different", Utilities.deepEquals(expected, actual, ComparisonMode.IGNORE_METADATA)); + assertTrue ("Shall be approximately equals", Utilities.deepEquals(expected, actual, ComparisonMode.DEBUG)); + assertTrue ("DEBUG inconsistent with APPROXIMATE", Utilities.deepEquals(expected, actual, ComparisonMode.APPROXIMATE)); } /** @@ -96,9 +96,9 @@ public strictfp class Assert extends org.opengis.test.Assert { * @param actual the actual object. */ public static void assertEqualsIgnoreMetadata(final Object expected, final Object actual) { - assertTrue("Shall be approximately equals", Utilities.deepEquals(expected, actual, ComparisonMode.DEBUG)); - assertTrue("DEBUG inconsistent with APPROXIMATIVE", Utilities.deepEquals(expected, actual, ComparisonMode.APPROXIMATIVE)); - assertTrue("Shall be equal, ignoring metadata", Utilities.deepEquals(expected, actual, ComparisonMode.IGNORE_METADATA)); + assertTrue("Shall be approximately equals", Utilities.deepEquals(expected, actual, ComparisonMode.DEBUG)); + assertTrue("DEBUG inconsistent with APPROXIMATE", Utilities.deepEquals(expected, actual, ComparisonMode.APPROXIMATE)); + assertTrue("Shall be equal, ignoring metadata", Utilities.deepEquals(expected, actual, ComparisonMode.IGNORE_METADATA)); } /**
