sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1654028 - in /sis/branches/JDK7: ./ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/ core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ core/sis-referencing/src/main/java/org/apache/sis/parameter/ ...
Date Thu, 22 Jan 2015 19:43:33 GMT
Author: desruisseaux
Date: Thu Jan 22 19:43:33 2015
New Revision: 1654028

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

Added:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifierMatching.java
      - copied unchanged from r1654026, sis/branches/JDK8/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/builder/
      - copied from r1654026, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/
      - copied from r1654026, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/CompoundDirectPositions.java
      - copied, changed from r1654026, sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/math/CompoundDirectPositions.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/Plane.java
      - copied unchanged from r1654026, sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/math/Plane.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/math/PlaneTest.java
      - copied unchanged from r1654026, sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/math/PlaneTest.java
Modified:
    sis/branches/JDK7/   (props changed)
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
    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/parameter/ParameterFormat.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.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/parameter/DefaultParameterDescriptorGroupTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java

Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 22 19:43:33 2015
@@ -1,4 +1,4 @@
 /sis/branches/Android:1430670-1480699
 /sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1653351
+/sis/branches/JDK8:1584960-1654026
 /sis/trunk:1394364-1508466,1519089-1519674

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -21,6 +21,7 @@ import org.apache.sis.util.Static;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.xml.IdentifierSpace;
 import org.apache.sis.internal.simple.SimpleCitation;
+import org.apache.sis.metadata.iso.DefaultIdentifier; // For javadoc
 
 
 /**
@@ -37,7 +38,7 @@ import org.apache.sis.internal.simple.Si
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.2)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 public final class Citations extends Static {
@@ -188,8 +189,8 @@ public final class Citations extends Sta
      *
      * <ul>
      *   <li>If the given title is {@code null} or empty (ignoring spaces), then this method returns {@code null}.</li>
-     *   <li>Otherwise if the given name matches a {@linkplain Citation#getTitle() title} or an
-     *       {@linkplain Citation#getAlternateTitles() alternate titles} of one of the pre-defined
+     *   <li>Otherwise if the given name matches a {@linkplain DefaultCitation#getTitle() title} or an
+     *       {@linkplain DefaultCitation#getAlternateTitles() alternate titles} of one of the pre-defined
      *       constants ({@link #EPSG}, {@link #GEOTIFF}, <i>etc.</i>), then that constant is returned.</li>
      *   <li>Otherwise, a new citation is created with the specified name as the title.</li>
      * </ul>
@@ -210,8 +211,8 @@ public final class Citations extends Sta
     }
 
     /**
-     * Returns {@code true} if at least one {@linkplain Citation#getTitle() title} or
-     * {@linkplain Citation#getAlternateTitles() alternate title} in {@code c1} is leniently
+     * Returns {@code true} if at least one {@linkplain DefaultCitation#getTitle() title} or
+     * {@linkplain DefaultCitation#getAlternateTitles() alternate title} in {@code c1} is leniently
      * equal to a title or alternate title in {@code c2}. The comparison is case-insensitive
      * and ignores every character which is not a {@linkplain Character#isLetterOrDigit(int)
      * letter or a digit}. The titles ordering is not significant.
@@ -226,8 +227,8 @@ public final class Citations extends Sta
     }
 
     /**
-     * Returns {@code true} if the {@linkplain Citation#getTitle() title} or any
-     * {@linkplain Citation#getAlternateTitles() alternate title} in the given citation
+     * Returns {@code true} if the {@linkplain DefaultCitation#getTitle() title} or any
+     * {@linkplain DefaultCitation#getAlternateTitles() alternate title} in the given citation
      * matches the given string. The comparison is case-insensitive and ignores every character
      * which is not a {@linkplain Character#isLetterOrDigit(int) letter or a digit}.
      *
@@ -241,42 +242,49 @@ public final class Citations extends Sta
     }
 
     /**
-     * Returns {@code true} if at least one {@linkplain Citation#getIdentifiers() identifier} in
-     * {@code c1} is equal to an identifier in {@code c2}. The comparison is case-insensitive
-     * and ignores every character which is not a {@linkplain Character#isLetterOrDigit(int)
-     * letter or a digit}. The identifier ordering is not significant.
+     * Returns {@code true} if at least one {@linkplain DefaultCitation#getIdentifiers() identifier}
+     * {@linkplain DefaultIdentifier#getCode() code} in {@code c1} is equal to an identifier code in
+     * {@code c2}. {@linkplain DefaultIdentifier#getCodeSpace() Code spaces} are compared only if
+     * provided in the two identifiers being compared. Comparisons are case-insensitive and ignores
+     * every character which is not a {@linkplain Character#isLetterOrDigit(int) letter or a digit}.
+     * The identifier ordering is not significant.
      *
      * <p>If (and <em>only</em> if) the citations do not contains any identifier, then this method
      * fallback on titles comparison using the {@link #titleMatches(Citation,Citation) titleMatches}
      * method. This fallback exists for compatibility with client codes using the citation
-     * {@linkplain Citation#getTitle() titles} without identifiers.</p>
+     * {@linkplain DefaultCitation#getTitle() titles} without identifiers.</p>
      *
      * @param  c1 The first citation to compare, or {@code null}.
      * @param  c2 the second citation to compare, or {@code null}.
      * @return {@code true} if both arguments are non-null, and at least one identifier,
      *         title or alternate title matches.
+     *
+     * @see org.apache.sis.referencing.IdentifierMatching
      */
     public static boolean identifierMatches(final Citation c1, final Citation c2) {
         return org.apache.sis.internal.util.Citations.identifierMatches(c1, c2);
     }
 
     /**
-     * Returns {@code true} if any {@linkplain Citation#getIdentifiers() identifiers} in the given
-     * citation matches the given string. The comparison is case-insensitive and ignores every
-     * character which is not a {@linkplain Character#isLetterOrDigit(int) letter or a digit}.
+     * Returns {@code true} if at least one {@linkplain DefaultCitation#getIdentifiers() identifier}
+     * in the given citation have a {@linkplain DefaultIdentifier#getCode() code} matching the given
+     * string. The comparison is case-insensitive and ignores every character which is not a
+     * {@linkplain Character#isLetterOrDigit(int) letter or a digit}.
      *
      * <p>If (and <em>only</em> if) the citation does not contain any identifier, then this method
      * fallback on titles comparison using the {@link #titleMatches(Citation,String) titleMatches}
      * method. This fallback exists for compatibility with client codes using citation
-     * {@linkplain Citation#getTitle() titles} without identifiers.</p>
+     * {@linkplain DefaultCitation#getTitle() title} without identifiers.</p>
      *
      * @param  citation The citation to check for, or {@code null}.
      * @param  identifier The identifier to compare, or {@code null}.
      * @return {@code true} if both arguments are non-null, and the title or alternate title
      *         matches the given string.
+     *
+     * @see org.apache.sis.referencing.IdentifierMatching
      */
     public static boolean identifierMatches(final Citation citation, final String identifier) {
-        return org.apache.sis.internal.util.Citations.identifierMatches(citation, identifier);
+        return org.apache.sis.internal.util.Citations.identifierMatches(citation, null, identifier);
     }
 
     /**
@@ -286,14 +294,14 @@ public final class Citations extends Sta
      *
      * <ul>
      *   <li>If the given citation is {@code null}, then this method returns {@code null}.</li>
-     *   <li>Otherwise if the citation contains at least one {@linkplain Citation#getIdentifiers() identifier}, then:
+     *   <li>Otherwise if the citation contains at least one {@linkplain DefaultCitation#getIdentifiers() identifier}, then:
      *     <ul>
      *       <li>If at least one identifier is a {@linkplain org.apache.sis.util.CharSequences#isUnicodeIdentifier
      *           unicode identifier}, then the shortest of those identifiers is returned.</li>
      *       <li>Otherwise the shortest identifier is returned, despite not being a Unicode identifier.</li>
      *     </ul></li>
-     *   <li>Otherwise if the citation contains at least one {@linkplain Citation#getTitle() title} or
-     *       {@linkplain Citation#getAlternateTitles() alternate title}, then:
+     *   <li>Otherwise if the citation contains at least one {@linkplain DefaultCitation#getTitle() title} or
+     *       {@linkplain DefaultCitation#getAlternateTitles() alternate title}, then:
      *     <ul>
      *       <li>If at least one title is a {@linkplain org.apache.sis.util.CharSequences#isUnicodeIdentifier
      *           unicode identifier}, then the shortest of those titles is returned.</li>

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=1654028&r1=1654027&r2=1654028&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] Thu Jan 22 19:43:33 2015
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.internal.referencing;
 
+import java.util.Map;
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.OperationMethod;
@@ -62,12 +63,13 @@ public final class OperationMethods exte
      *       is taken. Only one non-ignorable step may exist, otherwise we do not try to select any of them.</li>
      * </ul>
      *
-     * @param  method    The operation method to compare to the math transform.
-     * @param  transform The math transform to compare to the operation method.
+     * @param  method     The operation method to compare to the math transform.
+     * @param  transform  The math transform to compare to the operation method.
+     * @param  properties Properties of the caller object being constructed, used only for formatting error message.
      * @throws IllegalArgumentException if the number of dimensions are incompatible.
      */
