sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1627546 [3/3] - in /sis/branches/JDK6: ./ core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/ core/sis-build-helper/src/main/javadoc/ core/sis-feature/src/test/java/org/apache/sis/feature/ core/sis-metadata/src/main/java/or...
Date Thu, 25 Sep 2014 13:59:58 GMT
Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -47,6 +47,7 @@ import org.apache.sis.referencing.crs.De
 import org.apache.sis.referencing.crs.DefaultCompoundCRS;
 import org.apache.sis.metadata.iso.extent.Extents;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.Static;
@@ -79,7 +80,7 @@ import static org.apache.sis.util.Argume
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.1)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 public final class CRS extends Static {
@@ -156,42 +157,21 @@ public final class CRS extends Static {
             throw new NoSuchIdentifierException(Errors.format(Errors.Keys.MissingAuthority_1, code), code);
         }
         /*
-         * Code below this point is a temporary implementation to
-         * be removed after we ported the EPSG authority factory.
+         * Delegate to the factory for the code space of the given code. If no authority factory
+         * is available, or if the factory failed to create the CRS, delegate to CommonCRS. Note
+         * that CommonCRS is not expected to succeed if the real EPSG factory threw an exception,
+         * so we will log a message at the warning level in such case.
          */
-        NumberFormatException cause = null;
-        try {
-            if (authority.equalsIgnoreCase("CRS")) {
-                switch (Integer.parseInt(value)) {
-                    case 27: return CommonCRS.NAD27.normalizedGeographic();
-                    case 83: return CommonCRS.NAD83.normalizedGeographic();
-                    case 84: return CommonCRS.WGS84.normalizedGeographic();
-                }
-            } else if (authority.equalsIgnoreCase("EPSG")) {
-                final int n = Integer.parseInt(value);
-                if (n != 0) { // CommonCRS uses 0 as a sentinel value for "no EPSG code".
-                    for (final CommonCRS candidate : CommonCRS.values()) {
-                        if (candidate.geographic == n) return candidate.geographic();
-                        if (candidate.geocentric == n) return candidate.geocentric();
-                        if (candidate.geo3D      == n) return candidate.geographic3D();
-                    }
-                    for (final CommonCRS.Vertical candidate : CommonCRS.Vertical.values()) {
-                        if (candidate.isEPSG && candidate.crs == n) {
-                            return candidate.crs();
-                        }
-                    }
-                }
-            } else {
-                throw new NoSuchIdentifierException(Errors.format(Errors.Keys.UnknownAuthority_1, authority), authority);
-            }
-        } catch (NumberFormatException e) {
-            cause = e;
+        CRSAuthorityFactory factory = null; // TODO
+        if (factory != null) try {
+            return factory.createCoordinateReferenceSystem(value);
+        } catch (FactoryException failure) {
+            final CoordinateReferenceSystem crs = CommonCRS.forCode(authority, value, failure);
+            Logging.unexpectedException(CRS.class, "forCode", failure); // See above comment.
+            return crs;
+        } else {
+            return CommonCRS.forCode(authority, value, null);
         }
-        final NoSuchAuthorityCodeException e = new NoSuchAuthorityCodeException(
-                Errors.format(Errors.Keys.NoSuchAuthorityCode_3, authority, CoordinateReferenceSystem.class, value),
-                authority, value, code);
-        e.initCause(cause);
-        throw e;
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -24,12 +24,15 @@ import javax.measure.unit.Unit;
 import javax.measure.quantity.Duration;
 import org.opengis.util.FactoryException;
 import org.opengis.util.InternationalString;
+import org.opengis.util.NoSuchIdentifierException;
+import org.opengis.referencing.NoSuchAuthorityCodeException;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.crs.GeodeticCRS;
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.referencing.crs.TemporalCRS;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.crs.GeocentricCRS;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.cs.TimeCS;
 import org.opengis.referencing.cs.VerticalCS;
 import org.opengis.referencing.cs.CartesianCS;
@@ -56,11 +59,17 @@ import org.apache.sis.referencing.crs.De
 import org.apache.sis.internal.system.SystemListener;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.measure.Units;
 
 import static java.util.Collections.singletonMap;
 import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
+import static org.apache.sis.internal.referencing.HardCoded.CRS;
+import static org.apache.sis.internal.referencing.HardCoded.EPSG;
+import static org.apache.sis.internal.referencing.HardCoded.CRS27;
+import static org.apache.sis.internal.referencing.HardCoded.CRS83;
+import static org.apache.sis.internal.referencing.HardCoded.CRS84;
 
 
 /**
@@ -105,7 +114,7 @@ import static org.opengis.referencing.Id
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.5
  * @module
  */
 public enum CommonCRS {
@@ -1338,4 +1347,60 @@ public enum CommonCRS {
     static void failure(final Object caller, final String method, final FactoryException e) {
         Logging.unexpectedException(caller.getClass(), method, e);
     }
+
+    /**
+     * Returns a coordinate reference system for the given authority code.
+     * This method is invoked as a fallback when {@link CRS#forCode(String)}
+     * can not create a CRS for a given code.
+     *
+     * @param authority The authority, either {@code "CRS"} or {@code "EPSG"} (case-insensitive).
+     * @param code      The code, to be parsed as an integer.
+     * @param failure   The exception to throw in case of failure, or {@code null} for creating our own.
+     *                  A non-null value is provided when a real EPSG factory exists but failed to create the CRS.
+     *                  In such case, we want to report the error from the real factory instead than from this fallback.
+     *
+     * @since 0.5
+     */
+    static CoordinateReferenceSystem forCode(final String authority, final String code, final FactoryException failure)
+            throws FactoryException
+    {
+        NumberFormatException cause = null;
+        try {
+            if (authority.equalsIgnoreCase(CRS)) {
+                switch (Integer.parseInt(code)) {
+                    case CRS27: return CommonCRS.NAD27.normalizedGeographic();
+                    case CRS83: return CommonCRS.NAD83.normalizedGeographic();
+                    case CRS84: return CommonCRS.WGS84.normalizedGeographic();
+                }
+            } else if (authority.equalsIgnoreCase(EPSG)) {
+                final int n = Integer.parseInt(code);
+                if (n != 0) { // CommonCRS uses 0 as a sentinel value for "no EPSG code".
+                    for (final CommonCRS candidate : CommonCRS.values()) {
+                        if (candidate.geographic == n) return candidate.geographic();
+                        if (candidate.geocentric == n) return candidate.geocentric();
+                        if (candidate.geo3D      == n) return candidate.geographic3D();
+                    }
+                    for (final CommonCRS.Vertical candidate : CommonCRS.Vertical.values()) {
+                        if (candidate.isEPSG && candidate.crs == n) {
+                            return candidate.crs();
+                        }
+                    }
+                }
+            } else if (failure != null) {
+                throw failure;
+            } else {
+                throw new NoSuchIdentifierException(Errors.format(Errors.Keys.UnknownAuthority_1, authority), authority);
+            }
+        } catch (NumberFormatException e) {
+            cause = e;
+        }
+        if (failure != null) {
+            throw failure;
+        }
+        final NoSuchAuthorityCodeException e = new NoSuchAuthorityCodeException(
+                Errors.format(Errors.Keys.NoSuchAuthorityCode_3, authority, CoordinateReferenceSystem.class, code),
+                authority, code, code);
+        e.initCause(cause);
+        throw e;
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -17,15 +17,28 @@
 package org.apache.sis.referencing.crs;
 
 import java.util.Map;
+import java.util.HashMap;
+import java.util.Arrays;
 import javax.xml.bind.annotation.XmlTransient;
-import org.opengis.referencing.cs.CoordinateSystem;
-import org.opengis.referencing.cs.EllipsoidalCS;
+import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.metadata.iso.ImmutableIdentifier;
+import org.opengis.referencing.ReferenceIdentifier;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.crs.GeographicCRS;
+import org.opengis.referencing.cs.EllipsoidalCS;
+import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.referencing.AbstractReferenceSystem;
 import org.apache.sis.io.wkt.Formatter;
 
+import org.apache.sis.measure.Longitude;
+import static org.apache.sis.internal.referencing.HardCoded.CRS;
+import static org.apache.sis.internal.referencing.HardCoded.EPSG;
+import static org.apache.sis.internal.referencing.HardCoded.CRS27;
+import static org.apache.sis.internal.referencing.HardCoded.CRS83;
+import static org.apache.sis.internal.referencing.HardCoded.CRS84;
+
 
 /**
  * A coordinate reference system based on an ellipsoidal approximation of the geoid.
@@ -43,12 +56,22 @@ import org.apache.sis.io.wkt.Formatter;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-1.2)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @XmlTransient
 public class DefaultGeographicCRS extends DefaultGeodeticCRS implements GeographicCRS {
     /**
+     * Some codes in the EPSG namespace, in ascending order.
+     */
+    private static final short[] EPSG_CODES = {4267, 4269, 4326};
+
+    /**
+     * Codes in the CRS namespace for each code listed in the {@link #EPSG} list.
+     */
+    private static final byte[] CRS_CODES = {CRS27, CRS83, CRS84};
+
+    /**
      * Serial number for inter-operability with different versions.
      */
     private static final long serialVersionUID = 861224913438092335L;
@@ -196,9 +219,32 @@ public class DefaultGeographicCRS extend
 
     /**
      * Returns a coordinate reference system of the same type than this CRS but with different axes.
+     *
+     * {@section Special case}
+     * If the first axis is the longitude in the [-180 … +180]° range and the identifier is EPSG:4267,
+     * EPSG:4269 or EPSG:4326, then this method magically add the CRS:27, CRS:83 or CRS:84 identifier.
+     * Without this special case, the normal behavior would be no identifier. The expected behavior is
+     * that {@code CommonCRS.WGS84.normalizedGeographic()} returns a CRS having the "CRS:84" identifier.
      */
     @Override
-    final AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem cs) {
+    final AbstractCRS createSameType(Map<String,?> properties, final CoordinateSystem cs) {
+        final CoordinateSystemAxis axis = cs.getAxis(0);
+        if (axis.getMinimumValue() == Longitude.MIN_VALUE &&
+            axis.getMaximumValue() == Longitude.MAX_VALUE) // For excluding the AxesConvention.POSITIVE_RANGE case.
+        {
+            for (final ReferenceIdentifier identifier : super.getIdentifiers()) {
+                if (EPSG.equals(identifier.getCodeSpace())) try {
+                    final int i = Arrays.binarySearch(EPSG_CODES, Short.parseShort(identifier.getCode()));
+                    if (i >= 0) {
+                        final Map<String,Object> c = new HashMap<String,Object>(properties);
+                        c.put(IDENTIFIERS_KEY, new ImmutableIdentifier(Citations.OGC, CRS, Short.toString(CRS_CODES[i])));
+                        properties = c;
+                    }
+                } catch (NumberFormatException e) {
+                    // Okay to igore, because it is not the purpose of this method to disallow non-numeric codes.
+                }
+            }
+        }
         return new DefaultGeographicCRS(properties, super.getDatum(), (EllipsoidalCS) cs);
     }
 

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java Thu Sep 25 13:59:56 2014
@@ -29,8 +29,8 @@ import org.opengis.referencing.datum.Tem
 import org.apache.sis.internal.jaxb.gml.UniversalTimeAdapter;
 import org.apache.sis.internal.metadata.MetadataUtilities;
 import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.io.wkt.Formatter;
+import org.apache.sis.io.wkt.FormattableObject;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.internal.metadata.MetadataUtilities.canSetProperty;
@@ -72,7 +72,7 @@ import org.apache.sis.internal.jdk7.Obje
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-1.2)
- * @version 0.4
+ * @version 0.5
  * @module
  *
  * @see org.apache.sis.referencing.CommonCRS.Temporal#datum()
@@ -287,12 +287,30 @@ public class DefaultTemporalDatum extend
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
-        final Convention convention = formatter.getConvention();
-        if (convention == Convention.INTERNAL) {
-            formatter.append(MetadataUtilities.toDate(origin)); // This is an extension compared to ISO 19162.
-        } else if (convention.majorVersion() == 1) {
+        formatter.append(new Origin(MetadataUtilities.toDate(origin)));
+        if (formatter.getConvention().majorVersion() == 1) {
             formatter.setInvalidWKT(this, null);
         }
         return "TimeDatum";
     }
+
+    /**
+     * The {@code TIMEORIGIN[…]} element inside an {@code TDATUM[…]}.
+     */
+    private static final class Origin extends FormattableObject {
+        /** The value of the origin to format. */
+        private final Date origin;
+
+        /** Creates a new time origin with the given value. */
+        Origin(final Date origin) {
+            this.origin = origin;
+        }
+
+        /** Formats the time origin. */
+        @Override
+        protected String formatTo(final Formatter formatter) {
+            formatter.append(origin);
+            return "TimeOrigin";
+        }
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -19,6 +19,7 @@ package org.apache.sis.parameter;
 import java.util.Map;
 import java.util.List;
 import java.util.HashMap;
+import org.opengis.parameter.ParameterDirection;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.parameter.ParameterNotFoundException;
 import org.apache.sis.test.DependsOn;
@@ -37,7 +38,7 @@ import static org.opengis.referencing.Id
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Johann Sorel (Geomatys)
  * @since   0.4 (derived from geotk-2.1)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn(DefaultParameterDescriptorTest.class)
@@ -95,6 +96,7 @@ public final strictfp class DefaultParam
      */
     @Test
     public void validateTestObjects() {
+        assertEquals(ParameterDirection.IN, M1_M1_O1_O2.getDirection());
         for (final GeneralParameterDescriptor descriptor : M1_M1_O1_O2.descriptors()) {
             AssertionError error = null;
             try {

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -51,6 +51,8 @@ public final strictfp class CRSTest exte
      * Tests {@link CRS#forCode(String)} with EPSG codes.
      *
      * @throws FactoryException If a CRS can not be constructed.
+     *
+     * @see CommonCRSTest#testForCode()
      */
     @Test
     public void testForEpsgCode() throws FactoryException {
@@ -77,6 +79,8 @@ public final strictfp class CRSTest exte
      * Tests {@link CRS#forCode(String)} with CRS codes.
      *
      * @throws FactoryException If a CRS can not be constructed.
+     *
+     * @see CommonCRSTest#testForCode()
      */
     @Test
     @DependsOnMethod("testForEpsgCode")

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -18,6 +18,8 @@ package org.apache.sis.referencing;
 
 import java.util.Date;
 import org.opengis.test.Validators;
+import org.opengis.util.FactoryException;
+import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.referencing.crs.TemporalCRS;
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.referencing.crs.GeographicCRS;
@@ -43,7 +45,7 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-2.2)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn({
@@ -196,4 +198,43 @@ public final strictfp class CommonCRSTes
             assertEquals(name, days, origin.getTime() / DAY_LENGTH - julianEpoch, 0);
         }
     }
+
+    /**
+     * Tests {@link CommonCRS#forCode(String, String, FactoryException)}.
+     *
+     * @throws FactoryException If a CRS can not be constructed.
+     *
+     * @see CRSTest#testForEpsgCode()
+     * @see CRSTest#testForCrsCode()
+     *
+     * @since 0.5
+     */
+    @Test
+    public void testForCode() throws FactoryException {
+        verifyForCode(CommonCRS.WGS84 .geographic(),            "EPSG", "4326");
+        verifyForCode(CommonCRS.WGS72 .geographic(),            "EPSG", "4322");
+        verifyForCode(CommonCRS.SPHERE.geographic(),            "EPSG", "4047");
+        verifyForCode(CommonCRS.NAD83 .geographic(),            "EPSG", "4269");
+        verifyForCode(CommonCRS.NAD27 .geographic(),            "EPSG", "4267");
+        verifyForCode(CommonCRS.ETRS89.geographic(),            "EPSG", "4258");
+        verifyForCode(CommonCRS.ED50  .geographic(),            "EPSG", "4230");
+        verifyForCode(CommonCRS.WGS84 .geocentric(),            "EPSG", "4978");
+        verifyForCode(CommonCRS.WGS72 .geocentric(),            "EPSG", "4984");
+        verifyForCode(CommonCRS.ETRS89.geocentric(),            "EPSG", "4936");
+        verifyForCode(CommonCRS.WGS84 .geographic3D(),          "EPSG", "4979");
+        verifyForCode(CommonCRS.WGS72 .geographic3D(),          "EPSG", "4985");
+        verifyForCode(CommonCRS.ETRS89.geographic3D(),          "EPSG", "4937");
+        verifyForCode(CommonCRS.Vertical.MEAN_SEA_LEVEL.crs(),  "EPSG", "5714");
+        verifyForCode(CommonCRS.Vertical.DEPTH.crs(),           "EPSG", "5715");
+        verifyForCode(CommonCRS.WGS84.normalizedGeographic(),   "CRS",  "84");
+        verifyForCode(CommonCRS.NAD83.normalizedGeographic(),   "CRS",  "83");
+        verifyForCode(CommonCRS.NAD27.normalizedGeographic(),   "CRS",  "27");
+    }
+
+    /**
+     * Asserts that the result of {@link CommonCRS#forCode(String, String, FactoryException)} is the given CRS.
+     */
+    private static void verifyForCode(final SingleCRS expected, final String authority, final String code) throws FactoryException {
+        assertSame(code, expected, CommonCRS.forCode(authority, code, null));
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -162,7 +162,7 @@ public final strictfp class DefaultCompo
                 "    UNIT[“metre”, 1],\n" +
                 "    AXIS[“Gravity-related height”, UP]],\n" +
                 "  TIMECRS[“Time”,\n" +
-                "    TIMEDATUM[“UNIX”],\n" +
+                "    TIMEDATUM[“Modified Julian”, TIMEORIGIN[1858-11-17T00:00:00.0Z]],\n" +
                 "    UNIT[“day”, 86400],\n" +
                 "    AXIS[“Time”, FUTURE]]]",
                 HardCodedCRS.GEOID_4D);
@@ -190,7 +190,7 @@ public final strictfp class DefaultCompo
                 "      Axis[“Gravity-related height (H)”, up],\n" +
                 "      LengthUnit[“metre”, 1]],\n" +
                 "  TimeCRS[“Time”,\n" +
-                "    TimeDatum[“UNIX”],\n" +
+                "    TimeDatum[“Modified Julian”, TimeOrigin[1858-11-17T00:00:00.0Z]],\n" +
                 "    CS[“temporal”, 1],\n" +
                 "      Axis[“Time (t)”, future],\n" +
                 "      TimeUnit[“day”, 86400]],\n" +

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -19,6 +19,8 @@ package org.apache.sis.referencing.crs;
 import org.opengis.test.Validators;
 import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.crs.GeographicCRS;
+import org.opengis.referencing.ReferenceIdentifier;
 import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.io.wkt.Convention;
@@ -28,6 +30,7 @@ import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.MetadataAssert.*;
+import static org.apache.sis.test.TestUtilities.getSingleton;
 
 
 /**
@@ -87,6 +90,51 @@ public final strictfp class DefaultGeogr
     }
 
     /**
+     * Verifies the {@link CommonCRS#WGS84} identifiers in both normalized and unnormalized CRS.
+     * The intend is actually to test the replacement of {@code "EPSG:4326"} by {@code "CRS:84"}.
+     */
+    @Test
+    public void testIdentifiers() {
+        GeographicCRS crs = CommonCRS.WGS72.geographic();
+        ReferenceIdentifier identifier = getSingleton(crs.getIdentifiers());
+        assertEquals("codespace", "EPSG", identifier.getCodeSpace());
+        assertEquals("code",      "4322", identifier.getCode());
+
+        crs = CommonCRS.WGS72.normalizedGeographic();
+        assertTrue(crs.getIdentifiers().isEmpty());
+
+        crs = CommonCRS.WGS84.geographic();
+        identifier = getSingleton(crs.getIdentifiers());
+        assertEquals("codespace", "EPSG", identifier.getCodeSpace());
+        assertEquals("code",      "4326", identifier.getCode());
+
+        crs = CommonCRS.WGS84.normalizedGeographic();
+        identifier = getSingleton(crs.getIdentifiers());
+        assertEquals("codespace", "CRS", identifier.getCodeSpace());
+        assertEquals("code",      "84",  identifier.getCode());
+
+        crs = CommonCRS.NAD83.geographic();
+        identifier = getSingleton(crs.getIdentifiers());
+        assertEquals("codespace", "EPSG", identifier.getCodeSpace());
+        assertEquals("code",      "4269", identifier.getCode());
+
+        crs = CommonCRS.NAD83.normalizedGeographic();
+        identifier = getSingleton(crs.getIdentifiers());
+        assertEquals("codespace", "CRS", identifier.getCodeSpace());
+        assertEquals("code",      "83",  identifier.getCode());
+
+        crs = CommonCRS.NAD27.geographic();
+        identifier = getSingleton(crs.getIdentifiers());
+        assertEquals("codespace", "EPSG", identifier.getCodeSpace());
+        assertEquals("code",      "4267", identifier.getCode());
+
+        crs = CommonCRS.NAD27.normalizedGeographic();
+        identifier = getSingleton(crs.getIdentifiers());
+        assertEquals("codespace", "CRS", identifier.getCodeSpace());
+        assertEquals("code",      "27",  identifier.getCode());
+    }
+
+    /**
      * Tests WKT 1 formatting.
      */
     @Test

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -137,10 +137,10 @@ public final strictfp class HardCodedCRS
             getProperties(HardCodedCS.DEPTH), HardCodedDatum.MEAN_SEA_LEVEL, HardCodedCS.DEPTH);
 
     /**
-     * A temporal coordinate reference system for time in days elapsed since the Unix epoch.
+     * A temporal coordinate reference system for time in days elapsed since November 17, 1858 at 00:00 UTC.
      */
     public static final DefaultTemporalCRS TIME = new DefaultTemporalCRS(
-            getProperties(HardCodedCS.DAYS), HardCodedDatum.UNIX, HardCodedCS.DAYS);
+            getProperties(HardCodedCS.DAYS), HardCodedDatum.MODIFIED_JULIAN, HardCodedCS.DAYS);
 
     /**
      * A (λ,φ,h,t) CRS where <var>h</var> is the {@link #GRAVITY_RELATED_HEIGHT}.

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -20,6 +20,7 @@ import java.util.Date;
 import java.util.Map;
 import java.util.HashMap;
 import javax.xml.bind.JAXBException;
+import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.metadata.iso.citation.HardCodedCitations;
 import org.apache.sis.test.XMLTestCase;
@@ -34,7 +35,7 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.5
  * @module
  */
 public final strictfp class DefaultTemporalDatumTest extends XMLTestCase {
@@ -49,12 +50,9 @@ public final strictfp class DefaultTempo
     private static final long ORIGIN = -40587 * (24*60*60*1000L);
 
     /**
-     * Tests XML marshalling.
-     *
-     * @throws JAXBException If an error occurred during marshalling.
+     * Creates the temporal datum to use for testing purpose.
      */
-    @Test
-    public void testMarshalling() throws JAXBException {
+    private static DefaultTemporalDatum create() {
         final Map<String,Object> properties = new HashMap<String,Object>(4);
         assertNull(properties.put(DefaultTemporalDatum.IDENTIFIERS_KEY,
                 new ImmutableIdentifier(HardCodedCitations.SIS, "SIS", "MJ")));
@@ -62,8 +60,39 @@ public final strictfp class DefaultTempo
         assertNull(properties.put(DefaultTemporalDatum.SCOPE_KEY, "History."));
         assertNull(properties.put(DefaultTemporalDatum.REMARKS_KEY,
                 "Time measured as days since November 17, 1858 at 00:00 UTC."));
+        return new DefaultTemporalDatum(properties, new Date(ORIGIN));
+    }
 
-        final DefaultTemporalDatum datum = new DefaultTemporalDatum(properties, new Date(ORIGIN));
+    /**
+     * Tests the consistency of our test with {@link HardCodedDatum#MODIFIED_JULIAN}.
+     *
+     * @since 0.5
+     */
+    @Test
+    public void testConsistency() {
+        assertEquals(HardCodedDatum.MODIFIED_JULIAN.getOrigin(), new Date(ORIGIN));
+    }
+
+    /**
+     * Tests {@link DefaultTemporalDatum#toWKT()}.
+     *
+     * @since 0.5
+     */
+    @Test
+    public void testToWKT() {
+        final DefaultTemporalDatum datum = create();
+        assertWktEquals(Convention.WKT1, "TIMEDATUM[“Modified Julian”, TIMEORIGIN[1858-11-17T00:00:00.0Z], AUTHORITY[“SIS”, “MJ”]]", datum);
+        assertWktEquals(Convention.WKT2, "TimeDatum[“Modified Julian”, TimeOrigin[1858-11-17T00:00:00.0Z], Id[“SIS”, “MJ”]]", datum);
+    }
+
+    /**
+     * Tests XML marshalling.
+     *
+     * @throws JAXBException If an error occurred during marshalling.
+     */
+    @Test
+    public void testMarshalling() throws JAXBException {
+        final DefaultTemporalDatum datum = create();
         assertMarshalEqualsFile(XML_FILE, datum, "xlmns:*", "xsi:schemaLocation");
     }
 

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -90,6 +90,12 @@ public final strictfp class HardCodedDat
             properties("UNIX", null), new Date(0));
 
     /**
+     * Default datum for time measured since November 17, 1858 at 00:00 UTC.
+     */
+    public static final DefaultTemporalDatum MODIFIED_JULIAN = new DefaultTemporalDatum(
+            properties("Modified Julian", null), new Date(-40587 * (24*60*60*1000L)));
+
+    /**
      * Image with {@link PixelInCell#CELL_CENTER}.
      */
     public static final DefaultImageDatum IMAGE = new DefaultImageDatum(

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -93,6 +93,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.crs.DefaultGeocentricCRSTest.class,
     org.apache.sis.referencing.crs.DefaultGeographicCRSTest.class,
     org.apache.sis.referencing.crs.DefaultVerticalCRSTest.class,
+    org.apache.sis.referencing.crs.DefaultTemporalCRSTest.class,
     org.apache.sis.referencing.crs.SubTypesTest.class,
     org.apache.sis.referencing.crs.DefaultCompoundCRSTest.class,
     org.apache.sis.referencing.crs.HardCodedCRSTest.class,

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -72,9 +72,18 @@ public abstract class CodeListAdapter<Va
 
     /**
      * Wraps the proxy value into an adapter.
+     * Most implementations will be like below:
+     *
+     * {@preformat java
+     *     return new ValueType(proxy);
+     * }
+     *
+     * However is some cases, the {@code proxy} argument may be inspected.
+     * For example {@link org.apache.sis.internal.jaxb.code.MD_RestrictionCode}
+     * replaces {@code "licence"} by {@code "license"} for ISO 19115:2003 compatibility.
      *
      * @param proxy The proxy version of {@link CodeList}, to be marshalled.
-     * @return The adapter that wraps the proxy value.
+     * @return The wrapper for the code list value.
      */
     protected abstract ValueType wrap(final CodeListProxy proxy);
 
@@ -112,8 +121,15 @@ public abstract class CodeListAdapter<Va
         if (value == null) {
             return null;
         }
-        return wrap(isEnum() ? new CodeListProxy(Types.getCodeName(value))
-                             : new CodeListProxy(Context.current(), value));
+        final CodeListProxy p;
+        if (isEnum()) {
+            // To be removed after GEO-199 resolution.
+            p = new CodeListProxy();
+            p.value = Types.getCodeName(value);
+        } else {
+            p = new CodeListProxy(Context.current(), value);
+        }
+        return wrap(p);
     }
 
     /**
@@ -121,6 +137,11 @@ public abstract class CodeListAdapter<Va
      * returns {@code false} in every cases, since there is very few enums in ISO 19115.
      *
      * @return {@code true} if this code list is actually an enum.
+     *
+     * @todo Remove this method after we refactored enum wrappers as {@link EnumAdapter} subclasses
+     *       instead of {@code CodeListAdapter}. This requires the resolution of GEO-199 first.
+     *
+     * @see <a href="http://jira.codehaus.org/browse/GEO-199">GEO-199</a>
      */
     protected boolean isEnum() {
         return false;

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -103,20 +103,6 @@ public final class CodeListProxy {
     }
 
     /**
-     * Creates a new code list for the given enum.
-     *
-     * @param value The ISO 19115 identifier of the enum.
-     *
-     * @todo Replace the argument type by {@link Enum} if we fix the type of ISO 19115
-     *       code lists which are supposed to be enum.
-     *
-     * @see <a href="http://jira.codehaus.org/browse/GEO-199">GEO-199</a>
-     */
-    CodeListProxy(final String value) {
-        this.value = value;
-    }
-
-    /**
      * Builds a code list with the given attributes.
      *
      * @param context       The current (un)marshalling context, or {@code null} if none.

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -21,6 +21,7 @@ import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.Locale;
 import java.util.TimeZone;
+import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicReference;
 import javax.xml.bind.DatatypeConverter;
 
@@ -61,6 +62,45 @@ public final class JDK8 {
     }
 
     /**
+     * Atomically computes and stores the value for the given key. This is a substitute for
+     * {@link ConcurrentMap#compute(java.lang.Object, java.util.function.BiFunction)}
+     * on pre-JDK8 branches.
+     *
+     * @param  <K> The type of keys.
+     * @param  <V> The type of values.
+     * @param  map The map where to store the value.
+     * @param  key The key for the value to compute and store.
+     * @param  remappingFunction The function for computing the value.
+     * @return The new value computed by the given function.
+     *
+     * @since 0.5
+     */
+    public static <K,V> V compute(final ConcurrentMap<K,V> map, final K key,
+            BiFunction<? super K, ? super V, ? extends V> remappingFunction)
+    {
+        V newValue;
+        boolean success;
+        do {
+            final V oldValue = map.get(key);
+            newValue = remappingFunction.apply(key, oldValue);
+            if (newValue != null) {
+                if (oldValue != null) {
+                    success = map.replace(key, oldValue, newValue);
+                } else {
+                    success = (map.putIfAbsent(key, newValue) == null);
+                }
+            } else {
+                if (oldValue != null) {
+                    success = map.remove(key, oldValue);
+                } else {
+                    return null;
+                }
+            }
+        } while (!success);
+        return newValue;
+    }
+
+    /**
      * Parses a date from a string in ISO 8601 format. More specifically, this method expects the
      * format defined by <cite>XML Schema Part 2: Datatypes for {@code xsd:dateTime}</cite>.
      *

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -95,6 +95,17 @@ public final class CollectionsExt extend
     }
 
     /**
+     * Returns the given value as a singleton if non-null, or returns an empty set otherwise.
+     *
+     * @param  <E> The element type.
+     * @param  element The element to returns in a collection if non-null.
+     * @return A collection containing the given element if non-null, or an empty collection otherwise.
+     */
+    public static <E> Set<E> singletonOrEmpty(final E element) {
+        return (element != null) ? Collections.singleton(element) : Collections.<E>emptySet();
+    }
+
+    /**
      * Returns the given array if non-empty, or {@code null} if the given array is null or empty.
      * This method is generally not recommended, since public API should prefer empty array instead of null.
      * However this method is occasionally useful for managing private fields.

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/setup/About.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -352,6 +352,7 @@ fill:   for (int i=0; ; i++) {
             if (name == null) {
                 name = resources.getString(nameKey);
             }
+            @SuppressWarnings("null")
             final TreeTable.Node node = section.newChild();
             node.setValue(NAME, name);
             if (children != null) {

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -79,7 +79,6 @@ import static org.apache.sis.internal.jd
  * @module
  *
  * @see StringBuilders
- * @see java.util.Arrays#toString(Object[])
  */
 public final class CharSequences extends Static {
     /**
@@ -610,6 +609,25 @@ search:     for (; fromIndex <= toIndex;
     }
 
     /**
+     * Allocates the array to be returned by the {@code split(…)} methods. If the given {@code text} argument is
+     * an instance of {@link String}, {@link StringBuilder} or {@link StringBuffer},  then this method returns a
+     * {@code String[]} array instead than {@code CharSequence[]}. This is possible because the specification of
+     * their {@link CharSequence#subSequence(int, int)} method guarantees to return {@code String} instances.
+     * Some Apache SIS code will cast the {@code split(…)} return value based on this knowledge.
+     *
+     * <p>Note that this is a undocumented SIS features. There is currently no commitment that this implementation
+     * details will not change in future version.</p>
+     *
+     * @param  text The text to be splitted.
+     * @return An array where to store the result of splitting the given {@code text}.
+     */
+    private static CharSequence[] createSplitArray(final CharSequence text) {
+        return (text instanceof String ||
+                text instanceof StringBuilder ||
+                text instanceof StringBuffer) ? new String[8] : new CharSequence[8];
+    }
+
+    /**
      * Splits a text around the given character. The array returned by this method contains all
      * subsequences of the given text that is terminated by the given character or is terminated
      * by the end of the text. The subsequences in the array are in the order in which they occur
@@ -640,37 +658,37 @@ search:     for (; fromIndex <= toIndex;
             return EMPTY_ARRAY;
         }
         if (separator == '\n' || separator == '\r') {
-            final CharSequence[] strings = splitOnEOL(text);
-            for (int i=0; i<strings.length; i++) {
+            final CharSequence[] splitted = splitOnEOL(text);
+            for (int i=0; i<splitted.length; i++) {
                 // For consistency with the rest of this method.
-                strings[i] = trimWhitespaces(strings[i]);
+                splitted[i] = trimWhitespaces(splitted[i]);
             }
-            return strings;
+            return splitted;
         }
         // 'excludeEmpty' must use the same criterion than trimWhitespaces(…).
         final boolean excludeEmpty = isWhitespace(separator);
-        CharSequence[] strings = (text instanceof String) ? new String[4] : new CharSequence[4];
+        CharSequence[] splitted = createSplitArray(text);
         final int length = text.length();
         int count = 0, last  = 0, i = 0;
         while ((i = indexOf(text, separator, i, length)) >= 0) {
             final CharSequence item = trimWhitespaces(text, last, i);
             if (!excludeEmpty || item.length() != 0) {
-                if (count == strings.length) {
-                    strings = Arrays.copyOf(strings, count << 1);
+                if (count == splitted.length) {
+                    splitted = Arrays.copyOf(splitted, count << 1);
                 }
-                strings[count++] = item;
+                splitted[count++] = item;
             }
             last = ++i;
         }
         // Add the last element.
         final CharSequence item = trimWhitespaces(text, last, length);
         if (!excludeEmpty || item.length() != 0) {
-            if (count == strings.length) {
-                strings = Arrays.copyOf(strings, count + 1);
+            if (count == splitted.length) {
+                splitted = Arrays.copyOf(splitted, count + 1);
             }
-            strings[count++] = item;
+            splitted[count++] = item;
         }
-        return ArraysExt.resize(strings, count);
+        return ArraysExt.resize(splitted, count);
     }
 
     /**
@@ -718,7 +736,7 @@ search:     for (; fromIndex <= toIndex;
             };
         }
         int count = 0;
-        CharSequence[] splitted = new CharSequence[8];
+        CharSequence[] splitted = createSplitArray(text);
         int last = 0;
         boolean hasMore;
         do {
@@ -919,7 +937,13 @@ search:     for (; fromIndex <= toIndex;
      * @param  separator  The element separator, which is usually {@code ", "}.
      * @return The (typically) comma-separated list, or {@code null} if the given {@code collection}
      *         was null or contains only null elements.
+     *
+     * @see java.util.StringJoiner
+     * @see java.util.Arrays#toString(Object[])
+     *
+     * @deprecated As of JDK8, use {@code java.util.StringJoiner} instead.
      */
+    @Deprecated
     public static String toString(final Iterable<?> collection, final String separator) {
         ArgumentChecks.ensureNonNull("separator", separator);
         String list = null;

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -101,8 +101,9 @@ import static org.apache.sis.util.Number
  * @param <E> The type of range elements.
  *
  * @author  Martin Desruisseaux (Geomatys)
+ * @author  Rémi Maréchal (Geomatys)
  * @since   0.3 (derived from geotk-2.0)
- * @version 0.3
+ * @version 0.5
  * @module
  *
  * @see Range
@@ -248,7 +249,7 @@ public class RangeSet<E extends Comparab
      * The amount of modifications applied on the range {@linkplain #array}.
      * Used for checking concurrent modifications.
      */
-    private transient int modCount;
+     private transient int modCount;
 
     /**
      * Constructs an initially empty set of ranges.
@@ -407,6 +408,9 @@ public class RangeSet<E extends Comparab
      */
     @SuppressWarnings("unchecked")
     private boolean isSorted() {
+        if (array == null) {
+            return true;
+        }
         final boolean strict = isMinIncluded | isMaxIncluded;
         switch (elementCode) {
             case DOUBLE:    return ArraysExt.isSorted((double[]) array, strict);
@@ -438,7 +442,7 @@ public class RangeSet<E extends Comparab
             case SHORT:     return Arrays.binarySearch((short []) array, lower, upper, ((Short)     ((Comparable) value)).shortValue ());
             case BYTE:      return Arrays.binarySearch((byte  []) array, lower, upper, ((Byte)      ((Comparable) value)).byteValue  ());
             case CHARACTER: return Arrays.binarySearch((char  []) array, lower, upper, ((Character) ((Comparable) value)).charValue  ());
-            default:        return Arrays.binarySearch((Object[]) array, lower, upper,              value);
+            default:        return Arrays.binarySearch((Object[]) array, lower, upper,             value);
         }
     }
 
@@ -639,7 +643,119 @@ public class RangeSet<E extends Comparab
      * @throws IllegalArgumentException if {@code minValue} is greater than {@code maxValue}.
      */
     public boolean remove(final E minValue, final E maxValue) throws IllegalArgumentException {
-        throw new UnsupportedOperationException("Not yet implemented");
+        ArgumentChecks.ensureNonNull("minValue", minValue);
+        ArgumentChecks.ensureNonNull("maxValue", maxValue);
+        if (length == 0) return false; // Nothing to do if no data.
+        ensureOrdered(minValue, maxValue);
+
+        // Search insertion index.
+        int i0 = binarySearch(minValue, 0, length);
+        int i1 = binarySearch(maxValue, (i0 >= 0) ? i0 : ~i0, length);
+        if (i0 < 0) i0 = ~i0;
+        if (i1 < 0) i1 = ~i1;
+        if ((i0 & 1) == 0) {
+            if ((i1 & 1) == 0) {
+                /*
+                 * i0 & i1 are even.
+                 * Case where min and max value are outside any existing range.
+                 *
+                 *   index :      A0    B0       A1       B1        An      Bn     A(n+1)   B(n+1)
+                 *   range :      ███████        ██████████   ◾◾◾   ██████████     ██████████
+                 *                          |-----------------------------------|
+                 *   values :            minValue (i0)                      maxValue (i1)
+                 *
+                 * In this case delete all ranges between minValue and maxValue ([(A1, B1); (An, Bn)]).
+                 */
+                removeAt(i0, i1);
+            } else {
+                /*
+                 * i0 is even and i1 is odd.
+                 * Case where minValue is outside any existing range and maxValue is inside a specific range.
+                 *
+                 *   index :      A0    B0       A1       B1        An      Bn     A(n+1)   B(n+1)
+                 *   range :      ███████        ██████████   ◾◾◾   ██████████     ██████████
+                 *                          |----------------------------|
+                 *   values :            minValue (i0)               maxValue (i1)
+                 *
+                 * In this case :
+                 * - delete all ranges between minValue and maxValue ([(A1, B1); (A(n-1), B(n-1))]).
+                 * - and replace range (An; Bn) by new range (MaxValue; Bn).
+                 *
+                 * Result :
+                 * index :      A0    B0       i1  Bn     A(n+1)   B(n+1)
+                 * range :      ███████        █████      ██████████  ◾◾◾
+                 */
+                removeAt(i0, i1 & ~1); // equivalent to (i0, i1 - 1)
+                Array.set(array, i0, maxValue);
+            }
+        } else {
+            if ((i1 & 1) == 0) {
+                /*
+                 * i0 is odd and i1 is even.
+                 * Case where minValue is inside a specific range and maxValue is outside any range.
+                 *
+                 *  index :      A0    B0     A1       B1        An      Bn        A(n+1)   B(n+1)
+                 *  range :      ███████      ██████████   ◾◾◾   ██████████        ██████████
+                 *                                 |----------------------------|
+                 *  values :            minValue (i0)               maxValue (i1)
+                 *
+                 * In this case :
+                 *  - delete all ranges between minValue and maxValue ([(A2, B2); (An, Bn)]).
+                 *  - and replace range (A1; B1) by new range (A1; i0).
+                 *
+                 * Result :
+                 *  index :      A0    B0       A1  i0     A(n+1)   B(n+1)
+                 *  range :      ███████        █████      ██████████   ◾◾◾
+                 */
+                removeAt(i0 + 1, i1);
+                Array.set(array, i0, minValue);
+            } else {
+                /*
+                 * i0 and i1 are odd.
+                 * Case where minValue and maxValue are inside any specific range.
+                 *
+                 *  index :      A0    B0     A1       B1         An      Bn       A(n+1)   B(n+1)
+                 *  range :      ███████      ██████████   ◾◾◾    ██████████       ██████████
+                 *                                 |-------------------|
+                 *  values :            minValue (i0)               maxValue (i1)
+                 *
+                 * In this case :
+                 *  - delete all ranges between minValue and maxValue ([(A2, B2); (A(n-1), B(n-1))]).
+                 *  - and replace range (A1; B1) by new range (A1; i0).
+                 *
+                 * Result :
+                 *  index  :      A0    B0       A1  i0    i1  Bn     A(n+1)   B(n+1)
+                 *  range  :      ███████        █████  ◾◾◾    █████      ██████████
+                 *
+                 * A particularity case exist if i0 equal i1, which means minValue
+                 * and maxValue are inside the same specific range.
+                 *
+                 *  index  :      A0    B0     A1                  B1         An      Bn
+                 *  range  :      ███████      █████████████████████   ◾◾◾    ██████████
+                 *                                |-------------|
+                 *  values :            minValue (i0)      maxValue (i1)
+                 * In this case total range number will be increase by one.
+                 *
+                 * Result  :
+                 *  index  :      A0    B0       A1  i0    i1  B1     An   Bn
+                 *  range  :      ███████        █████     █████   ◾◾◾   █████
+                 */
+                if (i0 == i1) {
+                    // Above-cited special case
+                    insertAt(i1 + 1, maxValue, getValue(i1));
+                    Array.set(array, i0, minValue);
+                } else {
+                    final int di = i1 - i0;
+                    assert di >= 2 : di;
+                    if (di > 2) {
+                        removeAt(i0 + 1, i1 & ~1); // equivalent to (i0 + 1, i1 - 1)
+                    }
+                    Array.set(array, i0,     minValue);
+                    Array.set(array, i0 + 1, maxValue);
+                }
+            }
+        }
+        return true;
     }
 
     /**
@@ -968,7 +1084,7 @@ public class RangeSet<E extends Comparab
         @Override
         public int size() {
             updateBounds();
-            return (upper - lower) / 2;
+            return (upper - lower) >> 1;
         }
 
         /**

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -28,6 +28,7 @@ import java.text.Format;
 import java.text.ParsePosition;
 import java.text.ParseException;
 import java.util.regex.Matcher;
+import java.nio.charset.Charset;
 import org.opengis.util.Enumerated;
 import org.opengis.util.InternationalString;
 import org.apache.sis.io.LineAppender;
@@ -93,7 +94,7 @@ import static org.apache.sis.util.Charac
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.0)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 public class TreeTableFormat extends TabularFormat<TreeTable> {
@@ -635,6 +636,15 @@ public class TreeTableFormat extends Tab
                 text = Types.getCodeTitle((Enumerated) value).toString(getDisplayLocale());
             } else if (value instanceof Enum<?>) {
                 text = CharSequences.upperCaseToSentence(((Enum<?>) value).name());
+            } else if (value instanceof Locale) {
+                final Locale locale = getDisplayLocale();
+                text = (locale != Locale.ROOT) ? ((Locale) value).getDisplayName(locale) : value.toString();
+            } else if (value instanceof TimeZone) {
+                final Locale locale = getDisplayLocale();
+                text = (locale != Locale.ROOT) ? ((TimeZone) value).getDisplayName(locale) : ((TimeZone) value).getID();
+            } else if (value instanceof Charset) {
+                final Locale locale = getDisplayLocale();
+                text = (locale != Locale.ROOT) ? ((Charset) value).displayName(locale) : ((Charset) value).name();
             } else {
                 /*
                  * Check for a value-by-value format only as last resort.

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/mock/IdentifiedObjectMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/mock/IdentifiedObjectMock.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/mock/IdentifiedObjectMock.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/mock/IdentifiedObjectMock.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -19,7 +19,6 @@ package org.apache.sis.test.mock;
 import java.util.Arrays;
 import java.util.Set;
 import java.util.Collection;
-import java.util.Collections;
 import java.io.Serializable;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -29,6 +28,7 @@ import org.opengis.util.InternationalStr
 import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.ReferenceIdentifier;
+import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.internal.jaxb.gco.GO_GenericName;
 
 
@@ -151,7 +151,7 @@ public strictfp class IdentifiedObjectMo
      */
     @Override
     public final Collection<GenericName> getAlias() {
-        return (alias != null) ? Collections.singleton(alias) : Collections.<GenericName>emptySet();
+        return CollectionsExt.singletonOrEmpty(alias);
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -235,6 +235,7 @@ public final strictfp class CharSequence
      * Tests the {@link CharSequences#toString(Iterable, String)} method.
      */
     @Test
+    @SuppressWarnings("deprecation")
     public void testToString() {
         assertEquals("4, 8, 12, 9", CharSequences.toString(Arrays.asList(4, 8, 12, 9), ", "));
         assertSame  ("singleton",   CharSequences.toString(Arrays.asList("singleton"), ", "));

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -28,6 +28,7 @@ import org.apache.sis.measure.Range;
 import org.apache.sis.measure.NumberRange;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.test.DependsOn;
+import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.Performance;
 import org.apache.sis.test.TestUtilities;
 import org.junit.Test;
@@ -39,13 +40,21 @@ import static org.apache.sis.test.Assert
  * Tests the {@link RangeSet} implementation.
  *
  * @author  Martin Desruisseaux (Geomatys)
+ * @author  Rémi Maréchal (Geomatys)
  * @since   0.3 (derived from geotk-2.0)
- * @version 0.3
+ * @version 0.5
  * @module
  */
 @DependsOn(org.apache.sis.measure.RangeTest.class)
 public final strictfp class RangeSetTest extends TestCase {
     /**
+     * Tolerance factor for comparison of floating point numbers.
+     * Actually we expect exact matches, because {@link RangeSet} does not perform any calculation
+     * other than {@code min} and {@code max} - it just stores the values.
+     */
+    private static final double EPS = 0;
+
+    /**
      * Asserts that the two given values are equals to the expected one.
      * This method is used for testing {@link RangeSet#first()} and {@link RangeSet#last()}
      * in same time than the values from the iterator.
@@ -292,6 +301,216 @@ public final strictfp class RangeSetTest
     }
 
     /**
+     * Tests the {@link RangeSet#remove(Comparable, Comparable)} method with integer values.
+     * The test is run for 4 different cases, 3 of them resulting in one range and one case
+     * resulting in 2 ranges.
+     *
+     * @since 0.5
+     */
+    @Test
+    @DependsOnMethod("testRangeOfIntegers")
+    public void testRemoveRangeOfIntegers() {
+        final RangeSet<Integer> ranges = RangeSet.create(Integer.class, true, false);
+        assertFalse("Remove on empty collection should return false.", ranges.remove(Integer.MIN_VALUE, Integer.MAX_VALUE));
+        assertTrue(ranges.add(-20, -10));
+        /*
+         *                   A             B
+         * Range  :          [-------------]
+         * Remove :                 |------------|
+         *                          RA          RB
+         * Expected result : [------|
+         *                   A      RA
+         */
+        assertTrue(ranges.remove(-15, -5));
+        assertEquals("size", 1, ranges.size());
+        Range<Integer> r = ranges.first();
+        assertEquals(-20, (int) r.getMinValue());
+        assertEquals(-15, (int) r.getMaxValue());
+        /*
+         *                          A             B
+         * Range  :                 [-------------]
+         * Remove :          |------------|
+         *                   RA          RB
+         * Expected result :              |-------]
+         *                                RB      B
+         */
+        assertTrue(ranges.add(-20, -10));
+        assertEquals("size", 1, ranges.size());
+        assertTrue(ranges.remove(-25, -15));
+        assertEquals("size", 1, ranges.size());
+        r = ranges.first();
+        assertEquals(-15, (int) r.getMinValue());
+        assertEquals(-10, (int) r.getMaxValue());
+        /*
+         *                   A                       B
+         * Range  :          [-----------------------]
+         * Remove :                 |----------|
+         *                          RA         RB
+         * Expected result : [------|          |-----]
+         *                   A      RA         RB    B
+         */
+        assertTrue(ranges.add(-20, -10));
+        assertEquals("size", 1, ranges.size());
+        assertTrue(ranges.remove(-17, -13));
+        assertEquals("size", 2, ranges.size());
+        r = ranges.getRange(0);
+        assertEquals(-20, (int) r.getMinValue());
+        assertEquals(-17, (int) r.getMaxValue());
+        r = ranges.getRange(1);
+        assertEquals(-17, (int) r.getMinValue());
+        assertEquals(-13, (int) r.getMaxValue());
+        r = ranges.getRange(2);
+        assertEquals(-13, (int) r.getMinValue());
+        assertEquals(-10, (int) r.getMaxValue());
+        /*
+         *                       A                B
+         * Range  :              [----------------]
+         * Remove :           |----------------------|
+         *                    RA                     RB
+         * Expected result :           "empty"
+         */
+        assertTrue(ranges.add(-20, -10));
+        assertEquals("size", 1, ranges.size());
+        assertTrue(ranges.remove(-21, -9));
+        assertTrue(ranges.isEmpty());
+    }
+
+    /**
+     * Tests the {@link RangeSet#remove(Comparable, Comparable)} method with double values.
+     * This test uses more ranges than {@link #testRemoveRangeOfIntegers()} did.
+     *
+     * @since 0.5
+     */
+    @Test
+    @DependsOnMethod("testRemoveRangeOfIntegers")
+    public void testRemoveRangeOfDoubles() {
+        /*
+         *                       A0   B0    Ai       Bi    An    Bn
+         * Range  :              [----] ... [-------] ... [-----]
+         * Remove :           |---------------|
+         *                    RA              RB
+         *
+         * Expected result :                  |-----] ... [-----]
+         *                                    RB    Bi    An    Bn
+         */
+        final RangeSet<Double> ranges = RangeSet.create(Double.class, true, false);
+        assertTrue(ranges.add(-20.2, -10.1));
+        assertTrue(ranges.add( -9.5,  -7.9));
+        assertTrue(ranges.add( -6.7,  -3.3));
+        assertTrue(ranges.add( -2.4,   1.1));
+        assertTrue(ranges.add(  1.9,   4.3));
+        assertTrue(ranges.add(  6.1,  12.7));
+        assertTrue(ranges.add( 15.3,  21.71));
+        assertEquals("size", 7, ranges.size());
+        assertTrue(ranges.remove(-21.0, -1.4));
+        assertEquals("size", 4, ranges.size());
+        Range<Double> r = ranges.first();
+        assertEquals(-1.4, r.getMinValue(), EPS);
+        assertEquals( 1.1, r.getMaxValue(), EPS);
+        r = ranges.last();
+        assertEquals(15.3,  r.getMinValue(), EPS);
+        assertEquals(21.71, r.getMaxValue(), EPS);
+        /*
+         *                       A0   B0    Ai       Bi    An    Bn
+         * Range  :              [----] ... [-------] ... [-----]
+         * Remove :                              |------------------|
+         *                                       RA                 RB
+         *
+         * Expected result :     [-----] ... [---|
+         *                       A0    B0    Ai  RA
+         */
+        assertTrue(ranges.add(-20.2, -10.1));
+        assertTrue(ranges.add( -9.5,  -7.9));
+        assertTrue(ranges.add( -6.7,  -3.3));
+        assertTrue(ranges.add( -2.4,   1.1 ));
+        assertEquals("size", 7, ranges.size());
+        assertTrue(ranges.remove(0.7, 22.3));
+        assertEquals("size", 4, ranges.size());
+        r = ranges.first();
+        assertEquals(-20.2, r.getMinValue(), EPS);
+        assertEquals(-10.1, r.getMaxValue(), EPS);
+        r = ranges.last();
+        assertEquals(-2.4, r.getMinValue(), EPS);
+        assertEquals( 0.7, r.getMaxValue(), EPS);
+        /*
+         *                       A0   B0    Ai          Bi    An    Bn
+         * Range  :              [----] ... [-----------] ... [-----]
+         * Remove :                             |---|
+         *                                      RA  RB
+         *
+         * Expected result :     [----] ... [---|   |---] ... [-----]
+         *                       A0    B0   Ai  RA  RB  Bi    An    Bn
+         */
+        assertTrue(ranges.add(-2.4,  1.1));
+        assertTrue(ranges.add( 1.9,  4.3));
+        assertTrue(ranges.add( 6.1, 12.7));
+        assertTrue(ranges.add(15.3, 21.71));
+        assertEquals("size", 7, ranges.size());
+        assertTrue(ranges.remove(-5.4, -3.9));
+        assertEquals("size", 8, ranges.size());
+        r = ranges.getRange(4);
+        assertEquals(-6.7, r.getMinValue(), EPS);
+        assertEquals(-5.4, r.getMaxValue(), EPS);
+        r = ranges.getRange(6);
+        assertEquals(-3.9, r.getMinValue(), EPS);
+        assertEquals(-3.3, r.getMaxValue(), EPS);
+        /*
+         *                       A0   B0    Ai    Bi   Aj    Bj    Ak     Bk    An    Bn
+         * Range  :              [----] ... [-----] ...[-----] ... [------] ... [-----]
+         * Remove :                             |---------------------|
+         *                                      RA                   RB
+         *
+         * Expected result :     [----] ... [-- |                     |-- ] ... [-----]
+         *                       A0    B0   Ai  RA                    RB  Bk    An    Bn
+         */
+        assertTrue(ranges.add(-6.7, -3.3));
+        assertEquals("size", 7, ranges.size());
+        assertTrue(ranges.remove(-5.4, 3.1));
+        assertEquals("size", 6, ranges.size());
+        r = ranges.getRange(4);
+        assertEquals(-6.7, r.getMinValue(), EPS);
+        assertEquals(-5.4, r.getMaxValue(), EPS);
+        r = ranges.getRange(6);
+        assertEquals(3.1, r.getMinValue(), EPS);
+        assertEquals(4.3, r.getMaxValue(), EPS);
+        /*
+         *                       A0   B0   Ai    Bi Ai+1  Bi+1  Ak     Bk Ak+1  Bk+1  An    Bn
+         * Range  :              [----] ...[-----]  [-----] ... [------]  [-----] ... [-----]
+         * Remove :                                |---------------------|
+         *                                         RA                   RB
+         *
+         * Expected result :     [----] ... [----]                         [-----] ... [-----]
+         *                       A0    B0   Ai   Bi                        Ak+1  Bk+1  An    Bn
+         */
+        assertTrue(ranges.add(-6.7, -3.3));
+        assertTrue(ranges.add(-2.4,  1.1));
+        assertTrue(ranges.add( 1.9,  4.3));
+        assertEquals("size", 7, ranges.size());
+        assertTrue(ranges.remove(-7.1, 5.2));
+        assertEquals("size", 4, ranges.size());
+        r = ranges.getRange(2);
+        assertEquals(-9.5, r.getMinValue(), EPS);
+        assertEquals(-7.9, r.getMaxValue(), EPS);
+        r = ranges.getRange(4);
+        assertEquals( 6.1, r.getMinValue(), EPS);
+        assertEquals(12.7, r.getMaxValue(), EPS);
+        /*
+         *                       A0   B0    An    Bn
+         * Range  :              [----] ... [-----]
+         * Remove :            |---------------------|
+         *                     RA                    RB
+         *
+         * Expected result :           "Empty"
+         */
+        assertTrue(ranges.add(-6.7, -3.3));
+        assertTrue(ranges.add(-2.4,  1.1));
+        assertTrue(ranges.add( 1.9,  4.3));
+        assertEquals("size", 7, ranges.size());
+        assertTrue(ranges.remove(-50.5, 45.3));
+        assertTrue(ranges.isEmpty());
+    }
+
+    /**
      * Tests {@link RangeSet#clone()}.
      */
     @Test

Modified: sis/branches/JDK6/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/pom.xml?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/pom.xml (original)
+++ sis/branches/JDK6/pom.xml Thu Sep 25 13:59:56 2014
@@ -517,39 +517,6 @@ Apache SIS is a free software, Java lang
         </configuration>
       </plugin>
 
-      <!-- Copy Javadoc resources in the top-level directory (not from "doc-files" subdirectories).
-           While the Maven documentation said that the "src/main/javadoc" directory is copied by default,
-           or a directory can be specified with <javadocResourcesDirectory>, I have been unable to make it
-           work even with absolute paths.
-        -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-resources-plugin</artifactId>
-        <configuration>
-          <encoding>${project.build.sourceEncoding}</encoding>
-        </configuration>
-        <executions>
-          <execution>
-            <id>copy-resources</id>
-            <phase>prepare-package</phase> <!-- TODO: find some way to execute this plugin only before javadoc, not before JAR. -->
-            <goals>
-              <goal>copy-resources</goal>
-            </goals>
-            <configuration>
-              <resources>
-                <resource>
-                  <directory>src/main/javadoc/</directory>
-                  <includes>
-                    <include>*.png</include>
-                  </includes>
-                </resource>
-              </resources>
-              <outputDirectory>${basedir}/target/site/apidocs/</outputDirectory>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-
       <!-- JavaDoc configuration. -->
       <plugin>
         <artifactId>maven-javadoc-plugin</artifactId>

Modified: sis/branches/JDK6/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java [UTF-8] (original)
+++ sis/branches/JDK6/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -16,16 +16,21 @@
  */
 package org.apache.sis.internal.profile.fra;
 
-import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
 import javax.xml.bind.JAXBException;
+import org.opengis.metadata.citation.Responsibility;
 import org.apache.sis.metadata.iso.DefaultMetadata;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
+import org.apache.sis.metadata.iso.citation.DefaultResponsibleParty;
 import org.apache.sis.metadata.iso.citation.HardCodedCitations;
 import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
+import static java.util.Collections.singleton;
 import static org.apache.sis.test.Assert.*;
 
 
@@ -46,13 +51,21 @@ public final strictfp class DirectRefere
 
     /**
      * Creates the metadata object to be tested.
+     *
+     * @param legacy {@code true} for using the legacy {@code ResponsibleParty} instead of {@code Responsibility}.
+     *        This is sometime needed for comparison purpose with unmarshalled metadata.
      */
-    private static DefaultMetadata createMetadata() {
+    @SuppressWarnings("deprecation")
+    private static DefaultMetadata createMetadata(final boolean legacy) {
         final DefaultMetadata metadata = new DefaultMetadata();
         final DefaultCitation citation = new DefaultCitation("European Petroleum Survey Group");
-        citation.setCitedResponsibleParties(HardCodedCitations.EPSG.getCitedResponsibleParties());
+        Collection<Responsibility> r = HardCodedCitations.EPSG.getCitedResponsibleParties();
+        if (legacy) {
+            r = Collections.<Responsibility>singleton(new DefaultResponsibleParty(TestUtilities.getSingleton(r)));
+        }
+        citation.setCitedResponsibleParties(r);
         final DirectReferenceSystem refSys = new DirectReferenceSystem(new ImmutableIdentifier(citation, null, "4326"));
-        metadata.setReferenceSystemInfo(Arrays.asList(refSys));
+        metadata.setReferenceSystemInfo(singleton(refSys));
         return metadata;
     }
 
@@ -64,7 +77,7 @@ public final strictfp class DirectRefere
      */
     @Test
     public void marshallingTest() throws JAXBException {
-        assertMarshalEqualsFile(XML_FILE, createMetadata(), "xmlns:*", "xsi:schemaLocation");
+        assertMarshalEqualsFile(XML_FILE, createMetadata(false), "xmlns:*", "xsi:schemaLocation");
     }
 
     /**
@@ -75,7 +88,7 @@ public final strictfp class DirectRefere
      */
     @Test
     public void unmarshallingTest() throws JAXBException {
-        final DefaultMetadata expected = createMetadata();
+        final DefaultMetadata expected = createMetadata(true);
         final DefaultMetadata result = unmarshalFile(DefaultMetadata.class, XML_FILE);
         /*
          * Compare in debug mode before to perform the real comparison,

Modified: sis/branches/JDK6/profiles/sis-french-profile/src/test/resources/org/apache/sis/internal/profile/fra/DirectReferenceSystem.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/profiles/sis-french-profile/src/test/resources/org/apache/sis/internal/profile/fra/DirectReferenceSystem.xml?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/profiles/sis-french-profile/src/test/resources/org/apache/sis/internal/profile/fra/DirectReferenceSystem.xml (original)
+++ sis/branches/JDK6/profiles/sis-french-profile/src/test/resources/org/apache/sis/internal/profile/fra/DirectReferenceSystem.xml Thu Sep 25 13:59:56 2014
@@ -44,7 +44,7 @@
               <gmd:citedResponsibleParty>
                 <gmd:CI_ResponsibleParty>
                   <gmd:organisationName>
-                    <gco:CharacterString>European Petroleum Survey Group</gco:CharacterString>
+                    <gco:CharacterString>International Association of Oil &amp; Gas Producers</gco:CharacterString>
                   </gmd:organisationName>
                   <gmd:contactInfo>
                     <gmd:CI_Contact>

Modified: sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/XMLStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/XMLStore.java?rev=1627546&r1=1627545&r2=1627546&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/XMLStore.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/XMLStore.java [UTF-8] Thu Sep 25 13:59:56 2014
@@ -35,6 +35,8 @@ import org.apache.sis.metadata.iso.Defau
 import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.util.resources.Errors;
 
+import static java.util.Collections.singleton;
+
 
 /**
  * A data store which creates data objects from a XML file.
@@ -175,7 +177,7 @@ public class XMLStore extends DataStore 
                 metadata = (Metadata) object;
             } else if (object instanceof ReferenceSystem) {
                 final DefaultMetadata d = new DefaultMetadata();
-                d.getReferenceSystemInfo().add((ReferenceSystem) object);
+                d.setReferenceSystemInfo(singleton((ReferenceSystem) object));
                 metadata = d;
             }
         }



Mime
View raw message