sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1654867 - in /sis/branches/JDK7: ./ core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/ core/sis-referencing/src/main/java/org/apache/sis/inter...
Date Mon, 26 Jan 2015 18:49:21 GMT
Author: desruisseaux
Date: Mon Jan 26 18:49:20 2015
New Revision: 1654867

URL: http://svn.apache.org/r1654867
Log:
Merge from the JDK8 branch.

Added:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/
      - copied from r1654866, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/
Removed:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifierMatching.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/provider/
Modified:
    sis/branches/JDK7/   (props changed)
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/OperationMethodsTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java

Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 26 18:49:20 2015
@@ -1,4 +1,4 @@
 /sis/branches/Android:1430670-1480699
 /sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1654664
+/sis/branches/JDK8:1584960-1654866
 /sis/trunk:1394364-1508466,1519089-1519674

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/OperationMethods.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -17,12 +17,18 @@
 package org.apache.sis.internal.referencing;
 
 import java.util.Map;
+import org.opengis.metadata.Identifier;
+import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.OperationMethod;
+import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.operation.transform.MathTransforms;
 import org.apache.sis.referencing.operation.transform.PassThroughTransform;
+import org.apache.sis.internal.util.Citations;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.CharSequences;
+import org.apache.sis.util.Characters;
 import org.apache.sis.util.Static;
 
 