-    public static void checkDimensions(final OperationMethod method, MathTransform transform)
-            throws IllegalArgumentException
+    public static void checkDimensions(final OperationMethod method, MathTransform transform,
+            final Map<String,?> properties) throws IllegalArgumentException
     {
         int actual = transform.getSourceDimensions();
         Integer expected = method.getSourceDimensions();
@@ -96,18 +98,17 @@ public final class OperationMethods exte
          * Now verify if the MathTransform dimensions are equal to the OperationMethod ones,
          * ignoring null java.lang.Integer instances.
          */
-        final String name;
+        byte isTarget = 0; // false: wrong dimension is the source one.
         if (expected == null || actual == expected) {
             actual = transform.getTargetDimensions();
             expected = method.getTargetDimensions();
             if (expected == null || actual == expected) {
                 return;
             }
-            name = "transform.target";
-        } else {
-            name = "transform.source";
+            isTarget = 1; // true: wrong dimension is the target one.
         }
-        throw new IllegalArgumentException(Errors.format(Errors.Keys.MismatchedDimension_3, name, expected, actual));
+        throw new IllegalArgumentException(Errors.getResources(properties).getString(
+                Errors.Keys.MismatchedTransformDimension_3, isTarget, expected, actual));
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterFormat.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -578,6 +578,7 @@ public class ParameterFormat extends Tab
                 new TableAppender(out, columnSeparator) : new TableAppender(out);
         table.setMultiLinesCells(true);
         table.nextLine(horizontalBorder);
+        int numColumnsBeforeValue = 0;
         for (int i=0; ; i++) {
             boolean end = false;
             final short key;
@@ -616,6 +617,7 @@ public class ParameterFormat extends Tab
             }
             if (end) break;
             nextColumn(table);
+            numColumnsBeforeValue++;
         }
         table.nextLine();
         /*
@@ -683,8 +685,25 @@ public class ParameterFormat extends Tab
                     Object value = row.values.get(i);
                     if (value != null) {
                         if (i != 0) {
-                            table.append(lineSeparator);
+                            /*
+                             * If the same parameter is repeated more than once (not allowed by ISO 19111,
+                             * but this extra flexibility is allowed by Apache SIS), write the ditto mark
+                             * in all previous columns (name, type, etc.) on a new row.
+                             */
+                            final String ditto = resources.getString(Vocabulary.Keys.DittoMark);
+                            table.nextLine();
+                            table.setCellAlignment(TableAppender.ALIGN_CENTER);
+                            for (int j=0; j<numColumnsBeforeValue; j++) {
+                                table.append(ditto);
+                                nextColumn(table);
+                            }
+                            table.setCellAlignment(TableAppender.ALIGN_RIGHT);
                         }
