sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1627555 [3/3] - in /sis/trunk: ./ 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/org/apache...
Date Thu, 25 Sep 2014 14:55:51 GMT
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] Thu Sep 25 14:55:49 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/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] Thu Sep 25 14:55:49 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/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] Thu Sep 25 14:55:49 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/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Thu Sep 25 14:55:49 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/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=1627555&r1=1627554&r2=1627555&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] Thu Sep 25 14:55:49 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/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [UTF-8] Thu Sep 25 14:55:49 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/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=1627555&r1=1627554&r2=1627555&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] Thu Sep 25 14:55:49 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/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/JDK8.java [UTF-8] Thu Sep 25 14:55:49 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/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=1627555&r1=1627554&r2=1627555&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] Thu Sep 25 14:55:49 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/trunk/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/setup/About.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] Thu Sep 25 14:55:49 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/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] Thu Sep 25 14:55:49 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/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=1627555&r1=1627554&r2=1627555&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] Thu Sep 25 14:55:49 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/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=1627555&r1=1627554&r2=1627555&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] Thu Sep 25 14:55:49 2014
@@ -29,6 +29,7 @@ import java.text.ParsePosition;
 import java.text.ParseException;
 import java.util.regex.Matcher;
 import org.opengis.util.CodeList;
+import java.nio.charset.Charset;
 import org.opengis.util.InternationalString;
 import org.apache.sis.io.LineAppender;
 import org.apache.sis.io.TableAppender;
@@ -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((CodeList<?>) 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/trunk/core/sis-utility/src/test/java/org/apache/sis/test/mock/IdentifiedObjectMock.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/mock/IdentifiedObjectMock.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/mock/IdentifiedObjectMock.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/mock/IdentifiedObjectMock.java [UTF-8] Thu Sep 25 14:55:49 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/trunk/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java [UTF-8] Thu Sep 25 14:55:49 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/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java [UTF-8] Thu Sep 25 14:55:49 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/trunk/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/pom.xml?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/pom.xml (original)
+++ sis/trunk/pom.xml Thu Sep 25 14:55:49 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/trunk/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java [UTF-8] (original)
+++ sis/trunk/profiles/sis-french-profile/src/test/java/org/apache/sis/internal/profile/fra/DirectReferenceSystemTest.java [UTF-8] Thu Sep 25 14:55:49 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.ResponsibleParty;
 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<ResponsibleParty> r = HardCodedCitations.EPSG.getCitedResponsibleParties();
+        if (legacy) {
+            r = Collections.<ResponsibleParty>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/trunk/profiles/sis-french-profile/src/test/resources/org/apache/sis/internal/profile/fra/DirectReferenceSystem.xml
URL: http://svn.apache.org/viewvc/sis/trunk/profiles/sis-french-profile/src/test/resources/org/apache/sis/internal/profile/fra/DirectReferenceSystem.xml?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/profiles/sis-french-profile/src/test/resources/org/apache/sis/internal/profile/fra/DirectReferenceSystem.xml (original)
+++ sis/trunk/profiles/sis-french-profile/src/test/resources/org/apache/sis/internal/profile/fra/DirectReferenceSystem.xml Thu Sep 25 14:55:49 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/trunk/src/main/javadoc/stylesheet.css
URL: http://svn.apache.org/viewvc/sis/trunk/src/main/javadoc/stylesheet.css?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/src/main/javadoc/stylesheet.css (original)
+++ sis/trunk/src/main/javadoc/stylesheet.css Thu Sep 25 14:55:49 2014
@@ -213,3 +213,8 @@ div.block pre, code, tt, dt code, table 
   line-height: 1em;
   font-size:   1em;
 }
+
+h5 {
+  font-size: 110%;
+  margin-bottom: 3pt;
+}

Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/XMLStore.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/XMLStore.java?rev=1627555&r1=1627554&r2=1627555&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/XMLStore.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/XMLStore.java [UTF-8] Thu Sep 25 14:55:49 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