sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1626345 [11/14] - in /sis/trunk: ./ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gml/ core/sis-metada...
Date Fri, 19 Sep 2014 21:46:44 GMT
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CopyTransform.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -426,9 +426,10 @@ final class CopyTransform extends Abstra
             return true;
         }
         if (mode != ComparisonMode.STRICT) {
-            return equals(this, object, mode);
-        }
-        if (super.equals(object, mode)) {
+            if (object instanceof LinearTransform) {
+                return Matrices.equals(getMatrix(), ((LinearTransform) object).getMatrix(), mode);
+            }
+        } else if (super.equals(object, mode)) {
             final CopyTransform that = (CopyTransform) object;
             return srcDim == that.srcDim && Arrays.equals(indices, that.indices);
         }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/IdentityTransform.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -259,11 +259,11 @@ final class IdentityTransform extends Ab
             return true;
         }
         if (mode != ComparisonMode.STRICT) {
-            return equals(this, object, mode);
-        }
-        if (super.equals(object, mode)) {
-            final IdentityTransform that = (IdentityTransform) object;
-            return this.dimension == that.dimension;
+            if (object instanceof LinearTransform) {
+                return Matrices.equals(getMatrix(), ((LinearTransform) object).getMatrix(), mode);
+            }
+        } else if (super.equals(object, mode)) {
+            return ((IdentityTransform) object).dimension == dimension;
         }
         return false;
     }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearTransform1D.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -24,6 +24,7 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.MathTransform1D;
 import org.opengis.referencing.operation.TransformException;
 import org.opengis.referencing.operation.NoninvertibleTransformException;