@@ -43,6 +49,71 @@ public final class OperationMethods exte
     }
 
     /**
+     * Determines whether a match or mismatch is found between the two given collections
of identifiers.
+     * If any of the given collections is {@code null} or empty, this method returns {@code
null}.
+     *
+     * <p>According ISO 19162 (<cite>Well known text representation of coordinate
reference systems</cite>),
+     * {@linkplain AbstractIdentifiedObject#getIdentifier() identifiers} should have precedence
over
+     * {@linkplain AbstractIdentifiedObject#getName() name} for identifying {@code IdentifiedObject}s,
+     * at least in the case of {@linkplain org.apache.sis.referencing.operation.DefaultOperationMethod
+     * operation methods} and {@linkplain org.apache.sis.parameter.AbstractParameterDescriptor
parameters}.</p>
+     *
+     * @param  id1 The first collection of identifiers, or {@code null}.
+     * @param  id2 The second collection of identifiers, or {@code null}.
+     * @return {@code TRUE} or {@code FALSE} on match or mismatch respectively, or {@code
null} if this method
+     *         can not determine if there is a match or mismatch.
+     */
+    public static Boolean hasCommonIdentifier(final Iterable<? extends Identifier>
id1,
+                                              final Iterable<? extends Identifier>
id2)
+    {
+        if (id1 != null && id2 != null) {
+            boolean hasFound = false;
+            for (final Identifier identifier : id1) {
+                final Citation authority = identifier.getAuthority();
+                final String   codeSpace = identifier.getCodeSpace();
+                for (final Identifier other : id2) {
+                    if (authorityMatches(identifier, authority, codeSpace)) {
+                        if (CharSequences.equalsFiltered(identifier.getCode(), other.getCode(),
Characters.Filter.UNICODE_IDENTIFIER, true)) {
+                            return Boolean.TRUE;
+                        }
+                        hasFound = true;
+                    }
+                }
+            }
+            if (hasFound) {
+                return Boolean.FALSE;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns {@code true} if the given identifier authority matches the given {@code authority}.
+     * If one of the authority is null, then the comparison fallback on the given {@code
codeSpace}.
+     * If the code spaces are also null, then this method conservatively returns {@code false}.
+     *
+     * @param  identifier The identifier to compare.
+     * @param  authority  The desired authority, or {@code null}.
+     * @param  codeSpace  The desired code space or {@code null}, used as a fallback if an
authority is null.
+     * @return {@code true} if the authority or code space (as a fallback only) matches.
+     */
+    private static boolean authorityMatches(final Identifier identifier, final Citation authority,
final String codeSpace) {
+        if (authority != null) {
+            final Citation other = identifier.getAuthority();
+            if (other != null) {
+                return Citations.identifierMatches(authority, other);
+            }
+        }
+        if (codeSpace != null) {
+            final String other = identifier.getCodeSpace();
+            if (other != null) {
+                return CharSequences.equalsFiltered(codeSpace, other, Characters.Filter.UNICODE_IDENTIFIER,
true);
+            }
+        }
+        return false;
+    }
+
+    /**
      * Checks if an operation method and a math transform have a compatible number of source
and target dimensions.
      * In the particular case of a {@linkplain PassThroughTransform pass through transform}
with more dimensions
      * than what we would expect from the given method, the check will rather be performed
against the

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineTransform2D.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -31,7 +31,7 @@ import org.apache.sis.parameter.TensorPa
 import org.apache.sis.referencing.operation.matrix.Matrix2;
 import org.apache.sis.referencing.operation.matrix.AffineTransforms2D;
 import org.apache.sis.referencing.operation.transform.LinearTransform;
-import org.apache.sis.referencing.operation.provider.Affine;
+import org.apache.sis.internal.referencing.provider.Affine;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.LenientComparable;
 import org.apache.sis.util.ComparisonMode;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -21,7 +21,7 @@ import java.util.Collections;
 import org.opengis.parameter.ParameterDescriptorGroup;
 
 public abstract class Affine implements org.opengis.referencing.operation.OperationMethod
{
-    public static Map<String,Object> IDENTIFICATION = Collections.singletonMap(NAME_KEY,
"Affine");
+    public static Map<String,Object> IDENTIFICATION = Collections.<String,Object>singletonMap(NAME_KEY,
"Affine");
 
     public static ParameterDescriptorGroup PARAMETERS; // TODO
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -415,10 +415,8 @@ public class AbstractCRS extends Abstrac
                            Objects.equals(coordinateSystem, that.coordinateSystem);
                 }
                 default: {
-                    return deepEquals(datum,
-                                      (object instanceof SingleCRS) ? ((SingleCRS) object).getDatum()
: null, mode) &&
-                           deepEquals(getCoordinateSystem(),
-                                      ((CoordinateReferenceSystem) object).getCoordinateSystem(),
mode);
+                    return deepEquals(datum, (object instanceof SingleCRS) ? ((SingleCRS)
object).getDatum() : null, mode) &&
+                           deepEquals(getCoordinateSystem(), ((CoordinateReferenceSystem)
object).getCoordinateSystem(), mode);
                 }
             }
         }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -32,6 +32,7 @@ import org.apache.sis.referencing.Identi
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.internal.metadata.MetadataUtilities;
+import org.apache.sis.internal.referencing.OperationMethods;
 
 import static org.apache.sis.util.Utilities.deepEquals;
 import static org.apache.sis.util.collection.Containers.property;
@@ -404,12 +405,19 @@ public class AbstractDatum extends Abstr
             }
             default: {
                 /*
-                 * Tests for name, since datum with different name have completely
-                 * different meaning. We don't perform this comparison if the user
-                 * asked for metadata comparison, because in such case the names
-                 * have already been compared by the subclass.
+                 * Tests for identifiers or name since datum with different identification
may have completely
+                 * different meaning. We do not perform this check if the user asked for
metadata comparison,
+                 * because in such case the name and identifiers have already been compared
by the subclass.
+                 *
+                 * According ISO 19162 (Well Known Text representation of Coordinate Reference
Systems),
+                 * identifiers shall have precedence over name at least in the case of operation
methods
+                 * and parameters. We extend this rule to datum as well.
                  */
                 final Datum that = (Datum) object;
+                final Boolean match = OperationMethods.hasCommonIdentifier(getIdentifiers(),
that.getIdentifiers());
+                if (match != null) {
+                    return match;
+                }
                 return isHeuristicMatchForName(that.getName().getCode())
                         || IdentifiedObjects.isHeuristicMatchForName(that, getName().getCode());
             }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -258,9 +258,7 @@ public class BursaWolfParameters extends
      * @return {@code true} if the given datum is equal to WGS84 for computational purpose.
      */
     final boolean isToWGS84() {
-        return (targetDatum != null) &&
-               (IdentifiedObjects.isHeuristicMatchForName(targetDatum, "WGS 84") ||
-                IdentifiedObjects.isHeuristicMatchForName(targetDatum, "WGS84"));
+        return (targetDatum != null) && IdentifiedObjects.isHeuristicMatchForName(targetDatum,
"WGS84");
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -33,6 +33,7 @@ import org.apache.sis.parameter.Paramete
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
+import org.apache.sis.internal.referencing.OperationMethods;
 import org.apache.sis.io.wkt.Formatter;
 
 import static org.apache.sis.util.ArgumentChecks.*;
@@ -415,10 +416,21 @@ public class DefaultOperationMethod exte
                     break;
                 }
                 default: {
-                    // Name and identifiers have been ignored by super.equals(object, mode).
-                    // Since they are significant for OperationMethod, compare them here.
+                    /*
+                     * Name and identifiers have been ignored by super.equals(object, mode).
+                     * Since they are significant for OperationMethod, we compare them here.
+                     *
+                     * According ISO 19162 (Well Known Text representation of Coordinate
Reference Systems),
+                     * identifiers shall have precedence over name at least in the case of
operation methods
+                     * and parameters.
+                     */
                     final OperationMethod that = (OperationMethod) object;
-                    if (!isHeuristicMatchForName(that.getName().getCode())
+                    final Boolean match = OperationMethods.hasCommonIdentifier(getIdentifiers(),
that.getIdentifiers());
+                    if (match != null) {
+                        if (!match) {
+                            return false;
+                        }
+                    } else if (!isHeuristicMatchForName(that.getName().getCode())
                             && !IdentifiedObjects.isHeuristicMatchForName(that, getName().getCode()))
                     {
                         return false;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -25,7 +25,7 @@ import org.opengis.referencing.operation
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.apache.sis.parameter.TensorParameters;
-import org.apache.sis.referencing.operation.provider.Affine;
+import org.apache.sis.internal.referencing.provider.Affine;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.util.ComparisonMode;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -26,7 +26,7 @@ import org.apache.sis.util.ArgumentCheck
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.geometry.GeneralDirectPosition;
 import org.apache.sis.parameter.TensorParameters;
-import org.apache.sis.referencing.operation.provider.Affine;
+import org.apache.sis.internal.referencing.provider.Affine;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.internal.referencing.j2d.AffineTransform2D;
 

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -27,7 +27,7 @@ import org.opengis.referencing.operation
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.referencing.operation.matrix.Matrix1;
 import org.apache.sis.referencing.operation.matrix.Matrix2;
-import org.apache.sis.referencing.operation.provider.Affine;
+import org.apache.sis.internal.referencing.provider.Affine;
 import org.apache.sis.parameter.TensorParameters;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.util.ComparisonMode;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -26,10 +26,10 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.NoninvertibleTransformException;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.parameter.TensorParameters;
-import org.apache.sis.referencing.operation.provider.Affine;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 import org.apache.sis.internal.referencing.ExtendedPrecisionMatrix;
+import org.apache.sis.internal.referencing.provider.Affine;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/OperationMethodsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/OperationMethodsTest.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/OperationMethodsTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/OperationMethodsTest.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -16,12 +16,16 @@
  */
 package org.apache.sis.internal.referencing;
 
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import org.opengis.metadata.Identifier;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.OperationMethod;
+import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.parameter.DefaultParameterDescriptorGroup;
 import org.apache.sis.referencing.operation.DefaultOperationMethod;
 import org.apache.sis.referencing.operation.transform.MathTransformsTest;
@@ -46,6 +50,36 @@ import static org.opengis.test.Assert.*;
 })
 public final strictfp class OperationMethodsTest extends TestCase {
     /**
+     * Tests {@link OperationMethods#hasCommonIdentifier(Iterable, Iterable)}.
+     */
+    @Test
+    public void testHasCommonIdentifier() {
+        final List<Identifier> id1 = new ArrayList<>(3);
+        final List<Identifier> id2 = new ArrayList<>(2);
+        assertNull(OperationMethods.hasCommonIdentifier(id1, id2));
+        /*
+         * Add codes for two Operation Methods which are implemented in Apache SIS by the
same class:
+         *
+         *  - EPSG:9804  —  "Mercator (variant A)" (formerly known as "Mercator (1SP)").
+         *  - EPSG:1026  —  "Mercator (Spherical)"
+         *  - GeoTIFF:7  —  "CT_Mercator"
+         */
+        id1.add(new ImmutableIdentifier(null, "EPSG", "9804"));
+        id1.add(new ImmutableIdentifier(null, "EPSG", "1026"));
+        id1.add(new ImmutableIdentifier(null, "GeoTIFF", "7"));
+        assertNull(OperationMethods.hasCommonIdentifier(id1, id2));
+        /*
+         * EPSG:9841 is a legacy (now deprecated) code for "Mercator (1SP)".
+         * We could have declared it as a deprecated code in the above list,
+         * but for the sake of this test we do not.
+         */
+        id2.add(new ImmutableIdentifier(null, "EPSG", "9841"));
+        assertEquals(Boolean.FALSE, OperationMethods.hasCommonIdentifier(id1, id2));
+        id2.add(new ImmutableIdentifier(null, "EPSG", "9804"));
+        assertEquals(Boolean.TRUE, OperationMethods.hasCommonIdentifier(id1, id2));
+    }
+
+    /**
      * Creates a dummy operation method of the given dimensions.
      */
     private static OperationMethod createOperationMethod(final int sourceDimension, final
int targetDimension) {

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -103,7 +103,7 @@ public final strictfp class HardCodedDat
      * Mean sea level, which can be used as an approximation of geoid.
      */
     public static final DefaultVerticalDatum MEAN_SEA_LEVEL = new DefaultVerticalDatum(
-            properties("Mean Sea Level", "5700"), VerticalDatumType.GEOIDAL);
+            properties("Mean Sea Level", "5100"), VerticalDatumType.GEOIDAL);
 
     /**
      * Ellipsoid for measurements of height above the ellipsoid.

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CopyTransformTest.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -17,7 +17,7 @@
 package org.apache.sis.referencing.operation.transform;
 
 import org.opengis.referencing.operation.TransformException;
-import org.apache.sis.referencing.operation.provider.Affine;
+import org.apache.sis.internal.referencing.provider.Affine;
 
 // Test imports
 import org.junit.Test;

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java?rev=1654867&r1=1654866&r2=1654867&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
[UTF-8] Mon Jan 26 18:49:20 2015
@@ -21,7 +21,7 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.MathTransform2D;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.apache.sis.referencing.operation.matrix.Matrices;
-import org.apache.sis.referencing.operation.provider.Affine;
+import org.apache.sis.internal.referencing.provider.Affine;
 import org.apache.sis.parameter.Parameterized;
 
 // Test imports



Mime
View raw message