+                        /*
+                         * Format the value followed by the unit of measure, or followed by spaces if there is no unit
+                         * for this value. The intend is the right align the numerical value rather than the numerical
+                         * + unit tupple.
+                         */
                         final Format format = getFormat(value.getClass());
                         if (format != null) {
                             value = format.format(value, buffer, dummyFP);

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -16,10 +16,11 @@
  */
 package org.apache.sis.parameter;
 
+import java.util.Map;
+import java.util.HashMap;
 import javax.measure.unit.Unit;
 import org.opengis.util.MemberName;
-import org.opengis.parameter.ParameterValue;
-import org.opengis.parameter.ParameterDescriptor;
+import org.opengis.parameter.*; // We use almost all types from this package.
 import org.apache.sis.internal.jaxb.metadata.replace.ServiceParameter;
 import org.apache.sis.measure.Range;
 import org.apache.sis.measure.NumberRange;
@@ -44,6 +45,75 @@ public final class Parameters extends St
     }
 
     /**
+     * Gets the parameter name as an instance of {@code MemberName}.
+     * This method performs the following checks:
+     *
+     * <ul>
+     *   <li>If the {@linkplain DefaultParameterDescriptor#getName() primary name} is an instance of {@code MemberName},
+     *       returns that primary name.</li>
+     *   <li>Otherwise this method searches for the first {@linkplain DefaultParameterDescriptor#getAlias() alias}
+     *       which is an instance of {@code MemberName}. If found, that alias is returned.</li>
+     *   <li>If no alias is found, then this method tries to build a member name from the primary name and the
+     *       {@linkplain DefaultParameterDescriptor#getValueClass() value class}, using the mapping defined in
+     *       {@link org.apache.sis.util.iso.DefaultTypeName} javadoc.</li>
+     * </ul>
+     *
+     * This method can be used as a bridge between the parameter object
+     * defined by ISO 19111 (namely {@code CC_OperationParameter}) and the one
+     * defined by ISO 19115 (namely {@code SV_Parameter}).
+     *
+     * @param  parameter The parameter from which to get the name (may be {@code null}).
+     * @return The member name, or {@code null} if none.
+     *
+     * @see org.apache.sis.util.iso.Names#createMemberName(CharSequence, String, CharSequence, Class)
+     *
+     * @since 0.5
+     */
+    public static MemberName getMemberName(final ParameterDescriptor<?> parameter) {
+        return ServiceParameter.getMemberName(parameter);
+    }
+
+    /**
+     * Returns the domain of valid values defined by the given descriptor, or {@code null} if none.
+     * This method builds the range from the {@linkplain DefaultParameterDescriptor#getMinimumValue() minimum value},
+     * {@linkplain DefaultParameterDescriptor#getMaximumValue() maximum value} and, if the values are numeric, from
+     * the {@linkplain DefaultParameterDescriptor#getUnit() unit}.
+     *
+     * @param  descriptor The parameter descriptor, or {@code null}.
+     * @return The domain of valid values, or {@code null} if none.
+     *
+     * @see DefaultParameterDescriptor#getValueDomain()
+     */
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    public static Range<?> getValueDomain(final ParameterDescriptor<?> descriptor) {
+        if (descriptor != null) {
+            if (descriptor instanceof DefaultParameterDescriptor<?>) {
+                return ((DefaultParameterDescriptor<?>) descriptor).getValueDomain();
+            }
+            final Class<?> valueClass = descriptor.getValueClass();
+            final Comparable<?> minimumValue = descriptor.getMinimumValue();
+            final Comparable<?> maximumValue = descriptor.getMaximumValue();
+            if ((minimumValue == null || valueClass.isInstance(minimumValue)) &&
+                (maximumValue == null || valueClass.isInstance(maximumValue)))
+            {
+                if (Number.class.isAssignableFrom(valueClass)) {
+                    final Unit<?> unit = descriptor.getUnit();
+                    if (unit != null) {
+                        return new MeasurementRange((Class) valueClass,
+                                (Number) minimumValue, true, (Number) maximumValue, true, unit);
+                    } else if (minimumValue != null || maximumValue != null) {
+                        return new NumberRange((Class) valueClass,
+                                (Number) minimumValue, true, (Number) maximumValue, true);
+                    }
+                } else if (minimumValue != null || maximumValue != null) {
+                    return new Range(valueClass, minimumValue, true, maximumValue, true);
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
      * Casts the given parameter descriptor to the given type.
      * An exception is thrown immediately if the parameter does not have the expected
      * {@linkplain DefaultParameterDescriptor#getValueClass() value class}.
@@ -100,71 +170,110 @@ public final class Parameters extends St
     }
 
     /**
-     * Returns the domain of valid values defined by the given descriptor, or {@code null} if none.
-     * This method builds the range from the {@linkplain DefaultParameterDescriptor#getMinimumValue() minimum value},
-     * {@linkplain DefaultParameterDescriptor#getMaximumValue() maximum value} and, if the values are numeric, from
-     * the {@linkplain DefaultParameterDescriptor#getUnit() unit}.
-     *
-     * @param  descriptor The parameter descriptor, or {@code null}.
-     * @return The domain of valid values, or {@code null} if none.
+     * Copies the values of a parameter group into another parameter group.
+     * All values in the {@code source} group shall be valid for the {@code destination} group,
+     * but the {@code destination} may have more parameters.
+     * Sub-groups are copied recursively.
+     *
+     * <p>A typical usage of this method is for transferring values from an arbitrary implementation
+     * to some specific implementation, or to a parameter group using a different but compatible
+     * {@linkplain DefaultParameterValueGroup#getDescriptor() descriptor}.</p>
+     *
+     * @param  values The parameters values to copy.
+     * @param  destination Where to copy the values.
+     * @throws InvalidParameterNameException if a {@code source} parameter name is unknown to the {@code destination}.
+     * @throws InvalidParameterValueException if the value of a {@code source} parameter is invalid for the {@code destination}.
      *
-     * @see DefaultParameterDescriptor#getValueDomain()
+     * @since 0.5
      */
-    @SuppressWarnings({"unchecked", "rawtypes"})
-    public static Range<?> getValueDomain(final ParameterDescriptor<?> descriptor) {
-        if (descriptor != null) {
-            if (descriptor instanceof DefaultParameterDescriptor<?>) {
-                return ((DefaultParameterDescriptor<?>) descriptor).getValueDomain();
-            }
-            final Class<?> valueClass = descriptor.getValueClass();
-            final Comparable<?> minimumValue = descriptor.getMinimumValue();
-            final Comparable<?> maximumValue = descriptor.getMaximumValue();
-            if ((minimumValue == null || valueClass.isInstance(minimumValue)) &&
-                (maximumValue == null || valueClass.isInstance(maximumValue)))
-            {
-                if (Number.class.isAssignableFrom(valueClass)) {
-                    final Unit<?> unit = descriptor.getUnit();
-                    if (unit != null) {
-                        return new MeasurementRange((Class) valueClass,
-                                (Number) minimumValue, true, (Number) maximumValue, true, unit);
-                    } else if (minimumValue != null || maximumValue != null) {
-                        return new NumberRange((Class) valueClass,
-                                (Number) minimumValue, true, (Number) maximumValue, true);
+    public static void copy(final ParameterValueGroup values, final ParameterValueGroup destination)
+            throws InvalidParameterNameException, InvalidParameterValueException
+    {
+        final Integer ONE = 1;
+        final Map<String,Integer> occurrences = new HashMap<>();
+        for (final GeneralParameterValue value : values.values()) {
+            final String name = value.getDescriptor().getName().getCode();
+            if (value instanceof ParameterValueGroup) {
+                /*
+                 * Contains sub-group - invokes 'copy' recursively.
+                 */
+                final GeneralParameterDescriptor descriptor;
+                descriptor = destination.getDescriptor().descriptor(name);
+                if (descriptor instanceof ParameterDescriptorGroup) {
+                    final ParameterValueGroup groups = (ParameterValueGroup) descriptor.createValue();
+                    copy((ParameterValueGroup) value, groups);
+                    values.groups(name).add(groups);
+                } else {
+                    throw new InvalidParameterNameException(Errors.format(
+                            Errors.Keys.UnexpectedParameter_1, name), name);
+                }
+            } else {
+                /*
+                 * Single parameter - copy the value, with special care for value with units
+                 * and for multi-occurrences. Not that the later is not allowed by ISO 19111
+                 * but supported by SIS implementation.
+                 */
+                final ParameterValue<?> source = (ParameterValue<?>) value;
+                final ParameterValue<?> target;
+                Integer occurrence = occurrences.get(name);
+                if (occurrence == null) {
+                    occurrence = ONE;
+                    try {
+                        target = destination.parameter(name);
+                    } catch (ParameterNotFoundException cause) {
+                        throw new InvalidParameterNameException(Errors.format(
+                                    Errors.Keys.UnexpectedParameter_1, name), cause, name);
                     }
-                } else if (minimumValue != null || maximumValue != null) {
-                    return new Range(valueClass, minimumValue, true, maximumValue, true);
+                } else {
+                    target = (ParameterValue<?>) getOrCreate(destination, name, occurrence);
+                    occurrence++;
+                }
+                occurrences.put(name, occurrence);
+                final Object  v    = source.getValue();
+                final Unit<?> unit = source.getUnit();
+                if (unit == null) {
+                    target.setValue(v);
+                } else if (v instanceof Number) {
+                    target.setValue(((Number) v).doubleValue(), unit);
+                } else if (v instanceof double[]) {
+                    target.setValue((double[]) v, unit);
+                } else {
+                    throw new InvalidParameterValueException(Errors.format(
+                            Errors.Keys.IllegalArgumentValue_2, name, v), name, v);
                 }
             }
         }
-        return null;
     }
 
     /**
-     * Gets the parameter name as an instance of {@code MemberName}.
-     * This method performs the following checks:
-     *
-     * <ul>
-     *   <li>If the {@linkplain DefaultParameterDescriptor#getName() primary name} is an instance of {@code MemberName},
-     *       returns that primary name.</li>
-     *   <li>Otherwise this method searches for the first {@linkplain DefaultParameterDescriptor#getAlias() alias}
-     *       which is an instance of {@code MemberName}. If found, that alias is returned.</li>
-     *   <li>If no alias is found, then this method tries to build a member name from the primary name and the
-     *       {@linkplain DefaultParameterDescriptor#getValueClass() value class}, using the mapping defined in
-     *       {@link org.apache.sis.util.iso.DefaultTypeName} javadoc.</li>
-     * </ul>
-     *
-     * This method can be used as a bridge between the parameter object
-     * defined by ISO 19111 (namely {@code CC_OperationParameter}) and the one
-     * defined by ISO 19115 (namely {@code SV_Parameter}).
-     *
-     * @param  parameter The parameter from which to get the name (may be {@code null}).
-     * @return The member name, or {@code null} if none.
-     *
-     * @see org.apache.sis.util.iso.Names#createMemberName(CharSequence, String, CharSequence, Class)
-     *
-     * @since 0.5
+     * Returns the <var>n</var>th occurrence of the parameter of the given name.
+     * This method is not public because ISO 19111 does not allow multi-occurrences of parameter values
+     * (this is a SIS-specific flexibility). Current implementation is not very efficient, but it should
+     * not be an issue if this method is rarely invoked.
+     *
+     * @param  values The group from which to get or create a value
+     * @param  name   The name of the parameter to fetch. An exact match will be required.
+     * @param  n      Number of occurrences to skip before to return or create the parameter.
+     * @return The <var>n</var>th occurrence (zero-based) of the parameter of the given name.
+     * @throws IndexOutOfBoundsException if {@code n} is greater than the current number of
+     *         parameters of the given name.
      */
-    public static MemberName getMemberName(final ParameterDescriptor<?> parameter) {
-        return ServiceParameter.getMemberName(parameter);
+    private static GeneralParameterValue getOrCreate(final ParameterValueGroup values, final String name, int n) {
+        for (final GeneralParameterValue value : values.values()) {
+            if (name.equals(value.getDescriptor().getName().getCode())) {
+                if (--n < 0) {
+                    return value;
+                }
+            }
+        }
+        if (n == 0) {
+            final GeneralParameterValue value = values.getDescriptor().descriptor(name).createValue();
+            values.values().add(value);
+            return value;
+        } else {
+            // We do not botter formatting a good error message for now, because
+            // this method is currently invoked only with increasing index values.
+            throw new IndexOutOfBoundsException(name);
+        }
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -219,7 +219,7 @@ public final class IdentifiedObjects ext
                             if (ns != null) {
                                 final GenericName scope = ns.name();
                                 if (scope != null) {
-                                    if (identifierMatches(authority, scope.toString())) {
+                                    if (identifierMatches(authority, null, scope.toString())) {
                                         final String name = alias.toString();
                                         if (name != null) {
                                             if (addTo == null) {

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=1654028&r1=1654027&r2=1654028&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] Thu Jan 22 19:43:33 2015
@@ -17,6 +17,8 @@
 package org.apache.sis.internal.referencing;
 
 import java.util.Collections;
+import java.util.Locale;
+import java.util.Map;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.OperationMethod;
@@ -58,16 +60,23 @@ public final strictfp class OperationMet
      */
     @Test
     public void testCheckDimensions() {
+        final Map<String,?> properties = Collections.singletonMap(DefaultOperationMethod.LOCALE_KEY, Locale.ENGLISH);
         final MathTransform tr = MathTransformsTest.createConcatenateAndPassThrough();
-        OperationMethods.checkDimensions(createOperationMethod(3, 3), tr);
-        OperationMethods.checkDimensions(createOperationMethod(1, 1), tr);
+        OperationMethods.checkDimensions(createOperationMethod(3, 3), tr, properties);
+        OperationMethods.checkDimensions(createOperationMethod(1, 1), tr, properties);
         try {
-            OperationMethods.checkDimensions(createOperationMethod(2, 2), tr);
-            fail("OperationMethod of dimension 2 shall be considered incompatible.");
+            OperationMethods.checkDimensions(createOperationMethod(2, 2), tr, properties);
+            fail("MathTransform.sourceDimension == 3 shall be considered incompatible.");
         } catch (IllegalArgumentException e) {
             // This is the expected exception.
-            final String message = e.getMessage();
-            assertTrue(message, message.contains("transform.source"));
+            assertEquals(e.getMessage(), "The transform has 1 source dimension, while 2 was expected.");
+        }
+        try {
+            OperationMethods.checkDimensions(createOperationMethod(3, 1), tr, properties);
+            fail("MathTransform.targetDimension == 3 shall be considered incompatible.");
+        } catch (IllegalArgumentException e) {
+            // This is the expected exception.
+            assertEquals(e.getMessage(), "The transform has 3 target dimensions, while 1 was expected.");
         }
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -26,9 +26,9 @@ import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
 import static org.opengis.test.Validators.*;
 import static java.util.Collections.singletonMap;
+import static org.apache.sis.test.MetadataAssert.*;
 import static org.opengis.referencing.IdentifiedObject.*;
 
 
@@ -57,8 +57,8 @@ public final strictfp class DefaultParam
         M1_M1_O1_O2 = new DefaultParameterDescriptorGroup(singletonMap(NAME_KEY, "Test group"), 0, 1,
             new DefaultParameterDescriptor<>(name(properties, "Mandatory 1", "Ambiguity"), 1, 1, type, null, null, DEFAULT_VALUE),
             new DefaultParameterDescriptor<>(name(properties, "Mandatory 2", "Alias 2"),   1, 1, type, null, null, DEFAULT_VALUE),
-            new DefaultParameterDescriptor<>(name(properties, "Optional 3", "Alias 3"),    0, 1, type, null, null, DEFAULT_VALUE),
-            new DefaultParameterDescriptor<>(name(properties, "Optional 4", "Ambiguity"),  0, 2, type, null, null, DEFAULT_VALUE)
+            new DefaultParameterDescriptor<>(name(properties, "Optional 3",  "Alias 3"),   0, 1, type, null, null, DEFAULT_VALUE),
+            new DefaultParameterDescriptor<>(name(properties, "Optional 4",  "Ambiguity"), 0, 2, type, null, null, DEFAULT_VALUE)
         );
     }
 
@@ -79,7 +79,7 @@ public final strictfp class DefaultParam
         final Class<Integer> type = Integer.class;
         final Map<String,Object> properties = new HashMap<>(4);
         final DefaultParameterDescriptor<Integer> p1, p2;
-        p1 = new DefaultParameterDescriptor<>(name(properties,    "Name", null), 1, 1, type, null, null, null);
+        p1 = new DefaultParameterDescriptor<>(name(properties,   "Name",  null), 1, 1, type, null, null, null);
         p2 = new DefaultParameterDescriptor<>(name(properties, "  NAME ", null), 1, 1, type, null, null, null);
         try {
             new DefaultParameterDescriptorGroup(singletonMap(NAME_KEY, "Test group"), 0, 1, p1, p2);
@@ -169,6 +169,19 @@ public final strictfp class DefaultParam
     }
 
     /**
+     * Tests the WKT representation.
+     */
+    @Test
+    public void testWKT() {
+        assertWktEquals(
+                "ParameterGroup[“Test group”,\n" +
+                "  Parameter[“Mandatory 1”, 10],\n" +
+                "  Parameter[“Mandatory 2”, 10],\n" +
+                "  Parameter[“Optional 3”, 10],\n" +
+                "  Parameter[“Optional 4”, 10]]", M1_M1_O1_O2);
+    }
+
+    /**
      * Tests {@link DefaultParameterDescriptorGroup} serialization.
      */
     @Test

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -31,7 +31,7 @@ import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.Assert.*;
 import static org.opengis.test.Validators.*;
 import static java.util.Collections.singletonMap;
 import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
@@ -42,7 +42,7 @@ import static org.opengis.referencing.Id
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-2.1)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn({
@@ -356,19 +356,6 @@ public final strictfp class DefaultParam
     }
 
     /**
-     * Tests the WKT representation.
-     */
-    @Test
-    public void testWKT() {
-        assertWktEquals(
-                "ParameterGroup[“Test group”,\n" +
-                "  Parameter[“Mandatory 1”, 10],\n" +
-                "  Parameter[“Mandatory 2”, 10],\n" +
-                "  Parameter[“Optional 3”, 10],\n" +
-                "  Parameter[“Optional 4”, 10]]", descriptor);
-    }
-
-    /**
      * Tests {@link DefaultParameterValueGroup} serialization.
      */
     @Test

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -26,6 +26,7 @@ import org.opengis.parameter.ParameterDe
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.parameter.ParameterValue;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -43,7 +44,7 @@ import static org.apache.sis.metadata.is
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn(ParameterBuilderTest.class)
@@ -308,13 +309,14 @@ public final strictfp class ParameterFor
     }
 
     /**
-     * Tests the formatting of a parameter value group with an invalid cardinality.
-     * While not allowed by ISO 19111, the Apache SIS implementation shall be robust
-     * to those cases.
+     * Tests the formatting of a parameter descriptor group with a cardinality
+     * invalid according ISO 19111, but allowed by Apache SIS implementation.
+     * ISO 19111 restricts {@link ParameterDescriptor} cardinality to the [0 … 1] range,
+     * but SIS can handle arbitrary ranges ([0 … 2] in this test).
      */
     @Test
     @DependsOnMethod("testFormatBriefDescriptors")
-    public void testInvalidCardinality() {
+    public void testExtendedCardinality() {
         final ParameterFormat format = new ParameterFormat(null, null);
         format.setContentLevel(ParameterFormat.ContentLevel.BRIEF);
         final String text = format.format(DefaultParameterDescriptorGroupTest.M1_M1_O1_O2);
@@ -329,4 +331,40 @@ public final strictfp class ParameterFor
                 "│ Optional 4  │ Integer │ 0 … 2      │              │            10 │\n" +
                 "└─────────────┴─────────┴────────────┴──────────────┴───────────────┘\n", text);
     }
+
+    /**
+     * Tests the formatting of a parameter value group with a cardinality
+     * invalid according ISO 19111, but allowed by Apache SIS implementation.
+     * ISO 19111 restricts {@link ParameterValue} cardinality to the [0 … 1] range,
+     * but SIS can handle arbitrary number of occurrences (2 in this test).
+     */
+    @Test
+    @DependsOnMethod("testExtendedCardinality")
+    public void testMultiOccurrence() {
+        final ParameterValueGroup group = DefaultParameterDescriptorGroupTest.M1_M1_O1_O2.createValue();
+        group.parameter("Mandatory 2").setValue(20);
+        final ParameterValue<?> value = group.parameter("Optional 4");
+        value.setValue(40);
+        /*
+         * Adding a second occurrence of the same parameter.
+         * Not straightforward because not allowed by ISO 19111.
+         */
+        final ParameterValue<?> secondOccurrence = value.getDescriptor().createValue();
+        group.values().add(secondOccurrence);
+        secondOccurrence.setValue(50);
+
+        final ParameterFormat format = new ParameterFormat(null, null);
+        format.setContentLevel(ParameterFormat.ContentLevel.BRIEF);
+        final String text = format.format(group);
+        assertMultilinesEquals(
+                "Test group\n" +
+                "┌─────────────┬─────────┬──────────────┬───────┐\n" +
+                "│ Name        │ Type    │ Value domain │ Value │\n" +
+                "├─────────────┼─────────┼──────────────┼───────┤\n" +
+                "│ Mandatory 1 │ Integer │              │    10 │\n" +
+                "│ Mandatory 2 │ Integer │              │    20 │\n" +
+                "│ Optional 4  │ Integer │              │    40 │\n" +
+                "│      ″      │    ″    │      ″       │    50 │\n" +
+                "└─────────────┴─────────┴──────────────┴───────┘\n", text);
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -22,7 +22,9 @@ import javax.measure.unit.SI;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDirection;
 import org.opengis.parameter.ParameterValue;
+import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.metadata.Identifier;
+import org.opengis.parameter.GeneralParameterValue;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import javax.measure.unit.Unit;
@@ -128,4 +130,30 @@ public final strictfp class ParametersTe
             @Override public String                   toWKT()            {return descriptor.toWKT();}
         }));
     }
+
+    /**
+     * Tests {@link Parameters#copy(ParameterValueGroup, ParameterValueGroup)}.
+     */
+    @Test
+    public void testCopy() {
+        final ParameterValueGroup source = DefaultParameterDescriptorGroupTest.M1_M1_O1_O2.createValue();
+        final ParameterValue<?> o1 = source.parameter("Optional 4");
+        final ParameterValue<?> o2 = o1.getDescriptor().createValue(); // See ParameterFormatTest.testMultiOccurrence()
+        source.parameter("Mandatory 2").setValue(20);
+        source.values().add(o2);
+        o1.setValue(40);
+        o2.setValue(50);
+
+        final ParameterValueGroup destination = DefaultParameterDescriptorGroupTest.M1_M1_O1_O2.createValue();
+        destination.parameter("Mandatory 1").setValue(-10);  // We expect this value to be overwritten.
+        destination.parameter("Optional 3") .setValue( 30);  // We expect this value to be preserved.
+        Parameters.copy(source, destination);
+
+        assertEquals("Mandatory 1", 10, destination.parameter("Mandatory 1").intValue());
+        assertEquals("Mandatory 2", 20, destination.parameter("Mandatory 2").intValue());
+        assertEquals("Optional 3",  30, destination.parameter("Optional 3") .intValue());
+        assertEquals("Optional 4",  40, destination.parameter("Optional 4") .intValue());
+        assertEquals("Optional 4 (second occurrence)", 50,
+                ((ParameterValue<?>) destination.values().get(4)).intValue());
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -125,6 +125,7 @@ import org.junit.BeforeClass;
 
     org.apache.sis.distance.LatLonPointRadiusTest.class, // Pending refactoring in a geometry package.
 
+    org.apache.sis.referencing.operation.builder.LinearTransformBuilderTest.class,
     org.apache.sis.internal.referencing.ServicesForMetadataTest.class,
     org.apache.sis.test.integration.ReferencingInMetadataTest.class,
     org.apache.sis.test.integration.DefaultMetadataTest.class

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -45,7 +45,7 @@ import java.util.Objects;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.2)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 public final class Citations extends Static {
@@ -164,10 +164,12 @@ public final class Citations extends Sta
     }
 
     /**
-     * Returns {@code true} if at least one {@linkplain Citation#getIdentifiers() identifier} in
-     * {@code c1} is equal to an identifier in {@code c2}. The comparison is case-insensitive
-     * and ignores every character which is not a {@linkplain Character#isLetterOrDigit(int)
-     * letter or a digit}. The identifier ordering is not significant.
+     * Returns {@code true} if at least one {@linkplain Citation#getIdentifiers() identifier}
+     * {@linkplain Identifier#getCode() code} in {@code c1} is equal to an identifier code in
+     * {@code c2}. {@linkplain Identifier#getCodeSpace() Code spaces} are compared only if
+     * provided in the two identifiers being compared. Comparisons are case-insensitive and ignores
+     * every character which is not a {@linkplain Character#isLetterOrDigit(int) letter or a digit}.
+     * The identifier ordering is not significant.
      *
      * <p>If (and <em>only</em> if) the citations do not contains any identifier, then this method
      * fallback on titles comparison using the {@link #titleMatches(Citation,Citation) titleMatches}
@@ -200,7 +202,7 @@ public final class Citations extends Sta
             }
             do {
                 final Identifier id = iterator.next();
-                if (id != null && identifierMatches(c1, id.getCode())) {
+                if (id != null && identifierMatches(c1, id, id.getCode())) {
                     return true;
                 }
             } while (iterator.hasNext());
@@ -209,29 +211,43 @@ public final class Citations extends Sta
     }
 
     /**
-     * Returns {@code true} if any {@linkplain Citation#getIdentifiers() identifiers} in the given
-     * citation matches the given string. The comparison is case-insensitive and ignores every
-     * character which is not a {@linkplain Character#isLetterOrDigit(int) letter or a digit}.
+     * Returns {@code true} if at least one {@linkplain Citation#getIdentifiers() identifier}
+     * in the given citation have a {@linkplain Identifier#getCode() code} matching the given
+     * one. The comparison is case-insensitive and ignores every character which is not a
+     * {@linkplain Character#isLetterOrDigit(int) letter or a digit}.
+     *
+     * <p>If a match is found, if the given {@code identifier} is non-null and if the code space
+     * of both objects is non-null, then the code space is also compared.</p>
      *
      * <p>If (and <em>only</em> if) the citation does not contain any identifier, then this method
      * fallback on titles comparison using the {@link #titleMatches(Citation, CharSequence) titleMatches}
      * method. This fallback exists for compatibility with client codes using citation
-     * {@linkplain Citation#getTitle() titles} without identifiers.</p>
+     * {@linkplain Citation#getTitle() title} without identifiers.</p>
      *
-     * @param  citation The citation to check for, or {@code null}.
-     * @param  identifier The identifier to compare, or {@code null}.
+     * @param  citation   The citation to check for, or {@code null}.
+     * @param  identifier The identifier to compare, or {@code null} to unknown.
+     * @param  code       The identifier code to compare, or {@code null}.
      * @return {@code true} if both arguments are non-null, and the title or alternate title
      *         matches the given string.
      */
-    public static boolean identifierMatches(final Citation citation, final CharSequence identifier) {
-        if (citation != null && identifier != null) {
+    public static boolean identifierMatches(final Citation citation, final Identifier identifier, final CharSequence code) {
+        if (citation != null && code != null) {
             final Iterator<? extends Identifier> identifiers = iterator(citation.getIdentifiers());
             if (identifiers == null) {
-                return titleMatches(citation, identifier);
+                return titleMatches(citation, code);
             }
             while (identifiers.hasNext()) {
                 final Identifier id = identifiers.next();
-                if (id != null && equalsFiltered(identifier, id.getCode(), LETTERS_AND_DIGITS, true)) {
+                if (id != null && equalsFiltered(code, id.getCode(), LETTERS_AND_DIGITS, true)) {
+                    if (identifier != null) {
+                        final String codeSpace = identifier.getCodeSpace();
+                        if (codeSpace != null) {
+                            final String cs = id.getCodeSpace();
+                            if (cs != null) {
+                                return equalsFiltered(codeSpace, cs, LETTERS_AND_DIGITS, true);
+                            }
+                        }
+                    }
                     return true;
                 }
             }

Copied: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/CompoundDirectPositions.java (from r1654026, sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/math/CompoundDirectPositions.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/CompoundDirectPositions.java?p2=sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/CompoundDirectPositions.java&p1=sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/math/CompoundDirectPositions.java&r1=1654026&r2=1654028&rev=1654028&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/math/CompoundDirectPositions.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/math/CompoundDirectPositions.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -149,4 +149,12 @@ final class CompoundDirectPositions impl
     public void setOrdinate(int dimension, double value) {
         throw new UnsupportedOperationException();
     }
+
+    /**
+     * Not needed.
+     */
+    @Override
+    public void remove() {
+        throw new UnsupportedOperationException();
+    }
 }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -292,9 +292,9 @@ public final class Characters extends St
 
         /**
          * The subset of all characters for which {@link Character#isUnicodeIdentifierPart(int)}
-         * returns {@code true}, excluding {@linkplain Character#isIdentifierIgnorable(int)
-         * ignorable} characters. This subset includes all the {@link #LETTERS_AND_DIGITS}
-         * categories with the addition of the following ones:
+         * returns {@code true}, excluding {@linkplain Character#isIdentifierIgnorable(int) ignorable} characters.
+         * This subset includes all the {@link #LETTERS_AND_DIGITS} categories with the addition of the following
+         * ones:
          * {@link Character#LETTER_NUMBER},
          * {@link Character#CONNECTOR_PUNCTUATION CONNECTOR_PUNCTUATION},
          * {@link Character#NON_SPACING_MARK NON_SPACING_MARK} and

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -489,6 +489,12 @@ public final class Errors extends Indexe
         public static final short MismatchedPropertyType_1 = 154;
 
         /**
+         * The transform has {2} {0,choice,0#source|1#target} dimension{2,choice,1#|2#s}, while {1} was
+         * expected.
+         */
+        public static final short MismatchedTransformDimension_3 = 178;
+
+        /**
          * Class of “{0}” values is ‘{2}’, but the requested type is ‘{1}’.
          */
         public static final short MismatchedValueClass_3 = 157;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Thu Jan 22 19:43:33 2015
@@ -108,6 +108,7 @@ MismatchedDimension_3             = Argu
 MismatchedMatrixSize_4            = Mismatched matrix sizes: expected {0}\u00d7{1} but got {2}\u00d7{3}.
 MismatchedParameterDescriptor_1   = Mismatched descriptor for \u201c{0}\u201d parameter.
 MismatchedPropertyType_1          = Mismatched type for \u201c{0}\u201d property.
+MismatchedTransformDimension_3    = The transform has {2} {0,choice,0#source|1#target} dimension{2,choice,1#|2#s}, while {1} was expected.
 MismatchedValueClass_3            = Class of \u201c{0}\u201d values is \u2018{2}\u2019, but the requested type is \u2018{1}\u2019.
 MissingAuthority_1                = No authority was specified for code \u201c{0}\u201d. The expected syntax is \u201cAUTHORITY:CODE\u201d.
 MissingNamespace_1                = \u201c{0}\u201d has no namespace.

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Thu Jan 22 19:43:33 2015
@@ -98,6 +98,7 @@ MismatchedDimension_3             = L\u2
 MismatchedMatrixSize_4            = Une matrice de taille de {0}\u00d7{1} \u00e9tait attendue mais la matrice donn\u00e9es est de taille {2}\u00d7{3}.
 MismatchedParameterDescriptor_1   = Le descripteur du param\u00e8tre \u00ab\u202f{0}\u202f\u00bb ne correspond pas.
 MismatchedPropertyType_1          = Le type de la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb ne correspond pas.
+MismatchedTransformDimension_3    = La {0,choice,0#source|1#destination} de la transformation a {2} dimension{2,choice,1#|2#s}, alors qu\u2019on en attendait {1}.
 MismatchedValueClass_3            = Les valeurs de \u00ab\u202f{0}\u202f\u00bb sont de la classe \u2018{2}\u2019, alors que le type demand\u00e9 \u00e9tait \u2018{1}\u2019.
 MissingAuthority_1                = Aucune autorit\u00e9 n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e pour le code \u00ab\u202f{0}\u202f\u00bb. Le format attendu est \u00ab\u202fAUTORIT\u00c9:CODE\u202f\u00bb.
 MissingNamespace_1                = \u201c{0}\u201d est d\u00e9fini sans espace de noms.

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -166,6 +166,11 @@ public final class Vocabulary extends In
         public static final short Directory = 16;
 
         /**
+         * ″
+         */
+        public static final short DittoMark = 82;
+
+        /**
          * Dublin Julian
          */
         public static final short DublinJulian = 17;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties [ISO-8859-1] Thu Jan 22 19:43:33 2015
@@ -36,6 +36,7 @@ Description             = Description
 Destination             = Destination
 Dimensions              = Dimensions
 Directory               = Directory
+DittoMark               = \u2033
 DublinJulian            = Dublin Julian
 Ellipsoid               = Ellipsoid
 EllipsoidalHeight       = Ellipsoidal height

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties [ISO-8859-1] Thu Jan 22 19:43:33 2015
@@ -36,6 +36,7 @@ Description             = Description
 Destination             = Destination
 Dimensions              = Dimensions
 Directory               = R\u00e9pertoire
+DittoMark               = \u2033
 DublinJulian            = Julien Dublin
 Ellipsoid               = Ellipso\u00efde
 EllipsoidalHeight       = Hauteur ellipso\u00efdale

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1654028&r1=1654027&r2=1654028&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Thu Jan 22 19:43:33 2015
@@ -61,6 +61,7 @@ import org.junit.BeforeClass;
     org.apache.sis.math.StatisticsFormatTest.class,
     org.apache.sis.internal.util.UtilitiesTest.class,
     org.apache.sis.internal.util.DoubleDoubleTest.class,
+    org.apache.sis.math.PlaneTest.class,
 
     // Collections.
     org.apache.sis.internal.util.CheckedArrayListTest.class,



Mime
View raw message