+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;
@@ -310,9 +311,10 @@ class LinearTransform1D extends Abstract
             return true;
         }
         if (mode != ComparisonMode.STRICT) {
-            return equals(this, object, mode);
-        }
-        if (super.equals(object, mode)) {
+            if (object instanceof LinearTransform) {
+                return Matrices.equals(getMatrix(), ((LinearTransform) object).getMatrix(), mode);
+            }
+        } else if (super.equals(object, mode)) {
             final LinearTransform1D that = (LinearTransform1D) object;
             return doubleToRawLongBits(this.scale)  == doubleToRawLongBits(that.scale) &&
                    doubleToRawLongBits(this.offset) == doubleToRawLongBits(that.offset);

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MathTransforms.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -27,6 +27,7 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.TransformException;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.apache.sis.internal.referencing.DirectPositionView;
+import org.apache.sis.internal.referencing.ExtendedPrecisionMatrix;
 import org.apache.sis.internal.referencing.j2d.AffineTransform2D;
 import org.apache.sis.referencing.operation.matrix.AffineTransforms2D;
 import org.apache.sis.referencing.operation.matrix.Matrices;
@@ -119,11 +120,19 @@ public final class MathTransforms extend
             }
             if (Matrices.isAffine(matrix)) {
                 switch (sourceDimension) {
-                    case 1: return linear(matrix.getElement(0,0), matrix.getElement(0,1));
-                    case 2: return new AffineTransform2D(
-                            matrix.getElement(0,0), matrix.getElement(1,0),
-                            matrix.getElement(0,1), matrix.getElement(1,1),
-                            matrix.getElement(0,2), matrix.getElement(1,2));
+                    case 1: {
+                        return linear(matrix.getElement(0,0), matrix.getElement(0,1));
+                    }
+                    case 2: {
+                        if (matrix instanceof ExtendedPrecisionMatrix) {
+                            return new AffineTransform2D(((ExtendedPrecisionMatrix) matrix).getExtendedElements());
+                        } else {
+                            return new AffineTransform2D(
+                                    matrix.getElement(0,0), matrix.getElement(1,0),
+                                    matrix.getElement(0,1), matrix.getElement(1,1),
+                                    matrix.getElement(0,2), matrix.getElement(1,2));
+                        }
+                    }
                 }
             } else if (sourceDimension == 2) {
                 return new ProjectiveTransform2D(matrix);

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -85,7 +85,7 @@ public class PassThroughTransform extend
      * The sub-transform to apply on the {@linkplain #getModifiedCoordinates() modified coordinates}.
      * This is often the sub-transform specified at construction time, but not necessarily.
      */
-    protected final MathTransform subTransform;
+    final MathTransform subTransform;
 
     /**
      * The inverse transform. This field will be computed only when needed,
@@ -275,6 +275,16 @@ public class PassThroughTransform extend
     }
 
     /**
+     * Returns the sub-transform to apply on the {@linkplain #getModifiedCoordinates() modified coordinates}.
+     * This is often the sub-transform specified at construction time, but not necessarily.
+     *
+     * @return The sub-transform.
+     */
+    public final MathTransform getSubTransform() {
+        return subTransform;
+    }
+
+    /**
      * Tests whether this transform does not move any points. A {@code PassThroughTransform}
      * is identity if the {@linkplain #subTransform sub-transform} is also identity.
      *

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ProjectiveTransform.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -29,6 +29,9 @@ import org.apache.sis.parameter.TensorPa
 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.util.ArgumentChecks;
+import org.apache.sis.util.resources.Errors;
 
 
 /**
@@ -46,7 +49,9 @@ import org.apache.sis.referencing.operat
  *
  * @see java.awt.geom.AffineTransform
  */
-class ProjectiveTransform extends AbstractMathTransform implements LinearTransform, Serializable {
+class ProjectiveTransform extends AbstractMathTransform implements LinearTransform, ExtendedPrecisionMatrix,
+        Serializable // Not Cloneable, despite the clone() method.
+{
     /**
      * Serial number for inter-operability with different versions.
      */
@@ -64,6 +69,9 @@ class ProjectiveTransform extends Abstra
 
     /**
      * Elements of the matrix. Column indices vary fastest.
+     *
+     * <p>This array may have twice the normal length ({@link #numRow} × {@link #numCol}),
+     * in which case the second half contains the error terms in double-double arithmetic.</p>
      */
     private final double[] elt;
 
@@ -83,11 +91,16 @@ class ProjectiveTransform extends Abstra
     protected ProjectiveTransform(final Matrix matrix) {
         numRow = matrix.getNumRow();
         numCol = matrix.getNumCol();
-        elt = new double[numRow * numCol];
-        int mix = 0;
-        for (int j=0; j<numRow; j++) {
-            for (int i=0; i<numCol; i++) {
-                elt[mix++] = matrix.getElement(j,i);
+        if (matrix instanceof ExtendedPrecisionMatrix) {
+            elt = ((ExtendedPrecisionMatrix) matrix).getExtendedElements();
+            assert (elt.length % (numRow * numCol)) == 0;
+        } else {
+            elt = new double[numRow * numCol];
+            int mix = 0;
+            for (int j=0; j<numRow; j++) {
+                for (int i=0; i<numCol; i++) {
+                    elt[mix++] = matrix.getElement(j,i);
+                }
             }
         }
     }
@@ -109,27 +122,19 @@ class ProjectiveTransform extends Abstra
     }
 
     /**
-     * Tests whether this transform does not move any points.
-     *
-     * <span class="note"><b>Note:</b> this method should always returns {@code false}, since
-     * {@code MathTransforms.linear(…)} should have created specialized implementations for identity cases.
-     * Nevertheless we perform the full check as a safety, in case someone instantiated this class directly
-     * instead than using a factory method.</span>
+     * Gets the number of rows in the matrix.
      */
     @Override
-    public boolean isIdentity() {
-        if (numRow != numCol) {
-            return false;
-        }
-        int mix = 0;
-        for (int j=0; j<numRow; j++) {
-            for (int i=0; i<numCol; i++) {
-                if (elt[mix++] != (i == j ? 1 : 0)) {
-                    return false;
-                }
-            }
-        }
-        return true;
+    public final int getNumRow() {
+        return numRow;
+    }
+
+    /**
+     * Gets the number of columns in the matrix.
+     */
+    @Override
+    public final int getNumCol() {
+        return numCol;
     }
 
     /**
@@ -137,7 +142,7 @@ class ProjectiveTransform extends Abstra
      */
     @Override
     public final Matrix getMatrix() {
-        return Matrices.create(numRow, numCol, elt);
+        return this;
     }
 
     /**
@@ -162,6 +167,66 @@ class ProjectiveTransform extends Abstra
     }
 
     /**
+     * Returns a copy of matrix elements, including error terms if any.
+     */
+    @Override
+    public final double[] getExtendedElements() {
+        return elt.clone();
+    }
+
+    /**
+     * Returns the matrix element at the given index.
+     */
+    @Override
+    public final double getElement(final int row, final int column) {
+        ArgumentChecks.ensureBetween("row",    0, numRow - 1, row);
+        ArgumentChecks.ensureBetween("column", 0, numCol - 1, column);
+        return elt[row * numCol + column];
+    }
+
+    /**
+     * Unsupported operation, since this matrix is unmodifiable.
+     */
+    @Override
+    public final void setElement(final int row, final int column, final double value) {
+        throw new UnsupportedOperationException(Matrices.isAffine(this)
+                ? Errors.format(Errors.Keys.UnmodifiableAffineTransform)
+                : Errors.format(Errors.Keys.UnmodifiableObject_1, ProjectiveTransform.class));
+    }
+
+    /**
+     * Returns a copy of the matrix that user can modify.
+     */
+    @Override
+    public final Matrix clone() {
+        return Matrices.copy(this);
+    }
+
+    /**
+     * Tests whether this transform does not move any points.
+     *
+     * <span class="note"><b>Note:</b> this method should always returns {@code false}, since
+     * {@code MathTransforms.linear(…)} should have created specialized implementations for identity cases.
+     * Nevertheless we perform the full check as a safety, in case someone instantiated this class directly
+     * instead than using a factory method.</span>
+     */
+    @Override
+    public boolean isIdentity() {
+        if (numRow != numCol) {
+            return false;
+        }
+        int mix = 0;
+        for (int j=0; j<numRow; j++) {
+            for (int i=0; i<numCol; i++) {
+                if (elt[mix++] != (i == j ? 1 : 0)) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
      * Converts a single coordinate point in a list of ordinal values,
      * and optionally computes the derivative at that location.
      *
@@ -415,7 +480,7 @@ class ProjectiveTransform extends Abstra
              *           inverse = this;
              *       } else { ... }
              */
-            MatrixSIS matrix = Matrices.create(numRow, numCol, elt);
+            MatrixSIS matrix = Matrices.copy(this);
             matrix = matrix.inverse();
             ProjectiveTransform inv = createInverse(matrix);
             inv.inverse = this;
@@ -453,9 +518,10 @@ class ProjectiveTransform extends Abstra
             return true;
         }
         if (mode != ComparisonMode.STRICT) {
-            return equals(this, object, mode);
-        }
-        if (super.equals(object, mode)) {
+            if (object instanceof LinearTransform) {
+                return Matrices.equals(this, ((LinearTransform) object).getMatrix(), mode);
+            }
+        } else if (super.equals(object, mode)) {
             final ProjectiveTransform that = (ProjectiveTransform) object;
             return this.numRow == that.numRow &&
                    this.numCol == that.numCol &&

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -54,10 +54,10 @@ public final strictfp class DefaultParam
         final Class<Integer> type = Integer.class;
         final Map<String,Object> properties = new HashMap<String,Object>(4);
         M1_M1_O1_O2 = new DefaultParameterDescriptorGroup(singletonMap(NAME_KEY, "Test group"), 0, 1,
-            new DefaultParameterDescriptor<Integer>(name(properties, "Mandatory 1", "Ambiguity"), type, null, null, DEFAULT_VALUE, true),
-            new DefaultParameterDescriptor<Integer>(name(properties, "Mandatory 2", "Alias 2"),   type, null, null, DEFAULT_VALUE, true),
-            new DefaultParameterDescriptor<Integer>(name(properties,  "Optional 3", "Alias 3"),   type, null, null, DEFAULT_VALUE, false),
-            new MultiOccurrenceDescriptor <Integer>(name(properties,  "Optional 4", "Ambiguity"), type, null, null, DEFAULT_VALUE, false)
+            new DefaultParameterDescriptor<Integer>(name(properties, "Mandatory 1", "Ambiguity"), 1, 1, type, null, null, DEFAULT_VALUE),
+            new DefaultParameterDescriptor<Integer>(name(properties, "Mandatory 2", "Alias 2"),   1, 1, type, null, null, DEFAULT_VALUE),
+            new DefaultParameterDescriptor<Integer>(name(properties, "Optional 3", "Alias 3"),    0, 1, type, null, null, DEFAULT_VALUE),
+            new DefaultParameterDescriptor<Integer>(name(properties, "Optional 4", "Ambiguity"),  0, 2, type, null, null, DEFAULT_VALUE)
         );
     }
 
@@ -78,8 +78,8 @@ public final strictfp class DefaultParam
         final Class<Integer> type = Integer.class;
         final Map<String,Object> properties = new HashMap<String,Object>(4);
         final DefaultParameterDescriptor<Integer> p1, p2;
-        p1 = new DefaultParameterDescriptor<Integer>(name(properties, "Name", null), type, null, null, null, true);
-        p2 = new DefaultParameterDescriptor<Integer>(name(properties, "  NAME ", null), type, null, null, null, true);
+        p1 = new DefaultParameterDescriptor<Integer>(name(properties,    "Name", null), 1, 1, type, null, null, null);
+        p2 = new DefaultParameterDescriptor<Integer>(name(properties, "  NAME ", null), 1, 1, type, null, null, null);
         try {
             new DefaultParameterDescriptorGroup(singletonMap(NAME_KEY, "Test group"), 0, 1, p1, p2);
             fail("Constructor should have detected the duplicated names.");
@@ -102,7 +102,7 @@ public final strictfp class DefaultParam
             } catch (AssertionError e) {
                 error = e;
             }
-            if (descriptor instanceof MultiOccurrenceDescriptor) {
+            if (descriptor.getMaximumOccurs() > 1) {
                 assertNotNull("Validation methods should have detected that the descriptor is invalid.", error);
             } else if (error != null) {
                 throw error;

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -65,7 +65,7 @@ public final strictfp class DefaultParam
      * @return The parameter descriptor.
      */
     static <T> DefaultParameterDescriptor<T> createSimpleOptional(final String name, final Class<T> type) {
-        return new DefaultParameterDescriptor<T>(properties(name), type, null, null, null, false);
+        return new DefaultParameterDescriptor<T>(properties(name), 0, 1, type, null, null, null);
     }
 
     /**
@@ -80,8 +80,8 @@ public final strictfp class DefaultParam
     static DefaultParameterDescriptor<Integer> create(final String name,
             final int minimumValue, final int maximumValue, final int defaultValue)
     {
-        return new DefaultParameterDescriptor<Integer>(properties(name), Integer.class,
-                NumberRange.create(minimumValue, true, maximumValue, true), null, Integer.valueOf(defaultValue), true);
+        return new DefaultParameterDescriptor<Integer>(properties(name), 1, 1, Integer.class,
+                NumberRange.create(minimumValue, true, maximumValue, true), null, Integer.valueOf(defaultValue));
     }
 
     /**
@@ -97,9 +97,9 @@ public final strictfp class DefaultParam
     static DefaultParameterDescriptor<Double> create(final String name,
             final double minimumValue, final double maximumValue, final double defaultValue, final Unit<?> unit)
     {
-        return new DefaultParameterDescriptor<Double>(properties(name), Double.class,
+        return new DefaultParameterDescriptor<Double>(properties(name), 1, 1, Double.class,
                 MeasurementRange.create(minimumValue, true, maximumValue, true, unit), null,
-                Double.isNaN(defaultValue) ? null : Double.valueOf(defaultValue), true);
+                Double.isNaN(defaultValue) ? null : Double.valueOf(defaultValue));
     }
 
     /**
@@ -115,7 +115,7 @@ public final strictfp class DefaultParam
     static <T> DefaultParameterDescriptor<T> create(final String name, final Class<T> type,
             final T[] validValues, final T defaultValue)
     {
-        return new DefaultParameterDescriptor<T>(properties(name), type, null, validValues, defaultValue, true);
+        return new DefaultParameterDescriptor<T>(properties(name), 1, 1, type, null, validValues, defaultValue);
     }
 
     /**
@@ -131,7 +131,7 @@ public final strictfp class DefaultParam
             final double minimumValue, final double maximumValue, final Unit<?> unit)
     {
         final MeasurementRange<Double> valueDomain = MeasurementRange.create(minimumValue, true, maximumValue, true, unit);
-        return new DefaultParameterDescriptor<double[]>(properties(name), double[].class, valueDomain, null, null, true);
+        return new DefaultParameterDescriptor<double[]>(properties(name), 1, 1, double[].class, valueDomain, null, null);
     }
 
     /**
@@ -210,7 +210,7 @@ public final strictfp class DefaultParam
     public void testStringType() {
         final Range<String> valueDomain = new Range<String>(String.class, "AAA", true, "BBB", true);
         final DefaultParameterDescriptor<String> descriptor = new DefaultParameterDescriptor<String>(
-                properties("String param"), String.class, valueDomain, null, "ABC", false);
+                properties("String param"), 0, 1, String.class, valueDomain, null, "ABC");
         assertEquals("name", "String param",     descriptor.getName().getCode());
         assertEquals("valueClass", String.class, descriptor.getValueClass());
         assertNull  ("validValues",              descriptor.getValidValues());
@@ -277,8 +277,8 @@ public final strictfp class DefaultParam
          * Invalid operation: wrong type of range value.
          */
         try {
-            new DefaultParameterDescriptor<double[]>(properties("Array param"), double[].class,
-                    NumberRange.create(4, true, 9, true), null, null, false);
+            new DefaultParameterDescriptor<double[]>(properties("Array param"), 0, 1,
+                    double[].class, NumberRange.create(4, true, 9, true), null, null);
         } catch (IllegalArgumentException e) {
             assertEquals("Argument ‘valueDomain’ can not be an instance of ‘Range<Integer>’.", e.getMessage());
         }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueGroupTest.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -103,7 +103,7 @@ public final strictfp class DefaultParam
             } catch (AssertionError e) {
                 error = e;
             }
-            if (param.getDescriptor() instanceof MultiOccurrenceDescriptor) {
+            if (param.getDescriptor().getMaximumOccurs() > 1) {
                 assertNotNull("Validation methods should have detected that the descriptor is invalid.", error);
             } else if (error != null) {
                 throw error;
@@ -238,7 +238,7 @@ public final strictfp class DefaultParam
         final DefaultParameterValueGroup    group = createGroup(10);
         final List<GeneralParameterValue>  values = group.values();
         final ParameterValue<Integer> nonExistent = new DefaultParameterDescriptor<Integer>(
-                singletonMap(NAME_KEY, "Optional 5"), Integer.class, null, null, null, false).createValue();
+                singletonMap(NAME_KEY, "Optional 5"), 0, 1, Integer.class, null, null, null).createValue();
         try {
             values.add(nonExistent);
             fail("“Optional 5” is not a parameter for this group.");

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -40,7 +40,7 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn({

Copied: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java (from r1625241, sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java?p2=sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java&p1=sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java&r1=1625241&r2=1626345&rev=1626345&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -61,9 +61,6 @@ import static org.apache.sis.test.Assert
 import static java.util.Collections.singleton;
 import static java.util.Collections.singletonMap;
 
-// Branch-dependent imports
-import org.apache.sis.internal.jdk7.StandardCharsets;
-
 
 /**
  * Tests XML (un)marshalling of a metadata object containing various elements
@@ -95,13 +92,25 @@ public strictfp class DefaultMetadataTes
     }
 
     /**
+     * Creates a telephone number of the given type.
+     *
+     * @param type Either {@code "VOICE"}, {@code "FACSIMILE"} or {@code "SMS"}.
+     */
+    private static DefaultTelephone telephone(final String number, final String type) {
+        final DefaultTelephone tel = new DefaultTelephone();
+        tel.setNumber(number);
+        tel.setNumberType(type);
+        return tel;
+    }
+
+    /**
      * Programmatically creates the metadata to marshall, or to compare against the unmarshalled metadata.
      */
     private DefaultMetadata createHardCoded() {
         final DefaultMetadata metadata = new DefaultMetadata();
         metadata.setFileIdentifier("Apache SIS/Metadata test");
         metadata.setLanguage(Locale.ENGLISH);
-        metadata.setCharacterSet(StandardCharsets.UTF_8);
+        metadata.setCharacterSet(CharacterSet.UTF_8);
         metadata.setHierarchyLevels(singleton(ScopeCode.DATASET));
         metadata.setHierarchyLevelNames(singleton("Common Data Index record"));
         metadata.setDateStamp(TestUtilities.date("2009-01-01 04:00:00"));
@@ -116,8 +125,8 @@ public strictfp class DefaultMetadataTes
             online.setProtocol("http");
             final DefaultContact contact = new DefaultContact(online);
             contact.setPhones(Arrays.asList(
-                    new DefaultTelephone("+33 (0)2 xx.xx.xx.x6", TelephoneType.VOICE),
-                    new DefaultTelephone("+33 (0)2 xx.xx.xx.x4", TelephoneType.FACSIMILE)
+                    telephone("+33 (0)2 xx.xx.xx.x6", "VOICE"),
+                    telephone("+33 (0)2 xx.xx.xx.x4", "FACSIMILE")
             ));
             final DefaultAddress address = new DefaultAddress();
             address.setDeliveryPoints(singleton("Brest institute"));
@@ -146,8 +155,8 @@ public strictfp class DefaultMetadataTes
                 online.setProtocol("http");
                 final DefaultContact contact = new DefaultContact(online);
                 contact.setPhones(Arrays.asList(
-                        new DefaultTelephone("+33 (0)4 xx.xx.xx.x5", TelephoneType.VOICE),
-                        new DefaultTelephone("+33 (0)4 xx.xx.xx.x8", TelephoneType.FACSIMILE)
+                        telephone("+33 (0)4 xx.xx.xx.x5", "VOICE"),
+                        telephone("+33 (0)4 xx.xx.xx.x8", "FACSIMILE")
                 ));
                 final DefaultAddress address = new DefaultAddress();
                 address.setDeliveryPoints(singleton("Oceanology institute"));
@@ -166,7 +175,7 @@ public strictfp class DefaultMetadataTes
                     Locale.ENGLISH,             // Language,
                     TopicCategory.OCEANS);      // Topic category
             {
-                final DefaultResponsibleParty custodian = new DefaultResponsibleParty(author);
+                final DefaultResponsibleParty custodian = new DefaultResponsibleParty((DefaultResponsibility) author);
                 custodian.setRole(Role.CUSTODIAN);
                 identification.setPointOfContacts(singleton(custodian));
             }
@@ -176,7 +185,7 @@ public strictfp class DefaultMetadataTes
             {
                 final DefaultKeywords keyword = new DefaultKeywords(
                         new Anchor(URI.create("SDN:P021:35:ATTN"), "Transmittance and attenuance of the water column"));
-                keyword.setType(KeywordType.FEATURE_TYPE);
+                keyword.setType(KeywordType.THEME);
                 final DefaultCitation thesaurus = new DefaultCitation("BODC Parameter Discovery Vocabulary");
                 thesaurus.setAlternateTitles(singleton(new SimpleInternationalString("P021")));
                 thesaurus.setDates(singleton(new DefaultCitationDate(TestUtilities.date("2008-11-25 23:00:00"), DateType.REVISION)));
@@ -198,7 +207,7 @@ public strictfp class DefaultMetadataTes
              */
             {
                 final DefaultLegalConstraints constraint = new DefaultLegalConstraints();
-                constraint.setAccessConstraints(singleton(Restriction.LICENCE));
+                constraint.setAccessConstraints(singleton(Restriction.LICENSE));
                 identification.setResourceConstraints(singleton(constraint));
             }
             /*
@@ -292,7 +301,7 @@ public strictfp class DefaultMetadataTes
          */
         {
             final DefaultDistribution distributionInfo = new DefaultDistribution();
-            DefaultResponsibleParty distributor = new DefaultResponsibleParty(author);
+            DefaultResponsibleParty distributor = new DefaultResponsibleParty((DefaultResponsibility) author);
             distributor.setRole(Role.DISTRIBUTOR);
             distributionInfo.setDistributors(singleton(new DefaultDistributor(distributor)));
             distributionInfo.setDistributionFormats(singleton(

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -48,6 +48,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.operation.transform.ExponentialTransform1DTest.class,
     org.apache.sis.referencing.operation.transform.CopyTransformTest.class,
     org.apache.sis.referencing.operation.transform.PassThroughTransformTest.class,
+    org.apache.sis.referencing.operation.transform.ConcatenatedTransformTest.class,
     org.apache.sis.referencing.operation.transform.TransferFunctionTest.class,
 
     org.apache.sis.internal.referencing.FormulasTest.class,
@@ -112,7 +113,8 @@ import org.junit.BeforeClass;
 
     org.apache.sis.distance.LatLonPointRadiusTest.class, // Pending refactoring in a geometry package.
 
-    org.apache.sis.test.integration.ReferencingInMetadataTest.class
+    org.apache.sis.test.integration.ReferencingInMetadataTest.class,
+    org.apache.sis.test.integration.DefaultMetadataTest.class
 })
 public final strictfp class ReferencingTestSuite extends TestSuite {
     /**

Copied: sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml (from r1625241, sis/branches/JDK6/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml?p2=sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml&p1=sis/branches/JDK6/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml&r1=1625241&r2=1626345&rev=1626345&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml (original)
+++ sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml Fri Sep 19 21:46:39 2014
@@ -318,7 +318,7 @@
             <gmx:Anchor xlink:href="SDN:P021:35:ATTN">Transmittance and attenuance of the water column</gmx:Anchor>
           </gmd:keyword>
           <gmd:type>
-            <gmd:MD_KeywordTypeCode codeListValue="featureType" codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode">Feature type</gmd:MD_KeywordTypeCode>
+            <gmd:MD_KeywordTypeCode codeListValue="theme" codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#MD_KeywordTypeCode">Theme</gmd:MD_KeywordTypeCode>
           </gmd:type>
           <gmd:thesaurusName>
             <gmd:CI_Citation>

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/NumberConverter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/NumberConverter.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/NumberConverter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/converter/NumberConverter.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -109,12 +109,27 @@ final class NumberConverter<S extends Nu
      */
     @Override
     public T apply(final S source) {
-        final T target = Numbers.cast(source, targetClass);
-        if (target.longValue() != source.longValue() ||
-                Double.doubleToLongBits(target.doubleValue()) !=
-                Double.doubleToLongBits(source.doubleValue()))
-        {
-            throw new UnconvertibleObjectException(formatErrorMessage(source));
+        final double sourceValue = source.doubleValue();
+        T target = Numbers.cast(source, targetClass);
+        final double targetValue = target.doubleValue();
+        if (Double.doubleToLongBits(targetValue) != Double.doubleToLongBits(sourceValue)) {
+            /*
+             * Casted value is not equal to the source value. Maybe we just lost the fraction digits
+             * in a (double → long) cast, in which case the difference should be smaller than 1.
+             */
+            final double delta = Math.abs(targetValue - sourceValue);
+            if (!(delta < 0.5)) { // Use '!' for catching NaN.
+                if (delta < 1) {
+                    target = Numbers.cast(Math.round(sourceValue), targetClass);
+                } else {
+                    /*
+                     * The delta may be greater than 1 in a (BigInteger/BigDecimal → long) cast if the
+                     * BigInteger/BigDecimal has more significant digits than what the double type can
+                     * hold.
+                     */
+                    throw new UnconvertibleObjectException(formatErrorMessage(source));
+                }
+            }
         }
         return target;
     }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_GenericName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_GenericName.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_GenericName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_GenericName.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -17,7 +17,6 @@
 package org.apache.sis.internal.jaxb.gco;
 
 import org.opengis.util.GenericName;
-import org.apache.sis.util.iso.AbstractName;
 
 
 /**
@@ -49,12 +48,12 @@ public final class GO_GenericName extend
     /**
      * Wraps a name at marshalling-time.
      */
-    private GO_GenericName(final AbstractName value) {
+    private GO_GenericName(final GenericName value) {
         name = value;
     }
 
     /**
-     * Does the link between an {@link AbstractName} and the adapter associated.
+     * Does the link between an {@link GenericName} and the adapter associated.
      * JAXB calls automatically this method at marshalling-time.
      *
      * @param  value The implementing class for this metadata value.
@@ -62,7 +61,7 @@ public final class GO_GenericName extend
      */
     @Override
     public GO_GenericName marshal(final GenericName value) {
-        return (value != null) ? new GO_GenericName(AbstractName.castOrCopy(value)) : null;
+        return (value != null) ? new GO_GenericName(value) : null;
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_LocalName.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_LocalName.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_LocalName.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_LocalName.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -17,7 +17,6 @@
 package org.apache.sis.internal.jaxb.gco;
 
 import org.opengis.util.LocalName;
-import org.apache.sis.util.iso.DefaultLocalName;
 
 
 /**
@@ -48,7 +47,7 @@ public final class GO_LocalName extends 
     /**
      * Wraps a name at marshalling-time.
      */
-    private GO_LocalName(final DefaultLocalName value) {
+    private GO_LocalName(final LocalName value) {
         name = value;
     }
 
@@ -61,7 +60,7 @@ public final class GO_LocalName extends 
      */
     @Override
     public GO_LocalName marshal(final LocalName value) {
-        return (value != null) ? new GO_LocalName(DefaultLocalName.castOrCopy(value)) : null;
+        return (value != null) ? new GO_LocalName(value) : null;
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/NameAdapter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/NameAdapter.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/NameAdapter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/NameAdapter.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -16,15 +16,15 @@
  */
 package org.apache.sis.internal.jaxb.gco;
 
-import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.util.TypeName;
 import org.opengis.util.LocalName;
 import org.opengis.util.ScopedName;
 import org.opengis.util.MemberName;
 import org.opengis.util.GenericName;
-import org.apache.sis.internal.system.DefaultFactories;
-import org.apache.sis.util.iso.AbstractName;
+import org.apache.sis.internal.jaxb.gml.CodeType;
+import org.apache.sis.util.iso.DefaultLocalName;
 import org.apache.sis.util.iso.DefaultTypeName;
 import org.apache.sis.util.iso.DefaultMemberName;
 import org.apache.sis.util.resources.Errors;
@@ -46,7 +46,7 @@ import org.apache.sis.util.resources.Err
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Guilhem Legal (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 abstract class NameAdapter<ValueType extends NameAdapter<ValueType,BoundType>, BoundType extends GenericName>
@@ -55,7 +55,7 @@ abstract class NameAdapter<ValueType ext
     /**
      * The generic name to be marshalled.
      */
-    AbstractName name;
+    GenericName name;
 
     /**
      * Empty constructor for subclasses only.
@@ -75,118 +75,70 @@ abstract class NameAdapter<ValueType ext
     }
 
     /**
-     * Returns the {@code LocalName} generated from the metadata value.
-     * The local name is returned only if it is not a {@link TypeName} or a {@link MemberName}
-     * (otherwise, the corresponding {@code getXXX()} method needs to be invoked instead.
+     * Returns the {@code LocalName} or {@code ScopedName} to marshall. Returns {@code null} if the name
+     * is a {@link TypeName} or a {@link MemberName}, in order to use {@link #getNameType()} instead.
      *
-     * @return The current local name, or {@code null} if none.
-     *
-     * @see #getTypeName()
-     * @see #getMemberName()
-     */
-    @XmlElement(name = "LocalName")
-    public final String getLocalName() {
-        final AbstractName name = this.name;
-        return (name instanceof LocalName) && !(name instanceof TypeName)
-                && !(name instanceof MemberName) ? name.toString() : null;
-    }
-
-    /**
-     * Sets the value for the {@code LocalName}.
-     * This method is called at unmarshalling-time by JAXB.
-     *
-     * @param  value The new name.
-     * @throws IllegalStateException If a name is already defined.
+     * @return The code for the current name, or {@code null} if none.
      */
-    public final void setLocalName(final String value) throws IllegalStateException {
-        ensureUndefined();
-        if (value == null) {
-            name = null;
+    @XmlElementRef
+    public final CodeType getCodeType() {
+        final GenericName name = this.name;
+        final CodeType code;
+        if (name instanceof LocalName) {
+            if (name instanceof TypeName || name instanceof MemberName) {
+                return null;
+            } else {
+                code = new CodeType.LocalName();
+            }
+        } else if (name instanceof ScopedName) {
+            code = new CodeType.ScopedName();
         } else {
-            /*
-             * Following cast should be safe because the SIS_NAMES factory is fixed to a
-             * DefaultNameFactory instance, which is known to create AbstractName instances.
-             */
-            name = (AbstractName) DefaultFactories.SIS_NAMES.createLocalName(null, value);
+            return null;
         }
+        code.setName(name);
+        return code;
     }
 
     /**
-     * Returns the {@code ScopedName} generated from the metadata value.
-     * This method is called at marshalling-time by JAXB.
-     *
-     * @return The current name, or {@code null} if none.
-     */
-    @XmlElement(name = "ScopedName")
-    public final String getScopedName() {
-        final AbstractName name = this.name;
-        return (name instanceof ScopedName) ? name.toString() : null;
-    }
-
-    /**
-     * Sets the value for the {@code ScopedName}.
+     * Sets the value for the {@code LocalName} or {@code ScopedName}.
      * This method is called at unmarshalling-time by JAXB.
      *
-     * @param  value The new name.
+     * @param  code The new name.
      * @throws IllegalStateException If a name is already defined.
      */
-    public final void setScopedName(final String value) throws IllegalStateException {
+    public final void setCodeType(final CodeType code) throws IllegalStateException {
         ensureUndefined();
-        if (value == null) {
-            name = null;
-        } else {
-            /*
-             * Following cast should be safe because the SIS_NAMES factory is fixed to a
-             * DefaultNameFactory instance, which is known to create AbstractName instances.
-             */
-            name = (AbstractName) DefaultFactories.SIS_NAMES.parseGenericName(null, value);
+        if (code != null) {
+            name = code.getName();
         }
     }
 
     /**
-     * Returns the {@code TypeName} generated from the metadata value.
-     * This method is called at marshalling-time by JAXB.
+     * Returns the {@code TypeName} or {@code MemberName} to marshall. Returns {@code null} if the name
+     * is a {@link LocalName} or {@link ScopedName}, in order to use {@link #getCodeType()} instead.
      *
      * @return The current name, or {@code null} if none.
      */
-    @XmlElement(name = "TypeName")
-    public final DefaultTypeName getTypeName() {
-        final AbstractName name = this.name;
-        return (name instanceof DefaultTypeName) ? (DefaultTypeName) name : null;
-    }
-
-    /**
-     * Sets the value for the {@code TypeName}.
-     * This method is called at unmarshalling-time by JAXB.
-     *
-     * @param  value The new name.
-     * @throws IllegalStateException If a name is already defined.
-     */
-    public final void setTypeName(final DefaultTypeName value) throws IllegalStateException {
-        ensureUndefined();
-        name = value;
-    }
-
-    /**
-     * Returns the {@code MemberName} generated from the metadata value.
-     * This method is called at marshalling-time by JAXB.
-     *
-     * @return The current name, or {@code null} if none.
-     */
-    @XmlElement(name = "MemberName")
-    public final DefaultMemberName getMemberName() {
-        final AbstractName name = this.name;
-        return (name instanceof MemberName) ? (DefaultMemberName) name : null;
+    @XmlElementRef
+    public final DefaultLocalName getNameType() {
+        final GenericName name = this.name;
+        if (name instanceof TypeName) {
+            return DefaultTypeName.castOrCopy((TypeName) name);
+        } else if (name instanceof MemberName) {
+            return DefaultMemberName.castOrCopy((MemberName) name);
+        } else {
+            return null;
+        }
     }
 
     /**
-     * Sets the value for the {@code MemberName}.
+     * Sets the value from the {@code TypeName} or {@code MemberName}.
      * This method is called at unmarshalling-time by JAXB.
      *
      * @param  value The new name.
      * @throws IllegalStateException If a name is already defined.
      */
-    public final void setMemberName(final DefaultMemberName value) throws IllegalStateException {
+    public final void setNameType(final DefaultLocalName value) throws IllegalStateException {
         ensureUndefined();
         name = value;
     }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -115,6 +115,13 @@ public abstract class PropertyType<Value
         extends XmlAdapter<ValueType,BoundType>
 {
     /**
+     * {@code true} if marshalling an XML based on ISO 19115:2003 model. A value of {@code false}
+     * (ISO 19115:2014 model) is not yet supported, so we currently use this variable only as a way
+     * to identify the code to revisit when we will want to support the new model.
+     */
+    public static final boolean LEGACY_XML = true;
+
+    /**
      * The wrapped GeoAPI metadata instance, or {@code null} if the metadata shall not be marshalled.
      * Metadata are not marshalled when replaced by {@code xlink:href} or {@code uuidref} attributes.
      */

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -37,7 +37,7 @@ import org.apache.sis.internal.jaxb.Sche
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @version 0.5
  * @module
  *
  * @see CodeListAdapter
@@ -117,15 +117,15 @@ public final class CodeListProxy {
     }
 
     /**
-     * Builds a value for {@link LanguageCode} and {@link Country} elements.
+     * Builds a code list with the given attributes.
      *
      * @param context       The current (un)marshalling context, or {@code null} if none.
      * @param codeList      The {@code codeList} attribute, to be concatenated after the {@code "#"} symbol.
-     * @param codeListValue The {@code codeListValue} attribute, to be declared in the attribute.
+     * @param codeListValue The {@code codeListValue} attribute, to be declared in the XML element.
      * @param codeSpace     The 3-letters language code of the {@code value} attribute, or {@code null} if none.
      * @param value         The value in the language specified by the {@code codeSpace} attribute, or {@code null} if none.
      */
-    CodeListProxy(final Context context, final String codeList, final String codeListValue,
+    public CodeListProxy(final Context context, final String codeList, final String codeListValue,
             final String codeSpace, final String value)
     {
         this.codeList      = schema(context, codeList);

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java?rev=1626345&r1=1625241&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -18,8 +18,6 @@ package org.apache.sis.internal.jaxb.gml
 
 import java.util.Date;
 import javax.xml.bind.annotation.XmlElement;
-import org.opengis.temporal.Period;
-import org.opengis.temporal.Instant;
 import org.opengis.temporal.TemporalPrimitive;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.XmlUtilities;
@@ -27,6 +25,10 @@ import org.apache.sis.internal.jaxb.gco.
 import org.apache.sis.internal.util.TemporalUtilities;
 import org.apache.sis.util.resources.Errors;
 
+// Branch-dependent imports
+import org.apache.sis.internal.geoapi.temporal.Period;
+import org.apache.sis.internal.geoapi.temporal.Instant;
+
 
 /**
  * JAXB adapter for {@link TemporalPrimitive}, in order to integrate the value in an element complying

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java?rev=1626345&r1=1625241&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimeInstant.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -21,11 +21,13 @@ import javax.xml.bind.annotation.XmlElem
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.datatype.XMLGregorianCalendar;
 import javax.xml.datatype.DatatypeConfigurationException;
-import org.opengis.temporal.Instant;
-import org.opengis.temporal.Position;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.XmlUtilities;
 
+// Branch-dependent imports
+import org.apache.sis.internal.geoapi.temporal.Instant;
+import org.apache.sis.internal.geoapi.temporal.Position;
+
 
 /**
  * Encapsulates a {@code gml:TimeInstant}. This element may be used alone, or included in a

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java?rev=1626345&r1=1625241&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriod.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -20,11 +20,13 @@ import javax.xml.bind.annotation.XmlType
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElements;
 import javax.xml.bind.annotation.XmlRootElement;
-import org.opengis.temporal.Period;
 import org.apache.sis.internal.jaxb.Context;
 
 import static org.apache.sis.internal.jaxb.LegacyNamespaces.VERSION_3_0;
 
+// Branch-dependent imports
+import org.apache.sis.internal.geoapi.temporal.Period;
+
 
 /**
  * The adapter for {@code "TimePeriod"}. This is an attribute of {@link TM_Primitive}.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriodBound.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriodBound.java?rev=1626345&r1=1625241&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriodBound.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TimePeriodBound.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -21,7 +21,9 @@ import javax.xml.bind.annotation.XmlElem
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.datatype.XMLGregorianCalendar;
-import org.opengis.temporal.Instant;
+
+// Branch-dependent imports
+import org.apache.sis.internal.geoapi.temporal.Instant;
 
 
 /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/StandardCharsets.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/StandardCharsets.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/StandardCharsets.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/StandardCharsets.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -25,7 +25,7 @@ import java.nio.charset.Charset;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from GeoAPI)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 public final class StandardCharsets {
@@ -44,4 +44,9 @@ public final class StandardCharsets {
      * Sixteen-bit UCS Transformation Format.
      */
     public static final Charset UTF_16 = Charset.forName("UTF-16");
+
+    /**
+     * ISO/IEC 8859-1, Information technology - 8-bit single byte coded graphic character sets - Part 1 : Latin alphabet No.1.
+     */
+    public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
 }

Copied: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java (from r1625241, sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java)
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java?p2=sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java&p1=sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java&r1=1625241&r2=1626345&rev=1626345&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -18,7 +18,6 @@ package org.apache.sis.internal.simple;
 
 import java.io.Serializable;
 import org.opengis.util.Type;
-import org.opengis.feature.AttributeType;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.opengis.util.TypeName;
@@ -36,7 +35,7 @@ import org.opengis.util.TypeName;
  * @version 0.5
  * @module
  */
-public final class SimpleAttributeType<V> implements AttributeType<V>, Type, Serializable {
+public final class SimpleAttributeType<V> implements Type, Serializable {
     /**
      * For cross-version compatibility.
      */
@@ -68,7 +67,6 @@ public final class SimpleAttributeType<V
      *
      * @return The name of this attribute type.
      */
-    @Override
     public GenericName getName() {
         return name;
     }
@@ -88,7 +86,6 @@ public final class SimpleAttributeType<V
      *
      * @return The class of value for attributes of this type.
      */
-    @Override
     public Class<V> getValueClass() {
         return valueClass;
     }
@@ -98,7 +95,6 @@ public final class SimpleAttributeType<V
      *
      * @return Always 1.
      */
-    @Override
     public int getMinimumOccurs() {
         return 1;
     }
@@ -108,7 +104,6 @@ public final class SimpleAttributeType<V
      *
      * @return Always 1.
      */
-    @Override
     public int getMaximumOccurs() {
         return 1;
     }
@@ -118,7 +113,6 @@ public final class SimpleAttributeType<V
      *
      * @return Always {@code null}.
      */
-    @Override
     public V getDefaultValue() {
         return null;
     }
@@ -128,7 +122,6 @@ public final class SimpleAttributeType<V
      *
      * @return Always {@code null}.
      */
-    @Override
     public InternationalString getDefinition() {
         return null;
     }
@@ -138,7 +131,6 @@ public final class SimpleAttributeType<V
      *
      * @return Always {@code null}.
      */
-    @Override
     public InternationalString getDesignation() {
         return null;
     }
@@ -148,7 +140,6 @@ public final class SimpleAttributeType<V
      *
      * @return Always {@code null}.
      */
-    @Override
     public InternationalString getDescription() {
         return null;
     }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCitation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCitation.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCitation.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCitation.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -88,9 +88,10 @@ public class SimpleCitation implements C
     @Override public Collection<PresentationForm>     getPresentationForms()       {return Collections.emptyList();}
     @Override public Series                           getSeries()                  {return null;}
     @Override public InternationalString              getOtherCitationDetails()    {return null;}
-    @Override public InternationalString              getCollectiveTitle()         {return null;}
     @Override public String                           getISBN()                    {return null;}
     @Override public String                           getISSN()                    {return null;}
+    @Deprecated
+    @Override public InternationalString              getCollectiveTitle()         {return null;}
 
     /**
      * Compares the given object with this citation for equality.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -30,7 +30,8 @@ import org.apache.sis.internal.util.Cita
 import org.apache.sis.util.iso.DefaultNameSpace;
 import org.apache.sis.util.LenientComparable;
 import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Utilities;
+
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
@@ -41,20 +42,22 @@ import org.apache.sis.internal.jdk7.Obje
  *
  * @author  Guilhem Legal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @since   0.3 (derived from geotk-3.00)
+ * @since   0.5 (derived from geotk-3.00)
  * @version 0.3
  * @module
+ *
+ * @see org.apache.sis.referencing.AbstractIdentifiedObject
  */
 public class SimpleIdentifiedObject implements IdentifiedObject, LenientComparable, Serializable {
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = 4773397959809985024L;
+    private static final long serialVersionUID = 5297493321524903545L;
 
     /**
      * The primary name by which this object is identified.
      */
-    protected ReferenceIdentifier referenceSystemIdentifier;
+    protected ReferenceIdentifier name;
 
     /**
      * Creates an identified object without identifier.
@@ -69,7 +72,7 @@ public class SimpleIdentifiedObject impl
      * @param object The identified object to partially copy.
      */
     public SimpleIdentifiedObject(final IdentifiedObject object) {
-        referenceSystemIdentifier = object.getName();
+        name = object.getName();
     }
 
     /**
@@ -78,7 +81,7 @@ public class SimpleIdentifiedObject impl
      * @param name The primary name by which this object is identified.
      */
     public SimpleIdentifiedObject(final ReferenceIdentifier name) {
-        referenceSystemIdentifier = name;
+        this.name = name;
     }
 
     /**
@@ -88,17 +91,20 @@ public class SimpleIdentifiedObject impl
      */
     @Override
     public ReferenceIdentifier getName() {
-        return referenceSystemIdentifier;
+        return name;
     }
 
     /**
      * Method required by the {@link IdentifiedObject} interface.
      * Current implementation returns an empty set.
      *
+     * <p>If a future version allows this method to returns a non-empty set,
+     * revisit {@link #equals(Object, ComparisonMode)}.</p>
+     *
      * @return The identifiers, or an empty set if none.
      */
     @Override
-    public Set<ReferenceIdentifier> getIdentifiers() {
+    public final Set<ReferenceIdentifier> getIdentifiers() {
         return Collections.emptySet();
     }
 
@@ -106,10 +112,13 @@ public class SimpleIdentifiedObject impl
      * Method required by the {@link IdentifiedObject} interface.
      * Current implementation returns an empty set.
      *
+     * <p>If a future version allows this method to returns a non-empty set,
+     * revisit {@link #equals(Object, ComparisonMode)}.</p>
+     *
      * @return The aliases, or an empty set if none.
      */
     @Override
-    public Collection<GenericName> getAlias() {
+    public final Collection<GenericName> getAlias() {
         return Collections.emptySet();
     }
 
@@ -117,9 +126,12 @@ public class SimpleIdentifiedObject impl
      * Method required by most {@link IdentifiedObject} sub-interfaces.
      * Current implementation returns {@code null}.
      *
+     * <p>If a future version allows this method to returns a non-null value,
+     * revisit {@link #equals(Object, ComparisonMode)} in subclasses.</p>
+     *
      * @return The domain of validity, or {@code null} if none.
      */
-    public Extent getDomainOfValidity() {
+    public final Extent getDomainOfValidity() {
         return null;
     }
 
@@ -127,9 +139,12 @@ public class SimpleIdentifiedObject impl
      * Method required by most {@link IdentifiedObject} sub-interfaces.
      * Current implementation returns {@code null}.
      *
+     * <p>If a future version allows this method to returns a non-null value,
+     * revisit {@link #equals(Object, ComparisonMode)} in subclasses.</p>
+     *
      * @return The scope, or {@code null} if none.
      */
-    public InternationalString getScope() {
+    public final InternationalString getScope() {
         return null;
     }
 
@@ -137,10 +152,13 @@ public class SimpleIdentifiedObject impl
      * Method required by the {@link IdentifiedObject} interface.
      * Current implementation returns {@code null}.
      *
+     * <p>If a future version allows this method to returns a non-null value,
+     * revisit {@link #equals(Object, ComparisonMode)}.</p>
+     *
      * @return The remarks, or {@code null} if none.
      */
     @Override
-    public InternationalString getRemarks() {
+    public final InternationalString getRemarks() {
         return null;
     }
 
@@ -150,9 +168,9 @@ public class SimpleIdentifiedObject impl
     @Override
     public final int hashCode() {
         int code = (int) serialVersionUID;
-        final ReferenceIdentifier id = referenceSystemIdentifier;
-        if (id != null) {
-            code ^= id.hashCode();
+        final ReferenceIdentifier name = getName();
+        if (name != null) {
+            code ^= name.hashCode();
         }
         return code;
     }
@@ -170,6 +188,9 @@ public class SimpleIdentifiedObject impl
 
     /**
      * Compares this object with the given one for equality.
+     * This method compares the {@linkplain #name} only in "strict" or "by contract" modes.
+     * If name is a critical component of this object, then it shall be compared by the subclass.
+     * This behavior is consistent with {@link org.apache.sis.referencing.AbstractIdentifiedObject}.
      *
      * @param  object The object to compare with this reference system.
      * @param  mode The strictness level of the comparison.
@@ -180,15 +201,16 @@ public class SimpleIdentifiedObject impl
         if (object == this) {
             return true;
         }
-        if (mode == ComparisonMode.STRICT) {
-            if (object != null && object.getClass() == getClass()) {
-                final SimpleIdentifiedObject that = (SimpleIdentifiedObject) object;
-                return Objects.equals(referenceSystemIdentifier, that.referenceSystemIdentifier);
-            }
-        } else {
-            if (object instanceof IdentifiedObject) {
+        if (object instanceof IdentifiedObject) {
+            if (mode != ComparisonMode.STRICT || object.getClass() == getClass()) {
                 final IdentifiedObject that = (IdentifiedObject) object;
-                return Utilities.deepEquals(referenceSystemIdentifier, that.getName(), mode);
+                if (mode.ordinal() >= ComparisonMode.IGNORE_METADATA.ordinal()) {
+                    return true;
+                }
+                return Objects.equals(getName(), that.getName()) &&
+                        isNullOrEmpty(that.getIdentifiers()) &&
+                        isNullOrEmpty(that.getAlias()) &&
+                        that.getRemarks() == null;
             }
         }
         return false;
@@ -212,17 +234,17 @@ public class SimpleIdentifiedObject impl
     public String toString() {
         final String code, codespace;
         final Citation authority;
-        final ReferenceIdentifier id = referenceSystemIdentifier;
-        if (id != null) {
-            code      = id.getCode();
-            codespace = id.getCodeSpace();
-            authority = id.getAuthority();
+        final ReferenceIdentifier name = this.name;
+        if (name != null) {
+            code      = name.getCode();
+            codespace = name.getCodeSpace();
+            authority = name.getAuthority();
         } else {
             code      = null;
             codespace = null;
             authority = null;
         }
-        final StringBuilder buffer = new StringBuilder("OBJECT[\"");
+        final StringBuilder buffer = new StringBuilder("IdentifiedObject[\"");
         if (codespace != null) {
             buffer.append(codespace).append(DefaultNameSpace.DEFAULT_SEPARATOR);
         }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -52,7 +52,7 @@ import org.apache.sis.internal.jdk8.Func
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-3.00)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 public final class CollectionsExt extends Static {
@@ -634,4 +634,21 @@ public final class CollectionsExt extend
         }
         return map;
     }
+
+    /**
+     * Returns {@code true} if the next elements returned by the given iterators are the same.
+     * This method compares using the identity operation ({@code ==}), not {@code equals(Object)}.
+     *
+     * @param  it1 The first iterator.
+     * @param  it2 The second iterator.
+     * @return If both iterators return the same objects.
+     */
+    public static boolean identityEquals(final Iterator<?> it1, final Iterator<?> it2) {
+        while (it1.hasNext()) {
+            if (!it2.hasNext() || it1.next() != it2.next()) {
+                return false;
+            }
+        }
+        return !it2.hasNext();
+    }
 }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -523,9 +523,10 @@ public final class Units extends Static 
      *   </tr>
      * </table>
      *
-     * <b>Note:</b> EPSG uses code 9102 (<cite>degree</cite>) for prime meridian and coordinate operation parameters,
+     * <div class="note"><b>Note:</b>
+     * EPSG uses code 9102 (<cite>degree</cite>) for prime meridian and coordinate operation parameters,
      * and code 9122 (<cite>degree (supplier to define representation)</cite>) for coordinate system axes.
-     * But Apache SIS considers those two codes as synonymous.
+     * But Apache SIS considers those two codes as synonymous.</div>
      *
      * @param  code The EPSG code for a unit of measurement.
      * @return The unit, or {@code null} if the code is unrecognized.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Characters.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -27,7 +27,7 @@ import org.apache.sis.util.resources.Err
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.1)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 public final class Characters extends Static {
@@ -97,6 +97,25 @@ public final class Characters extends St
     }
 
     /**
+     * Returns {@code true} if the given character is an hexadecimal digit.
+     * This method returns {@code true} if {@code c} is between {@code '0'} and {@code '9'} inclusive,
+     * or between {@code 'A'} and {@code 'F'} inclusive, or between {@code 'a'} and {@code 'f'} inclusive.
+     *
+     * @param  c The character to test.
+     * @return {@code true} if the given character is an hexadecimal digit.
+     *
+     * @since 0.5
+     */
+    public static boolean isHexadecimal(int c) {
+        /*
+         * The &= ~32 is a cheap conversion of lower-case letters to upper-case letters.
+         * It is not a rigorous conversion since it does not check if 'c' is a letter,
+         * but for the purpose of this method it is okay.
+         */
+        return (c >= '0' && c <= '9') || ((c &= ~32) >= 'A' && c <= 'F');
+    }
+
+    /**
      * Determines whether the given character is a superscript. Most (but not all) superscripts
      * have a Unicode value in the [2070 … 207F] range. Superscripts are the following symbols:
      *
@@ -115,7 +134,7 @@ public final class Characters extends St
             case '\u2071': // Would be the '¹', '²' and '³' values if they were declared in the
             case '\u2072': // normal range. Since they are not, those values are unassigned.
             case '\u2073': return false;
-            default:       return (c>='⁰' && c<='ⁿ');
+            default:       return (c >= '⁰' && c <= 'ⁿ');
         }
     }
 
@@ -131,7 +150,7 @@ public final class Characters extends St
      * @return {@code true} if the given character is a subscript.
      */
     public static boolean isSubScript(final int c) {
-        return (c>='₀' && c<='₎');
+        return (c >= '₀' && c <= '₎');
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Classes.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Classes.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Classes.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Classes.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -51,7 +51,7 @@ import static org.apache.sis.util.collec
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 public final class Classes extends Static {
@@ -211,6 +211,11 @@ public final class Classes extends Stati
                  * At this point we are not going to continue the loop anymore.
                  * Check if we have an array, then check the (component) class.
                  */
+                if (type instanceof ParameterizedType) {
+                    // Example: replace ParameterDescriptor<?> by ParameterDescriptor
+                    // before we test if (type instanceof Class<?>).
+                    type = ((ParameterizedType) type).getRawType();
+                }
                 int dimension = 0;
                 while (type instanceof GenericArrayType) {
                     type = ((GenericArrayType) type).getGenericComponentType();
@@ -696,7 +701,6 @@ cmp:    for (final Class<?> c : c1) {
      *       {@link Object#hashCode() hashCode}, {@link Object#toString() toString} or
      *       {@link org.opengis.referencing.IdentifiedObject#toWKT() toWKT}.</li>
      *   <li>The method is not {@linkplain Method#isSynthetic() synthetic}.</li>
-     *   <li>The method is not {@linkplain Deprecated deprecated}.</li>
      * </ul>
      *
      * <p>Those conditions may be updated in any future SIS version.</p>
@@ -708,7 +712,6 @@ cmp:    for (final Class<?> c : c1) {
         return method.getReturnType() != Void.TYPE &&
                method.getParameterTypes().length == 0 &&
               !method.isSynthetic() &&
-              !method.isAnnotationPresent(Deprecated.class) &&
               !ArraysExt.contains(EXCLUDES, method.getName());
     }
 }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/UnsupportedImplementationException.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/UnsupportedImplementationException.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/UnsupportedImplementationException.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/UnsupportedImplementationException.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -20,10 +20,10 @@ import org.apache.sis.util.resources.Err
 
 
 /**
- * Thrown when an operation can't use arbitrary implementation of an interface, and
- * a given instance doesn't meet the requirement. For example this exception may be
- * thrown when an operation requires an Apache SIS implementation of a
- * <A HREF="http://www.geoapi.org">GeoAPI</A> interface.
+ * Thrown when an operation can not use arbitrary implementation of an interface,
+ * and a given instance does not meet the requirement. For example this exception
+ * may be thrown when an operation requires an Apache SIS implementation of a
+ * <a href="http://www.geoapi.org">GeoAPI</a> interface.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.0)

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Utilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Utilities.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Utilities.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/Utilities.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -22,6 +22,7 @@ import java.util.Collection;
 import java.util.LinkedList;
 import java.util.Map;
 import java.util.Set;
+import org.apache.sis.util.collection.CheckedContainer;
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk7.Objects;
@@ -229,7 +230,7 @@ public final class Utilities extends Sta
         final Iterator<?> it2 = object2.iterator();
         while (it1.hasNext()) {
             if (!it2.hasNext()) {
-                assert isNotDebug(mode) : "Sizes not equal";
+                assert isNotDebug(mode) : mismatchedElement("Iterable", object1, object2, "size");
                 return false;
             }
             Object element1 = it1.next();
@@ -238,7 +239,7 @@ public final class Utilities extends Sta
                 continue;
             }
             if (!(object1 instanceof Set<?> && object2 instanceof Set<?>)) {
-                assert isNotDebug(mode) : "Lists not equal";
+                assert isNotDebug(mode) : mismatchedElement("Iterable", object1, object2, "element");
                 return false;
             }
             /*
@@ -258,7 +259,7 @@ public final class Utilities extends Sta
             while (true) {
                 final Iterator<?> it = copy.iterator();
                 do if (!it.hasNext()) {
-                    assert isNotDebug(mode) : "Sets not equal";
+                    assert isNotDebug(mode) : mismatchedElement("Set", object1, object2, "element");
                     return false; // An element has not been found.
                 } while (!deepEquals(it.next(), element2, mode));
                 it.remove();
@@ -293,6 +294,20 @@ public final class Utilities extends Sta
     }
 
     /**
+     * Returns an assertion error message for mismatched collections.
+     */
+    private static String mismatchedElement(final String header, final Iterable<?> object1, final Iterable<?> object2, final String tail) {
+        Class<?> type = null;
+        if (object1 instanceof CheckedContainer<?>) {
+            type = ((CheckedContainer<?>) object1).getElementType();
+        }
+        if (type == null && object2 instanceof CheckedContainer<?>) {
+            type = ((CheckedContainer<?>) object2).getElementType();
+        }
+        return header + '<' + (type != null ? type.getSimpleName() : "?") + ">: " + tail + " not equals.";
+    }
+
+    /**
      * Returns a hash code for the specified object, which may be an array.
      * This method returns one of the following values:
      *

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -71,6 +71,7 @@ public class CodeListSet<E extends CodeL
      * A pool of code list arrays. When many {@code CodeListSet} instances are for the
      * same code list type, this allows those instances to share the same arrays.
      */
+    @SuppressWarnings("rawtypes")
     private static final WeakHashSet<CodeList[]> POOL = new WeakHashSet<CodeList[]>(CodeList[].class);
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -94,7 +94,7 @@ import static org.apache.sis.util.Number
  * {@link #newRange(Comparable, Comparable)} method. Subclasses can override that method if they
  * need to customize the range objects to be created.
  *
- * <p>While it is possible to create {@code RangeSet<Date>} instances, is is more efficient to
+ * <p>While it is possible to create {@code RangeSet<Date>} instances, is more efficient to
  * use {@code RangeSet<Long>} with millisecond values because {@code RangeSet} will internally
  * use {@code long[]} arrays in the later case.</p>
  *

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1626345&r1=1626344&r2=1626345&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] Fri Sep 19 21:46:39 2014
@@ -342,6 +342,7 @@ public class TreeTableFormat extends Tab
      * @throws ParseException If an error occurred while parsing a node value.
      */
     @Override
+    @SuppressWarnings("null")
     public TreeTable parse(final CharSequence text, final ParsePosition pos) throws ParseException {
         final Matcher matcher   = getColumnSeparatorMatcher(text);
         final int length        = text.length();



Mime
View raw message