sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1480602 [8/15] - in /sis/branches/Android: ./ ide-project/ ide-project/NetBeans/ ide-project/NetBeans/nbproject/ ide-project/eclipse/ sis-app/src/main/java/org/apache/sis/cli/ sis-build-helper/ sis-build-helper/src/main/java/org/apache/sis...
Date Thu, 09 May 2013 12:24:20 GMT
Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/FormatField.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/FormatField.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/FormatField.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/FormatField.java [UTF-8] Thu May  9 12:24:13 2013
@@ -32,7 +32,7 @@ class FormatField extends Format.Field {
     /**
      * Serial number for cross-version compatibility.
      */
-    private static final long serialVersionUID = -5344437554919766622L;
+    private static final long serialVersionUID = 8152048308355926356L;
 
     /**
      * A sentinel value for {@link FormattedCharacterIterator} internal usage only,

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/FormatField.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/FormattedCharacterIterator.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/FormattedCharacterIterator.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/FormattedCharacterIterator.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/FormattedCharacterIterator.java [UTF-8] Thu May  9 12:24:13 2013
@@ -26,18 +26,17 @@ import java.util.Set;
 import java.text.Format;
 import java.text.AttributedCharacterIterator;
 import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.internal.util.SurjectiveConverter;
+import org.apache.sis.util.collection.Containers;
+import org.apache.sis.internal.converter.SurjectiveConverter;
 import org.apache.sis.internal.simple.SimpleCharacterIterator;
 
-import static org.apache.sis.util.collection.Collections.derivedMap;
-
 
 /**
  * The attributed character iterator to be returned by {@link Format}
  * implementations in the {@code org.apache.sis.measure} package.
  *
  * {@section Implementation assumption}
- * Every {@code getRunStart(…)} and {@code getRunLimit(…)} methods defined in this class check
+ * Every {@code getRunStart(…)} and {@code getRunLimit(…)} methods defined in this class check
  * only for attribute existence, ignoring the actual attribute value. This is a departure from
  * the {@link java.text.AttributedCharacterIterator} contract, but should be invisible to the
  * users if there is no juxtaposed fields with the same attribute value (which is usually the
@@ -56,7 +55,7 @@ final class FormattedCharacterIterator e
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = 360841752298264186L;
+    private static final long serialVersionUID = -5864519830922231670L;
 
     /**
      * Holds a field value, together with the run range in which this value is valid.
@@ -66,12 +65,12 @@ final class FormattedCharacterIterator e
      * <p>To be more specific:</p>
      * <ul>
      *   <li>The map key is one of the static constants defined in the formatter {@code Field} inner class.</li>
-     *   <li>{@link #value} is the numeric value being formatted for that particular field.</li>
+     *   <li>{@link #value} is the numeric value being formatted for that particular field.</li>
      *   <li>{@link #start} and {@link #limit} are the range of index in the
      *       {@link SimpleCharacterIterator#text} where the field value has been formatted.</li>
      * </ul>
      *
-     * <b>Example:</b> if {@link AngleFormat} formats "10°30′" and the user wants information
+     * <b>Example:</b> if {@link AngleFormat} formats "10°30′" and the user wants information
      * about the degrees field, then:
      *
      * <ul>
@@ -135,7 +134,7 @@ final class FormattedCharacterIterator e
     private transient Set<Attribute> attributeKeys;
 
     /**
-     * The attribute given in the last call to a {@code getRunStart(…)} or {@code getRunLimit(…)}
+     * The attribute given in the last call to a {@code getRunStart(…)} or {@code getRunLimit(…)}
      * method. Used for determining if the {@link #start} and {@link #limit} fields need a update.
      * A {@code null} value means that the run range needs an unconditional update (this is the
      * case after construction and after deserialization).
@@ -143,7 +142,7 @@ final class FormattedCharacterIterator e
     private transient Attribute runAttribute;
 
     /**
-     * The value to be returned by {@code getRunStart(…)} and {@code getRunLimit(…)}
+     * The value to be returned by {@code getRunStart(…)} and {@code getRunLimit(…)}
      * when the index value is {@code validity}. Those values are updated when needed
      * by the {@link #update(Set)} method.
      */
@@ -397,7 +396,7 @@ final class FormattedCharacterIterator e
     @Override
     public Map<Attribute, Object> getAttributes() {
         final int index = getIndex();
-        return derivedMap(attributes, new Filter(attributes, index), new Selector(index));
+        return Containers.derivedMap(attributes, new Filter(attributes, index), new Selector(index));
     }
 
     /**

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/FormattedCharacterIterator.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java [UTF-8] Thu May  9 12:24:13 2013
@@ -36,17 +36,17 @@ public final class Latitude extends Angl
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = -4496748683919618976L;
+    private static final long serialVersionUID = -2227675003893702061L;
 
     /**
-     * Minimum usual value for latitude ({@value}°).
+     * Minimum usual value for latitude ({@value}°).
      *
      * @see org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#getMinimumValue()
      */
     public static final double MIN_VALUE = -90;
 
     /**
-     * Maximum usual value for latitude (+{@value}°).
+     * Maximum usual value for latitude (+{@value}°).
      *
      * @see org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#getMaximumValue()
      */
@@ -55,20 +55,20 @@ public final class Latitude extends Angl
     /**
      * Construct a new latitude with the specified angular value.
      *
-     * @param φ Latitude value in decimal degrees.
+     * @param φ Latitude value in decimal degrees.
      */
-    public Latitude(final double φ) {
-        super(φ);
+    public Latitude(final double φ) {
+        super(φ);
     }
 
     /**
      * Constructs a newly allocated {@code Latitude} object that contain the angular value
      * represented by the string. The string should represent an angle in either fractional
-     * degrees (e.g. 45.5°) or degrees with minutes and seconds (e.g. 45°30').
+     * degrees (e.g. 45.5°) or degrees with minutes and seconds (e.g. 45°30').
      * The hemisphere (N or S) is optional (default to North).
      *
      * <p>This is a convenience constructor mostly for testing purpose, since it uses a fixed
-     * locale. Developers should consider using {@link AngleFormat} for end-user applications
+     * locale. Developers should consider using {@link AngleFormat} for end-user applications
      * instead than this constructor.</p>
      *
      * @param  string A string to be converted to a {@code Latitude}.

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Latitude.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java [UTF-8] Thu May  9 12:24:13 2013
@@ -36,17 +36,17 @@ public final class Longitude extends Ang
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = -8614900608052762636L;
+    private static final long serialVersionUID = -3203511772374891877L;
 
     /**
-     * Minimum usual value for longitude ({@value}°).
+     * Minimum usual value for longitude ({@value}°).
      *
      * @see org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#getMinimumValue()
      */
     public static final double MIN_VALUE = -180;
 
     /**
-     * Maximum usual value for longitude (+{@value}°).
+     * Maximum usual value for longitude (+{@value}°).
      *
      * @see org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis#getMaximumValue()
      */
@@ -55,20 +55,20 @@ public final class Longitude extends Ang
     /**
      * Construct a new longitude with the specified angular value.
      *
-     * @param λ Longitude value in decimal degrees.
+     * @param λ Longitude value in decimal degrees.
      */
-    public Longitude(final double λ) {
-        super(λ);
+    public Longitude(final double λ) {
+        super(λ);
     }
 
     /**
      * Constructs a newly allocated {@code Longitude} object that contain the angular value
      * represented by the string. The string should represent an angle in either fractional
-     * degrees (e.g. 45.5°) or degrees with minutes and seconds (e.g. 45°30').
+     * degrees (e.g. 45.5°) or degrees with minutes and seconds (e.g. 45°30').
      * The hemisphere (E or W) is optional (default to East).
      *
      * <p>This is a convenience constructor mostly for testing purpose, since it uses a fixed
-     * locale. Developers should consider using {@link AngleFormat} for end-user applications
+     * locale. Developers should consider using {@link AngleFormat} for end-user applications
      * instead than this constructor.</p>
      *
      * @param  string A string to be converted to a {@code Longitude}.

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Longitude.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java [UTF-8] Thu May  9 12:24:13 2013
@@ -47,7 +47,7 @@ class SexagesimalConverter extends UnitC
     /**
      * Serial number for compatibility with different versions.
      */
-    private static final long serialVersionUID = 3873494343412121773L;
+    private static final long serialVersionUID = -2119974989555436361L;
 
     /**
      * Small tolerance factor when comparing numbers close to 1.
@@ -172,7 +172,7 @@ class SexagesimalConverter extends UnitC
         /**
          * Serial number for compatibility with different versions.
          */
-        private static final long serialVersionUID = -7171869900634417819L;
+        private static final long serialVersionUID = -1928146841653975281L;
 
         /**
          * Constructs a converter.

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Units.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Units.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] Thu May  9 12:24:13 2013
@@ -31,7 +31,7 @@ import javax.measure.quantity.Quantity;
 import javax.measure.converter.UnitConverter;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Workaround;
-import org.apache.sis.util.Arrays;
+import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Errors;
@@ -216,7 +216,7 @@ public final class Units extends Static 
      * Makes sure that the specified unit is either null or an angular unit.
      * This method is used for argument checks in constructors and setter methods.
      *
-     * @param  unit The unit to check, or {@code null} if none.
+     * @param  unit The unit to check, or {@code null} if none.
      * @return The given {@code unit} argument, which may be null.
      * @throws IllegalArgumentException if {@code unit} is non-null and not an angular unit.
      *
@@ -234,7 +234,7 @@ public final class Units extends Static 
      * Makes sure that the specified unit is either null or a linear unit.
      * This method is used for argument checks in constructors and setter methods.
      *
-     * @param  unit The unit to check, or {@code null} if none.
+     * @param  unit The unit to check, or {@code null} if none.
      * @return The given {@code unit} argument, which may be null.
      * @throws IllegalArgumentException if {@code unit} is non-null and not a linear unit.
      *
@@ -252,7 +252,7 @@ public final class Units extends Static 
      * Makes sure that the specified unit is either null or a temporal unit.
      * This method is used for argument checks in constructors and setter methods.
      *
-     * @param  unit The unit to check, or {@code null} if none.
+     * @param  unit The unit to check, or {@code null} if none.
      * @return The given {@code unit} argument, which may be null.
      * @throws IllegalArgumentException if {@code unit} is non-null and not a temporal unit.
      *
@@ -270,7 +270,7 @@ public final class Units extends Static 
      * Makes sure that the specified unit is either null or a scale unit.
      * This method is used for argument checks in constructors and setter methods.
      *
-     * @param  unit The unit to check, or {@code null} if none.
+     * @param  unit The unit to check, or {@code null} if none.
      * @return The given {@code unit} argument, which may be null.
      * @throws IllegalArgumentException if {@code unit} is non-null and not a scale unit.
      *
@@ -448,7 +448,7 @@ public final class Units extends Static 
             s = Math.max(uom.lastIndexOf(' '), uom.lastIndexOf('_'));
             if (s >= 1) {
                 final String suffix = (String) trimWhitespaces(uom, s+1, length);
-                if (Arrays.containsIgnoreCase(DEGREE_SUFFIXES, suffix) || (isTemperature = isCelsius(suffix))) {
+                if (ArraysExt.containsIgnoreCase(DEGREE_SUFFIXES, suffix) || (isTemperature = isCelsius(suffix))) {
                     prefix = (String) trimWhitespaces(uom, 0, s); // Remove the suffix only if we recognized it.
                 }
             }
@@ -460,7 +460,7 @@ public final class Units extends Static 
              * Check for unit symbols that do not begin with "deg". If a symbol begins
              * with "deg", then the check should be put in the above block instead.
              */
-            if (uom.equals("°")                      || equalsIgnorePlural(uom, "decimal_degree")) return NonSI.DEGREE_ANGLE;
+            if (uom.equals("°")                      || equalsIgnorePlural(uom, "decimal_degree")) return NonSI.DEGREE_ANGLE;
             if (uom.equalsIgnoreCase("rad")          || equalsIgnorePlural(uom, "radian"))         return SI.RADIAN;
             if (equalsIgnorePlural(uom, "kilometer") || equalsIgnorePlural(uom, "kilometre"))      return SI.KILOMETRE;
             if (equalsIgnorePlural(uom, "meter")     || equalsIgnorePlural(uom, "metre"))          return SI.METRE;

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/Units.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/package-info.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/package-info.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/package-info.java [UTF-8] Thu May  9 12:24:13 2013
@@ -24,6 +24,10 @@
  *   <li>{@link org.apache.sis.measure.Angle} and its subclasses
  *      ({@link org.apache.sis.measure.Longitude},
  *       {@link org.apache.sis.measure.Latitude})</li>
+ *   <li>{@link org.apache.sis.measure.Range} and its subclasses
+ *      ({@link org.apache.sis.measure.NumberRange},
+ *       {@link org.apache.sis.measure.MeasurementRange}) or annotation
+ *      ({@link org.apache.sis.measure.ValueRange}</li>
  *   <li>Formatters
  *      ({@link org.apache.sis.measure.AngleFormat},
  *       {@link org.apache.sis.measure.CoordinateFormat},

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/measure/package-info.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/About.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/About.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/About.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/About.java [UTF-8] Thu May  9 12:24:13 2013
@@ -52,7 +52,7 @@ import static org.apache.sis.util.collec
 import static org.apache.sis.util.collection.TableColumn.VALUE_AS_TEXT;
 
 // JDK7 related
-import org.apache.sis.internal.util.JDK7;
+import org.apache.sis.internal.jdk7.JDK7;
 
 
 /**
@@ -454,7 +454,7 @@ pathTree:   for (int j=0; ; j++) {
                 }
             }
         }
-        TreeTables.valuesAsStrings(table, locale);
+        TreeTables.replaceCharSequences(table, locale);
         return table;
     }
 
@@ -465,7 +465,7 @@ pathTree:   for (int j=0; ; j++) {
      * following separators:
      *
      * <ul>
-     *   <li>If {@code directory} is null, then {@code paths} is assumed to be a
+     *   <li>If {@code directory} is null, then {@code paths} is assumed to be a
      *       system property value using the {@link File#pathSeparatorChar}.</li>
      *   <li>If {@code directory} is non-null, then {@code paths} is assumed to be
      *       a {@code MANIFEST.MF} attribute using space as the path separator.</li>
@@ -570,7 +570,7 @@ pathTree:   for (int j=0; ; j++) {
      * If a file path in the given node or any children follow the Maven pattern, remove the
      * artefact name and version numbers redundancies in order to make the name more compact.
      * For example this method replaces {@code "org/opengis/geoapi/3.0.0/geoapi-3.0.0.jar"}
-     * by {@code "org/opengis/(…)/geoapi-3.0.0.jar"}.
+     * by {@code "org/opengis/(…)/geoapi-3.0.0.jar"}.
      */
     private static void omitMavenRedundancy(final TreeTable.Node node) {
         for (final TreeTable.Node child : node.getChildren()) {
@@ -587,7 +587,7 @@ pathTree:   for (int j=0; ; j++) {
                 buffer.setCharAt(s1-s0, '-');
                 if (CharSequences.regionMatches(name, s2+1, buffer)) {
                     buffer.setLength(0);
-                    node.setValue(NAME, buffer.append(name, 0, s0).append("(…)").append(name, s2, length));
+                    node.setValue(NAME, buffer.append(name, 0, s0).append("(…)").append(name, s2, length));
                 }
             }
         }
@@ -600,15 +600,17 @@ pathTree:   for (int j=0; ; j++) {
      * node but lost all value of the parent node. For this reason, we perform the merge only if the
      * parent has no value.
      *
-     * <p>See the "<cite>Reduce the depth of a tree</cite>" example in {@link TreeTables}
-     * for more information.</p>
+     * <p>See the "<cite>Reduce the depth of a tree</cite>" example in {@link TreeTables} for more information.
+     * In particular, note that this implementation assumes that children collections are {@link List} (this is
+     * guaranteed for {@link DefaultTreeTable.Node} implementations).</p>
      *
      * @param  node The root of the node to simplify.
      * @param  skip {@code true} for disabling concatenation of root node.
      * @return The root of the simplified tree. May be the given {@code node} or a child.
      */
     private static TreeTable.Node concatenateSingletons(final TreeTable.Node node, final boolean skip) {
-        final List<TreeTable.Node> children = node.getChildren();
+        // DefaultTreeTable.Node instances are known to handle their children in a List.
+        final List<TreeTable.Node> children = (List<TreeTable.Node>) node.getChildren();
         final int size = children.size();
         for (int i=0; i<size; i++) {
             children.set(i, concatenateSingletons(children.get(i), false));

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/About.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] Thu May  9 12:24:13 2013
@@ -16,17 +16,15 @@
  */
 package org.apache.sis.util;
 
+import java.util.Arrays;
 import java.nio.CharBuffer;
 
 import static java.lang.Character.*;
-import static java.util.Arrays.fill;
-import static java.util.Arrays.copyOf;
-import static org.apache.sis.util.Arrays.resize;
 import static org.apache.sis.util.StringBuilders.replace;
 
 // Related to JDK7
-import static org.apache.sis.internal.util.JDK7.lowSurrogate;
-import static org.apache.sis.internal.util.JDK7.highSurrogate;
+import static org.apache.sis.internal.jdk7.JDK7.lowSurrogate;
+import static org.apache.sis.internal.jdk7.JDK7.highSurrogate;
 
 
 /**
@@ -46,10 +44,10 @@ import static org.apache.sis.internal.ut
  * no-break spaces}, tabulations and line feeds. The general policy in the SIS library is:
  *
  * <ul>
- *   <li>Use {@code isWhitespace(…)} when separating entities (words, numbers, tokens, <i>etc.</i>)
+ *   <li>Use {@code isWhitespace(…)} when separating entities (words, numbers, tokens, <i>etc.</i>)
  *       in a list. Using that method, characters separated by a no-break space are considered as
  *       part of the same entity.</li>
- *   <li>Use {@code isSpaceChar(…)} when parsing a single entity, for example a single word.
+ *   <li>Use {@code isSpaceChar(…)} when parsing a single entity, for example a single word.
  *       Using this method, no-break spaces are considered as part of the entity while line
  *       feeds or tabulations are entity boundaries.</li>
  * </ul>
@@ -57,15 +55,15 @@ import static org.apache.sis.internal.ut
  * <blockquote><font size="-1"><b>Example:</b> Numbers formatted in the French locale use no-break
  * spaces as group separators. When parsing a list of numbers, ordinary spaces around the numbers
  * may need to be ignored, but no-break spaces shall be considered as part of the numbers.
- * Consequently {@code isWhitespace(…)} is appropriate for skipping spaces <em>between</em> the numbers.
- * But if there is spaces to skip <em>inside</em> a single number, then {@code isSpaceChar(…)} is a
+ * Consequently {@code isWhitespace(…)} is appropriate for skipping spaces <em>between</em> the numbers.
+ * But if there is spaces to skip <em>inside</em> a single number, then {@code isSpaceChar(…)} is a
  * good choice for accepting no-break spaces and for stopping the parse operation at tabulations or
  * line feed character. A tabulation or line feed between two characters is very likely to separate
  * two distinct values.</font></blockquote>
  *
  * In practice, the {@link java.text.Format} implementations in the SIS library typically use
- * {@code isSpaceChar(…)} while most of the rest of the SIS library, including this
- * {@code CharSequences} class, consistently uses {@code isWhitespace(…)}.
+ * {@code isSpaceChar(…)} while most of the rest of the SIS library, including this
+ * {@code CharSequences} class, consistently uses {@code isWhitespace(…)}.
  *
  * <p>Note that the {@link String#trim()} method doesn't follow any of those policies and should
  * generally be avoided. That {@code trim()} method removes every ISO control characters without
@@ -105,7 +103,7 @@ public final class CharSequences extends
         // this strategy and build the char[] array on the fly.
         final int last = SPACES.length - 1;
         final char[] spaces = new char[last+1];
-        fill(spaces, ' ');
+        Arrays.fill(spaces, ' ');
         SPACES[last] = new String(spaces).intern();
     }
 
@@ -172,7 +170,7 @@ public final class CharSequences extends
 
             @Override public String toString() {
                 final char[] array = new char[length];
-                fill(array, ' ');
+                Arrays.fill(array, ' ');
                 return new String(array);
             }
         };
@@ -282,7 +280,7 @@ public final class CharSequences extends
      *
      * @param  text The character sequence to count occurrences, or {@code null}.
      * @param  toSearch The character to count.
-     * @return The number of occurrences of the given character, or 0 if the {@code text} is null.
+     * @return The number of occurrences of the given character, or 0 if the {@code text} is null.
      */
     public static int count(final CharSequence text, final char toSearch) {
         int n = 0;
@@ -548,7 +546,7 @@ search:     for (; fromIndex <= toIndex;
      *   <li>If the given range contains only space characters and the character at {@code toIndex-1}
      *       is the high surrogate of a valid supplementary code point, then this method returns
      *       {@code toIndex+1}, which is the index of the next code point.</li>
-     *   <li>If {@code fromIndex} is negative or {@code toIndex} is greater than the text length,
+     *   <li>If {@code fromIndex} is negative or {@code toIndex} is greater than the text length,
      *       then the behavior of this method is undefined.</li>
      * </ul>
      *
@@ -584,7 +582,7 @@ search:     for (; fromIndex <= toIndex;
      *   <li>If the given range contains only space characters and the character at {@code fromIndex}
      *       is the low surrogate of a valid supplementary code point, then this method returns
      *       {@code fromIndex-1}, which is the index of the code point.</li>
-     *   <li>If {@code fromIndex} is negative or {@code toIndex} is greater than the text length,
+     *   <li>If {@code fromIndex} is negative or {@code toIndex} is greater than the text length,
      *       then the behavior of this method is undefined.</li>
      * </ul>
      *
@@ -646,7 +644,7 @@ search:     for (; fromIndex <= toIndex;
             }
             return strings;
         }
-        // 'excludeEmpty' must use the same criterion than trimWhitespaces(…).
+        // 'excludeEmpty' must use the same criterion than trimWhitespaces(…).
         final boolean excludeEmpty = isWhitespace(separator);
         CharSequence[] strings = new CharSequence[4];
         final int length = text.length();
@@ -655,7 +653,7 @@ search:     for (; fromIndex <= toIndex;
             final CharSequence item = trimWhitespaces(text, last, i);
             if (!excludeEmpty || item.length() != 0) {
                 if (count == strings.length) {
-                    strings = copyOf(strings, count << 1);
+                    strings = Arrays.copyOf(strings, count << 1);
                 }
                 strings[count++] = item;
             }
@@ -665,11 +663,11 @@ search:     for (; fromIndex <= toIndex;
         final CharSequence item = trimWhitespaces(text, last, length);
         if (!excludeEmpty || item.length() != 0) {
             if (count == strings.length) {
-                strings = copyOf(strings, count + 1);
+                strings = Arrays.copyOf(strings, count + 1);
             }
             strings[count++] = item;
         }
-        return resize(strings, count);
+        return ArraysExt.resize(strings, count);
     }
 
     /**
@@ -680,7 +678,7 @@ search:     for (; fromIndex <= toIndex;
      *
      * <p>Notes:</p>
      * <ul>
-     *   <li>At the difference of <code>{@linkplain #split split}(toSplit, '\n’)</code>,
+     *   <li>At the difference of <code>{@linkplain #split split}(toSplit, '\n’)</code>,
      *       this method does not remove whitespaces.</li>
      *   <li>This method does not check for Unicode
      *       {@linkplain Characters#LINE_SEPARATOR line separator} and
@@ -751,7 +749,7 @@ search:     for (; fromIndex <= toIndex;
                 }
             }
             if (count >= splitted.length) {
-                splitted = copyOf(splitted, count*2);
+                splitted = Arrays.copyOf(splitted, count*2);
             }
             splitted[count++] = text.subSequence(last, splitAt);
             last = splitAt + skip;
@@ -760,10 +758,10 @@ search:     for (; fromIndex <= toIndex;
          * Add the remaining string and we are done.
          */
         if (count >= splitted.length) {
-            splitted = copyOf(splitted, count+1);
+            splitted = Arrays.copyOf(splitted, count+1);
         }
         splitted[count++] = text.subSequence(last, text.length());
-        return resize(splitted, count);
+        return ArraysExt.resize(splitted, count);
     }
 
     /**
@@ -951,14 +949,14 @@ search:     for (; fromIndex <= toIndex;
 
     /**
      * Replaces some Unicode characters by ASCII characters on a "best effort basis".
-     * For example the {@code 'é'} character is replaced by {@code 'e'} (without accent).
+     * For example the {@code 'é'} character is replaced by {@code 'e'} (without accent).
      *
      * <p>The current implementation replaces only the characters in the range {@code 00C0}
      * to {@code 00FF}, inclusive. Other characters are left unchanged.</p>
      *
      * @param  text The text to scan for Unicode characters to replace by ASCII characters,
      *         or {@code null}.
-     * @return The given text with substitution applied, or {@code text} if no replacement
+     * @return The given text with substitution applied, or {@code text} if no replacement
      *         has been applied.
      *
      * @see StringBuilders#toASCII(StringBuilder)
@@ -972,7 +970,7 @@ search:     for (; fromIndex <= toIndex;
      * This method is similar in purpose to {@link String#trim()}, except that the later considers
      * every {@linkplain Character#isISOControl(int) ISO control codes} below 32 to be a whitespace.
      * That {@code String.trim()} behavior has the side effect of removing the heading of ANSI escape
-     * sequences (a.k.a. X3.64), and to ignore Unicode spaces. This {@code trimWhitespaces(…)} method
+     * sequences (a.k.a. X3.64), and to ignore Unicode spaces. This {@code trimWhitespaces(…)} method
      * is built on the more accurate {@link Character#isWhitespace(int)} method instead.
      *
      * <p>This method performs the same work than {@link #trimWhitespaces(CharSequence)},
@@ -1085,7 +1083,7 @@ search:     for (; fromIndex <= toIndex;
     /**
      * Makes sure that the {@code text} string is not longer than {@code maxLength} characters.
      * If {@code text} is not longer, then it is returned unchanged. Otherwise this method returns
-     * a copy of {@code text} with some characters substituted by the {@code "(…)"} string.
+     * a copy of {@code text} with some characters substituted by the {@code "(…)"} string.
      *
      * <p>If the text needs to be shortened, then this method tries to apply the above-cited
      * substitution between two words. For example, the following text:</p>
@@ -1097,7 +1095,7 @@ search:     for (; fromIndex <= toIndex;
      * May be shortened to something like this:
      *
      * <blockquote>
-     *   "This sentence given (…) in a short name."
+     *   "This sentence given (…) in a short name."
      * </blockquote>
      *
      * @param  text The sentence to reduce if it is too long, or {@code null}.
@@ -1111,7 +1109,7 @@ search:     for (; fromIndex <= toIndex;
             final int length = text.length();
             int toRemove = length - maxLength;
             if (toRemove > 0) {
-                toRemove += 5; // Space needed for the " (…) " string.
+                toRemove += 5; // Space needed for the " (…) " string.
                 /*
                  * We will remove characters from 'lower' to 'upper' both exclusive. We try to
                  * adjust 'lower' and 'upper' in such a way that the first and last characters
@@ -1123,7 +1121,7 @@ search:     for (; fromIndex <= toIndex;
                 }
                 int upper = lower;
                 boolean forward = false;
-                do { // Do be run as long as we need to remove more characters.
+                do { // To be run as long as we need to remove more characters.
                     int nc=0, type=UNASSIGNED;
                     forward = !forward;
 searchWordBreak:    while (true) {
@@ -1170,14 +1168,55 @@ searchWordBreak:    while (true) {
                         toRemove -= nc;
                     }
                 } while (toRemove > 0);
-                text = new StringBuilder(lower + (length-upper) + 5) // 5 is the length of " (…) "
-                        .append(text, 0, lower).append(" (…) ").append(text, upper, length);
+                text = new StringBuilder(lower + (length-upper) + 5) // 5 is the length of " (…) "
+                        .append(text, 0, lower).append(" (…) ").append(text, upper, length);
             }
         }
         return text;
     }
 
     /**
+     * Given a string in upper cases (typically a Java constant), returns a string formatted
+     * like an English sentence. This heuristic method performs the following steps:
+     *
+     * <ol>
+     *   <li>Replace all occurrences of {@code '_'} by spaces.</li>
+     *   <li>Converts all letters except the first one to lower case letters using
+     *       {@link Character#toLowerCase(int)}. Note that this method does not use
+     *       the {@link String#toLowerCase()} method. Consequently the system locale
+     *       is ignored. This method behaves as if the conversion were done in the
+     *       {@linkplain java.util.Locale#ROOT root} locale.</li>
+     * </ol>
+     *
+     * <p>Note that those heuristic rules may be modified in future SIS versions,
+     * depending on the practical experience gained.</p>
+     *
+     * @param  identifier The name of a Java constant, or {@code null}.
+     * @return The identifier like an English sentence, or {@code null}
+     *         if the given {@code identifier} argument was null.
+     */
+    public static CharSequence upperCaseToSentence(final CharSequence identifier) {
+        if (identifier == null) {
+            return null;
+        }
+        final StringBuilder buffer = new StringBuilder(identifier.length());
+        final int length = identifier.length();
+        for (int i=0; i<length;) {
+            int c = Character.codePointAt(identifier, i);
+            if (i != 0) {
+                if (c == '_') {
+                    c = ' ';
+                } else {
+                    c = Character.toLowerCase(c);
+                }
+            }
+            buffer.appendCodePoint(c);
+            i += Character.charCount(c);
+        }
+        return buffer;
+    }
+
+    /**
      * Given a string in camel cases (typically an identifier), returns a string formatted
      * like an English sentence. This heuristic method performs the following steps:
      *
@@ -1859,7 +1898,7 @@ cmp:    while (ia < lga) {
      *
      * @param  text The text for which to get the token.
      * @param  fromIndex Index of the fist character to consider in the given text.
-     * @return A sub-sequence of {@code text} starting at the given offset, or an empty string
+     * @return A sub-sequence of {@code text} starting at the given offset, or an empty string
      *         if there is no non-blank character at or after the given offset.
      * @throws NullPointerException if the {@code text} argument is null.
      */

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Characters.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Classes.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Classes.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Classes.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Classes.java [UTF-8] Thu May  9 12:24:13 2013
@@ -17,6 +17,7 @@
 package org.apache.sis.util;
 
 import java.util.Set;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.Collection;
 import java.util.Collections;
@@ -28,10 +29,7 @@ import java.lang.reflect.WildcardType;
 import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.ParameterizedType;
 
-import static java.util.Arrays.copyOf;
-import static org.apache.sis.util.Arrays.resize;
-import static org.apache.sis.util.Arrays.contains;
-import static org.apache.sis.util.collection.Collections.hashMapCapacity;
+import static org.apache.sis.util.collection.Containers.hashMapCapacity;
 
 
 /**
@@ -46,7 +44,7 @@ import static org.apache.sis.util.collec
  *       ({@link #findCommonClass(Class, Class) findCommonClass},
  *        {@link #findCommonInterfaces(Class, Class) findCommonInterfaces})</li>
  *   <li>Getting the bounds of a parameterized field or method
- *       ({@link #boundOfParameterizedAttribute(Method) boundOfParameterizedAttribute})</li>
+ *       ({@link #boundOfParameterizedProperty(Method) boundOfParameterizedProperty})</li>
  *   <li>Getting a short class name ({@link #getShortName(Class) getShortName},
  *       {@link #getShortClassName(Object) getShortClassName})</li>
  * </ul>
@@ -63,7 +61,7 @@ public final class Classes extends Stati
     private static final Class<?>[] EMPTY_ARRAY = new Class<?>[0];
 
     /**
-     * Methods to be rejected by {@link #isGetter(Method)}. They are mostly methods inherited
+     * Methods to be rejected by {@link #isPossibleGetter(Method)}. They are mostly methods inherited
      * from {@link Object}. Only no-argument methods having a non-void return value need to be
      * declared in this list.
      *
@@ -82,7 +80,7 @@ public final class Classes extends Stati
 
     /**
      * Changes the array dimension by the given amount. The given class can be a primitive type,
-     * a Java object, or an array of the above. If the given {@code dimension} is positive, then
+     * a Java object, or an array of the above. If the given {@code dimension} is positive, then
      * the array dimension will be increased by that amount. For example a change of dimension 1
      * will change a {@code int} class into {@code int[]}, and a {@code String[]} class into
      * {@code String[][]}. A change of dimension 2 is like applying a change of dimension 1 two
@@ -139,8 +137,8 @@ public final class Classes extends Stati
     }
 
     /**
-     * Returns the upper bounds of the parameterized type of the given attribute.
-     * If the attribute does not have a parameterized type, returns {@code null}.
+     * Returns the upper bounds of the parameterized type of the given property.
+     * If the property does not have a parameterized type, returns {@code null}.
      *
      * <p>This method is typically used for fetching the type of elements in a collection.
      * We do not provide a method working from a {@link Class} instance because of the way
@@ -164,14 +162,14 @@ public final class Classes extends Stati
      * @return The upper bound of parameterized type, or {@code null} if the given field
      *         is not of a parameterized type.
      */
-    public static Class<?> boundOfParameterizedAttribute(final Field field) {
+    public static Class<?> boundOfParameterizedProperty(final Field field) {
         return getActualTypeArgument(field.getGenericType());
     }
 
     /**
-     * If the given method is a getter or a setter for a parameterized attribute, returns the
+     * If the given method is a getter or a setter for a parameterized property, returns the
      * upper bounds of the parameterized type. Otherwise returns {@code null}. This method
-     * provides the same semantic than {@link #boundOfParameterizedAttribute(Field)}, but
+     * provides the same semantic than {@link #boundOfParameterizedProperty(Field)}, but
      * works on a getter or setter method rather then the field. See the javadoc of above
      * method for more details.
      *
@@ -183,7 +181,7 @@ public final class Classes extends Stati
      * @return The upper bound of parameterized type, or {@code null} if the given method
      *         do not operate on an object of a parameterized type.
      */
-    public static Class<?> boundOfParameterizedAttribute(final Method method) {
+    public static Class<?> boundOfParameterizedProperty(final Method method) {
         Class<?> c = getActualTypeArgument(method.getGenericReturnType());
         if (c == null) {
             final Type[] parameters = method.getGenericParameterTypes();
@@ -227,32 +225,6 @@ public final class Classes extends Stati
     }
 
     /**
-     * Casts the {@code type} class to represent a subclass of the class represented by the
-     * {@code sub} argument. Checks that the cast is valid, and returns {@code null} if it
-     * is not.
-     *
-     * <p>This method performs the same work than
-     * <code>type.{@linkplain Class#asSubclass(Class) asSubclass}(sub)</code>,
-     * except that {@code null} is returned instead than throwing an exception
-     * if the cast is not valid or if any of the argument is {@code null}.</p>
-     *
-     * @param  <U>  The compile-time bounds of the {@code sub} argument.
-     * @param  type The class to cast to a sub-class, or {@code null}.
-     * @param  sub  The subclass to cast to, or {@code null}.
-     * @return The {@code type} argument casted to a subclass of the {@code sub} argument,
-     *         or {@code null} if this cast can not be performed.
-     *
-     * @see Class#asSubclass(Class)
-     */
-    @SuppressWarnings({"unchecked","rawtypes"})
-    public static <U> Class<? extends U> asSubclassOrNull(final Class<?> type, final Class<U> sub) {
-        // Design note: We are required to return null if 'sub' is null (not to return 'type'
-        // unchanged), because if we returned 'type', we would have an unsafe cast if this
-        // method is invoked indirectly from a parameterized method.
-        return (type != null && sub != null && sub.isAssignableFrom(type)) ? (Class) type : null;
-    }
-
-    /**
      * Returns the class of the specified object, or {@code null} if {@code object} is null.
      * This method is also useful for fetching the class of an object known only by its bound
      * type. As of Java 6, the usual pattern:
@@ -269,6 +241,7 @@ public final class Classes extends Stati
      * @return The class of the given object, or {@code null} if the given object was null.
      */
     @SuppressWarnings("unchecked")
+    @Workaround(library="JDK", version="1.7")
     public static <T> Class<? extends T> getClass(final T object) {
         return (object != null) ? (Class<? extends T>) object.getClass() : null;
     }
@@ -284,7 +257,7 @@ public final class Classes extends Stati
      * @param  objects The collection of objects.
      * @return The set of classes of all objects in the given collection.
      */
-    public static <T> Set<Class<? extends T>> getClasses(final Collection<? extends T> objects) {
+    private static <T> Set<Class<? extends T>> getClasses(final Iterable<? extends T> objects) {
         final Set<Class<? extends T>> types = new LinkedHashSet<Class<? extends T>>();
         for (final T object : objects) {
             types.add(getClass(object));
@@ -293,23 +266,49 @@ public final class Classes extends Stati
     }
 
     /**
-     * Returns the set of every interfaces implemented by the given class or interface. This is
-     * similar to {@link Class#getInterfaces()} except that this method searches recursively in
-     * the super-interfaces. For example if the given type is {@link java.util.ArrayList}, then
+     * Returns every interfaces implemented, directly or indirectly, by the given class or interface.
+     * This is similar to {@link Class#getInterfaces()} except that this method searches recursively
+     * in the super-interfaces. For example if the given type is {@link java.util.ArrayList}, then
      * the returned set will contains {@link java.util.List} (which is implemented directly)
      * together with its parent interfaces {@link Collection} and {@link Iterable}.
      *
+     * @param  <T>  The compile-time type of the {@code Class} argument.
+     * @param  type The class or interface for which to get all implemented interfaces.
+     * @return All implemented interfaces (not including the given {@code type} if it was an
+     *         interface), or an empty array if none.
+     *
+     * @see Class#getInterfaces()
+     */
+    @SuppressWarnings({"unchecked","rawtypes"}) // Generic array creation.
+    public static <T> Class<? super T>[] getAllInterfaces(final Class<T> type) {
+        final Set<Class<?>> interfaces = getInterfaceSet(type);
+        return (interfaces != null) ? interfaces.toArray(new Class[interfaces.size()]) : EMPTY_ARRAY;
+    }
+
+    /**
+     * Implementation of {@link #getAllInterfaces(Class)} returning a {@link Set}.
+     * The public API exposes the method returning an array instead than a set for
+     * the following reasons:
+     *
+     * <ul>
+     *   <li>Consistency with other methods ({@link #getLeafInterfaces(Class, Class)},
+     *       {@link Class#getInterfaces()}).</li>
+     *   <li>Because arrays in Java are covariant, while the {@code Set} are not.
+     *       Consequently callers can cast {@code Class<? super T>[]} to {@code Class<?>[]}
+     *       while they can not cast {@code Set<Class<? super T>>} to {@code Set<Class<?>>}.</li>
+     * </ul>
+     *
      * @param  type The class or interface for which to get all implemented interfaces.
      * @return All implemented interfaces (not including the given {@code type} if it was an
-     *         interface), or an empty set if none. Callers can freely modify the returned set.
+     *         interface), or {@code null} if none. Callers can freely modify the returned set.
      */
-    public static Set<Class<?>> getAllInterfaces(Class<?> type) {
+    static Set<Class<?>> getInterfaceSet(Class<?> type) {
         Set<Class<?>> interfaces = null;
         while (type != null) {
-            interfaces = getAllInterfaces(type, interfaces);
+            interfaces = getInterfaceSet(type, interfaces);
             type = type.getSuperclass();
         }
-        return (interfaces != null) ? interfaces : Collections.<Class<?>>emptySet();
+        return interfaces;
     }
 
     /**
@@ -320,15 +319,15 @@ public final class Classes extends Stati
      * @return The given set (may be {@code null}), or a new set if the given set was null
      *         and at least one interface has been found.
      */
-    private static Set<Class<?>> getAllInterfaces(final Class<?> type, Set<Class<?>> addTo) {
+    private static Set<Class<?>> getInterfaceSet(final Class<?> type, Set<Class<?>> addTo) {
         final Class<?>[] interfaces = type.getInterfaces();
         for (int i=0; i<interfaces.length; i++) {
             final Class<?> candidate = interfaces[i];
             if (addTo == null) {
-                addTo = new LinkedHashSet<Class<?>>(hashMapCapacity(interfaces.length - i));
+                addTo = new LinkedHashSet<Class<?>>(hashMapCapacity(interfaces.length));
             }
             if (addTo.add(candidate)) {
-                getAllInterfaces(candidate, addTo);
+                getInterfaceSet(candidate, addTo);
             }
         }
         return addTo;
@@ -377,14 +376,14 @@ next:       for (final Class<?> candidat
                         types = candidates;
                     }
                     if (count >= types.length) {
-                        types = copyOf(types, types.length + candidates.length);
+                        types = Arrays.copyOf(types, types.length + candidates.length);
                     }
                     types[count++] = candidate;
                 }
             }
             type = type.getSuperclass();
         }
-        return (Class[]) resize(types, count);
+        return (Class[]) ArraysExt.resize(types, count);
     }
 
     /**
@@ -398,7 +397,7 @@ next:       for (final Class<?> candidat
      * @return The most specialized class, or {@code null} if the given collection does not contain
      *         at least one non-null element.
      */
-    public static Class<?> findSpecializedClass(final Collection<?> objects) {
+    public static Class<?> findSpecializedClass(final Iterable<?> objects) {
         final Set<Class<?>> types = getClasses(objects);
         types.remove(null);
         /*
@@ -450,7 +449,7 @@ next:       for (final Class<?> candidat
      * @return The most specific class common to all supplied objects, or {@code null} if the
      *         given collection does not contain at least one non-null element.
      */
-    public static Class<?> findCommonClass(final Collection<?> objects) {
+    public static Class<?> findCommonClass(final Iterable<?> objects) {
         final Set<Class<?>> types = getClasses(objects);
         types.remove(null);
         return common(types);
@@ -496,13 +495,16 @@ next:       for (final Class<?> candidat
      *         Callers can freely modify the returned set.
      */
     public static Set<Class<?>> findCommonInterfaces(final Class<?> c1, final Class<?> c2) {
-        final Set<Class<?>> interfaces = getAllInterfaces(c1);
-        final Set<Class<?>> buffer     = getAllInterfaces(c2); // To be recycled.
+        final Set<Class<?>> interfaces = getInterfaceSet(c1);
+        final Set<Class<?>> buffer     = getInterfaceSet(c2); // To be recycled.
+        if (interfaces == null || buffer == null) {
+            return Collections.emptySet();
+        }
         interfaces.retainAll(buffer);
         for (Iterator<Class<?>> it=interfaces.iterator(); it.hasNext();) {
             final Class<?> candidate = it.next();
             buffer.clear(); // Safe because the buffer can not be Collections.EMPTY_SET at this point.
-            getAllInterfaces(candidate, buffer);
+            getInterfaceSet(candidate, buffer);
             if (interfaces.removeAll(buffer)) {
                 it = interfaces.iterator();
             }
@@ -558,20 +560,55 @@ cmp:    for (final Class<?> c : c1) {
     }
 
     /**
-     * Returns a short class name for the specified class. This method will
-     * omit the package name.  For example, it will return {@code "String"} instead
-     * of {@code "java.lang.String"} for a {@link String} object. It will also name
-     * array according Java language usage,  for example {@code "double[]"} instead
-     * of {@code "[D"}.
-     *
-     * <p>This method is similar to the {@link Class#getSimpleName()} method, except that
-     * if the given class is an inner class, then the returned value is prefixed with the
-     * outer class name. For example this method returns {@code "Point2D.Double"} instead
-     * of {@code "Double"}.</p>
+     * Returns the name of the given class without package name, but including the names of enclosing
+     * classes if any. This method is similar to the {@link Class#getSimpleName()} method, except that
+     * if the given class is an inner class, then the returned value is prefixed with the outer class
+     * name. An other difference is that if the given class is local or anonymous, then this method
+     * returns the name of the parent class.
+     *
+     * <p>The following table compares the various kind of names for some examples:</p>
+     *
+     * <table class="sis">
+     *   <tr>
+     *     <th>Class</th>
+     *     <th>{@code getName()}</th>
+     *     <th>{@code getSimpleName()}</th>
+     *     <th>{@code getCanonicalName()}</th>
+     *     <th>{@code getShortName()}</th>
+     *   </tr>
+     *   <tr>
+     *     <td>{@link String}</td>
+     *     <td>{@code "java.lang.String"}</td>
+     *     <td>{@code "String"}</td>
+     *     <td>{@code "java.lang.String"}</td>
+     *     <td>{@code "String"}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@code double[]}</td>
+     *     <td>{@code "[D"}</td>
+     *     <td>{@code "double[]"}</td>
+     *     <td>{@code "double[]"}</td>
+     *     <td>{@code "double[]"}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@link java.awt.geom.Point2D.Double}</td>
+     *     <td>{@code "java.awt.geom.Point2D$Double"}</td>
+     *     <td>{@code "Double"}</td>
+     *     <td>{@code "java.awt.geom.Point2D.Double"}</td>
+     *     <td>{@code "Point2D.Double"}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>Anonymous {@link Comparable}</td>
+     *     <td>{@code "com.mycompany.myclass$1"}</td>
+     *     <td>{@code ""}</td>
+     *     <td>{@code null}</td>
+     *     <td>{@code "Object"}</td>
+     *   </tr>
+     * </table>
      *
      * @param  classe The object class (may be {@code null}).
-     * @return A short class name for the specified object, or {@code "<*>"} if the
-     *         given class was null.
+     * @return The simple name with outer class name (if any) of the first non-anonymous
+     *         class in the hierarchy, or {@code "<*>"} if the given class is null.
      *
      * @see #getShortClassName(Object)
      * @see Class#getSimpleName()
@@ -580,11 +617,11 @@ cmp:    for (final Class<?> c : c1) {
         if (classe == null) {
             return "<*>";
         }
-        Class<?> enclosing = classe.getEnclosingClass();
         while (classe.isAnonymousClass()) {
             classe = classe.getSuperclass();
         }
         String name = classe.getSimpleName();
+        final Class<?> enclosing = classe.getEnclosingClass();
         if (enclosing != null) {
             name = getShortName(enclosing) + '.' + name;
         }
@@ -592,12 +629,14 @@ cmp:    for (final Class<?> c : c1) {
     }
 
     /**
-     * Returns a short class name for the specified object. This method will
-     * omit the package name. For example, it will return {@code "String"}
-     * instead of {@code "java.lang.String"} for a {@link String} object.
+     * Returns the class name of the given object without package name, but including the enclosing class names
+     * if any. Invoking this method is equivalent to invoking {@code getShortName(object.getClass())} except for
+     * {@code null} value. See {@link #getShortName(Class)} for more information on the class name returned by
+     * this method.
      *
      * @param  object The object (may be {@code null}).
-     * @return A short class name for the specified object.
+     * @return The simple class name with outer class name (if any) of the first non-anonymous
+     *         class in the hierarchy, or {@code "<*>"} if the given object is null.
      *
      * @see #getShortName(Class)
      */
@@ -623,7 +662,7 @@ cmp:    for (final Class<?> c : c1) {
      * @param  allowedTypes The allowed types.
      * @return {@code true} if the given type is assignable to one of the allowed types.
      */
-    public static boolean isAssignableTo(final Class<?> type, final Class<?>... allowedTypes) {
+    public static boolean isAssignableToAny(final Class<?> type, final Class<?>... allowedTypes) {
         if (type != null) {
             if (allowedTypes == null) {
                 return true;
@@ -638,7 +677,7 @@ cmp:    for (final Class<?> c : c1) {
     }
 
     /**
-     * Returns {@code true} if the given method may possibly be the getter method for an attribute.
+     * Returns {@code true} if the given method may possibly be the getter method for a property.
      * This method implements the algorithm used by SIS in order to identify getter methods in
      * {@linkplain org.opengis.metadata metadata} interfaces. We do not rely on naming convention
      * (method names starting with "{@code get}" or "{@code is}" prefixes) because not every methods
@@ -669,6 +708,6 @@ cmp:    for (final Class<?> c : c1) {
                method.getParameterTypes().length == 0 &&
               !method.isSynthetic() &&
               !method.isAnnotationPresent(Deprecated.class) &&
-              !contains(EXCLUDES, method.getName());
+              !ArraysExt.contains(EXCLUDES, method.getName());
     }
 }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Classes.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/ComparisonMode.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Configuration.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Debug.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Decorator.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Disposable.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java [UTF-8] Thu May  9 12:24:13 2013
@@ -25,7 +25,7 @@ import org.apache.sis.internal.util.Loca
 import static org.apache.sis.util.CharSequences.trimWhitespaces;
 
 // Related to JDK7
-import org.apache.sis.internal.util.JDK7;
+import org.apache.sis.internal.jdk7.JDK7;
 
 
 /**

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java [UTF-8] Thu May  9 12:24:13 2013
@@ -25,30 +25,30 @@ package org.apache.sis.util;
  *
  * {@section Conditions for equality}
  * <ul>
- *   <li>{@link org.apache.sis.metadata.iso.MetadataEntity} subclasses
+ *   <li>{@link org.apache.sis.metadata.iso.ISOMetadata} subclasses
  *     <ol>
- *       <li>{@link ComparisonMode#STRICT STRICT} – Objects must be of the same class
+ *       <li>{@link ComparisonMode#STRICT STRICT} – Objects must be of the same class
  *           and all attributes must be equal, including {@code xlink} and others
- *           {@linkplain org.apache.sis.metadata.iso.MetadataEntity#getIdentifiers() identifiers}.</li>
- *       <li>{@link ComparisonMode#BY_CONTRACT BY_CONTRACT} – The same attributes than the above
+ *           {@linkplain org.apache.sis.metadata.iso.ISOMetadata#getIdentifiers() identifiers}.</li>
+ *       <li>{@link ComparisonMode#BY_CONTRACT BY_CONTRACT} – The same attributes than the above
  *           {@code STRICT} mode must be equal, but the metadata object don't need to be implemented
  *           by the same class provided that they implement the same GeoAPI interface.</li>
- *       <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} – Only the attributes defined
+ *       <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} – Only the attributes defined
  *           in the GeoAPI interfaces are compared. The above-cited identifiers and {@code xlinks}
  *           attributes are ignored.</li>
- *       <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} – The same attributes than the above
+ *       <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} – The same attributes than the above
  *           {@code IGNORE_METADATA} mode are compared, but a slight (implementation dependant)
  *           difference is tolerated in floating point numbers.</li>
  *     </ol>
  *   </li>
  *   <li>{@link org.apache.sis.referencing.AbstractIdentifiedObject} subclasses
  *     <ol>
- *       <li>{@link ComparisonMode#STRICT STRICT} – Objects must be of the same class
+ *       <li>{@link ComparisonMode#STRICT STRICT} – Objects must be of the same class
  *           and all attributes must be equal.</li>
- *       <li>{@link ComparisonMode#BY_CONTRACT BY_CONTRACT} – The same attributes than the above
+ *       <li>{@link ComparisonMode#BY_CONTRACT BY_CONTRACT} – The same attributes than the above
  *           {@code STRICT} mode must be equal, but the referencing object don't need to be
  *           implemented by the same class provided that they implement the same GeoAPI interface.</li>
- *       <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} – The
+ *       <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} – The
  *           {@linkplain org.apache.sis.referencing.crs.AbstractCRS#getIdentifiers() identifiers},
  *           {@linkplain org.apache.sis.referencing.crs.AbstractCRS#getAlias() aliases},
  *           {@linkplain org.apache.sis.referencing.crs.AbstractCRS#getScope() scope},
@@ -57,7 +57,7 @@ package org.apache.sis.util;
  *           are ignored because they have no incidence on the coordinate values to be computed by
  *           {@linkplain org.opengis.referencing.operation.ConcatenatedOperation coordinate operations}.
  *           All other attributes that are relevant to coordinate calculations, must be equal.</li>
- *       <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} – The same attributes than the above
+ *       <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} – The same attributes than the above
  *           {@code IGNORE_METADATA} mode are compared, but a slight (implementation dependant)
  *           difference is tolerated in floating point numbers.</li>
  *     </ol>
@@ -65,19 +65,19 @@ package org.apache.sis.util;
  *   <li>{@link org.apache.sis.referencing.operation.transform.AbstractMathTransform} subclasses
  *       except {@link org.apache.sis.referencing.operation.transform.LinearTransform}
  *     <ol>
- *       <li>{@link ComparisonMode#STRICT STRICT} – Objects must be of the same class and all
+ *       <li>{@link ComparisonMode#STRICT STRICT} – Objects must be of the same class and all
  *           attributes must be equal, including the
  *           {@linkplain org.apache.sis.referencing.operation.transform.AbstractMathTransform#getParameterValues() parameter values}.</li>
- *       <li>{@link ComparisonMode#BY_CONTRACT BY_CONTRACT} – Synonymous to the {@code STRICT} mode,
+ *       <li>{@link ComparisonMode#BY_CONTRACT BY_CONTRACT} – Synonymous to the {@code STRICT} mode,
  *            because there is no GeoAPI interfaces for the various kind of math transforms.</li>
- *       <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} – Objects must be of the same
+ *       <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} – Objects must be of the same
  *           class, but the parameter values can be different if they are different way to formulate
  *           the same transform. For example a {@code "Mercator (2SP)"} projection with a
  *           {@linkplain org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#standardParallels
- *           standard parallel} value of 60° produces the same results than a {@code "Mercator (1SP)"} projection with a
+ *           standard parallel} value of 60° produces the same results than a {@code "Mercator (1SP)"} projection with a
  *           {@linkplain org.apache.sis.referencing.operation.projection.UnitaryProjection.Parameters#scaleFactor
  *           scale factor} value of 0.5</li>
- *       <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} – The same attributes than the above
+ *       <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} – The same attributes than the above
  *           {@code IGNORE_METADATA} mode are compared, but a slight (implementation dependant)
  *           difference is tolerated in floating point numbers.</li>
  *     </ol>
@@ -85,14 +85,14 @@ package org.apache.sis.util;
  *   <li>{@link org.apache.sis.referencing.operation.matrix.XMatrix} and
  *       {@link org.apache.sis.referencing.operation.transform.LinearTransform} implementations
  *     <ol>
- *       <li>{@link ComparisonMode#STRICT STRICT} – Objects must be of the same class, matrixes
+ *       <li>{@link ComparisonMode#STRICT STRICT} – Objects must be of the same class, matrixes
  *           must have the same size and all matrix elements must be equal.</li>
- *       <li>{@link ComparisonMode#BY_CONTRACT BY_CONTRACT} – Matrixes must have the same size
+ *       <li>{@link ComparisonMode#BY_CONTRACT BY_CONTRACT} – Matrixes must have the same size
  *           and all matrix elements must be equal, but the matrixes are not required to be the
  *           same implementation class (any {@link org.opengis.referencing.operation.Matrix} is okay).</li>
- *       <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} – Synonymous to the
+ *       <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} – Synonymous to the
  *           {@code BY_CONTRACT} mode, because matrixes don't have metadata.</li>
- *       <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} – The same attributes than the above
+ *       <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} – The same attributes than the above
  *           {@code BY_CONTRACT} mode are compared, but a slight (implementation dependant)
  *           difference is tolerated in floating point numbers.</li>
  *     </ol>
@@ -111,23 +111,23 @@ public interface LenientComparable {
      * for stricter to more permissive values:
      *
      * <ol>
-     *   <li>{@link ComparisonMode#STRICT STRICT} –
+     *   <li>{@link ComparisonMode#STRICT STRICT} –
      *        All attributes of the compared objects shall be strictly equal.</li>
-     *   <li>{@link ComparisonMode#BY_CONTRACT BY_CONTRACT} –
+     *   <li>{@link ComparisonMode#BY_CONTRACT BY_CONTRACT} –
      *       Only the attributes published in the interface contract need to be compared.</li>
-     *   <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} –
+     *   <li>{@link ComparisonMode#IGNORE_METADATA IGNORE_METADATA} –
      *       Only the attributes relevant to the object functionality are compared.</li>
-     *   <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} –
+     *   <li>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE} –
      *       Only the attributes relevant to the object functionality are compared,
      *       with some tolerance threshold on numerical values.</li>
-     *   <li>{@link ComparisonMode#DEBUG DEBUG} –
+     *   <li>{@link ComparisonMode#DEBUG DEBUG} –
      *        special mode for figuring out why two objects expected to be equal are not.</li>
      * </ol>
      *
      * Note that {@code this.equals(other, mode)} is <strong>not</strong> guaranteed to be equal
      * to {@code other.equals(this, mode)}.  In particular, the {@code BY_CONTRACT} level and all
      * levels below it will typically compare only the properties known to {@code this} instance,
-     * ignoring any properties that may be known only by the {@code other} instance.
+     * ignoring any properties that may be known only by the {@code other} instance.
      *
      * @param  other The object to compare to {@code this}.
      * @param  mode The strictness level of the comparison.

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/LenientComparable.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Locales.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Locales.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Locales.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Locales.java [UTF-8] Thu May  9 12:24:13 2013
@@ -28,9 +28,8 @@ import java.lang.reflect.Modifier;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
 
-import static org.apache.sis.util.Arrays.resize;
 import static org.apache.sis.util.CharSequences.trimWhitespaces;
-import static org.apache.sis.util.collection.Collections.hashMapCapacity;
+import static org.apache.sis.util.collection.Containers.hashMapCapacity;
 
 
 /**
@@ -141,7 +140,7 @@ public final class Locales extends Stati
                 locales[count++] = unique(locale);
             }
         }
-        locales = resize(locales, count);
+        locales = ArraysExt.resize(locales, count);
         return locales;
     }
 
@@ -203,9 +202,16 @@ public final class Locales extends Stati
      * country code (again either as 2 or 3 letters), optionally followed by {@code '_'} and
      * the variant.
      *
+     * <p>This method can be used when the caller wants the same {@code Locale} constants no
+     * matter if the language and country codes use 2 or 3 letters. Apache SIS usually don't
+     * distinguish those two cases since ISO 19139 documents have to use the 3 letters codes
+     * anyway.</p>
+     *
      * @param  code The language code, which may be followed by country code.
      * @return The language for the given code.
      * @throws IllegalArgumentException If the given code doesn't seem to be a valid locale.
+     *
+     * @see Locale#forLanguageTag(String)
      */
     public static Locale parse(final String code) throws IllegalArgumentException {
         final String language, country, variant;
@@ -264,6 +270,43 @@ public final class Locales extends Stati
     }
 
     /**
+     * Parses the locale encoded in the suffix of a property key. This convenience method
+     * is used when a property in a {@link java.util.Map} may have many localized variants.
+     * For example the {@code "remarks"} property may be defined by values associated to the
+     * {@code "remarks_en"} and {@code "remarks_fr"} keys, for English and French locales
+     * respectively.
+     *
+     * <p>This method infers the {@code Locale} from the property {@code key}
+     * with the following steps:</p>
+     *
+     * <ul>
+     *   <li>If the given {@code key} is exactly equals to {@code prefix},
+     *       then this method returns {@link Locale#ROOT}.</li>
+     *   <li>Otherwise if the given {@code key} does not start with the specified {@code prefix}
+     *       followed by the {@code '_'} character, then this method returns {@code null}.</li>
+     *   <li>Otherwise, the characters after the {@code '_'} are parsed as an ISO language
+     *       and country code by the {@link #parse(String)} method.</li>
+     * </ul>
+     *
+     * @param  prefix The prefix to skip at the beginning of the {@code key}.
+     * @param  key    The property key from which to extract the locale.
+     * @return {@code true} if the key has been recognized, or {@code false} otherwise.
+     * @throws IllegalArgumentException if the locale after the prefix is an illegal code.
+     */
+    public static Locale parseSuffix(final String prefix, final String key) throws IllegalArgumentException {
+        if (key.startsWith(prefix)) {
+            final int offset = prefix.length();
+            if (key.length() == offset) {
+                return Locale.ROOT;
+            }
+            if (key.charAt(offset) == '_') {
+                return parse(key.substring(offset + 1));
+            }
+        }
+        return null;
+    }
+
+    /**
      * Returns {@code true} if the following code is 3 letters, or {@code false} if 2 letters.
      */
     private static boolean isThreeLetters(final String code) {

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Locales.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Localized.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Localized.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Localized.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Localized.java [UTF-8] Thu May  9 12:24:13 2013
@@ -20,7 +20,7 @@ import java.util.Locale;
 
 
 /**
- * Interface of localized services (parser, formatter, codes, …).
+ * Interface of localized services (parser, formatter, codes, …).
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.05)
@@ -35,10 +35,14 @@ public interface Localized {
      *
      * <ul>
      *   <li>A synonymous of the {@linkplain Locale#getDefault() system default locale};</li>
-     *   <li>or an "unlocalized" service, for example formatting numbers using
-     *       {@link Double#toString(double)} instead than {@link java.text.NumberFormat}.</li>
+     *   <li>A synonymous of {@link Locale#ROOT} for an "unlocalized" service. For example the
+     *       service may format numbers using {@link Double#toString(double)} instead than
+     *       {@link java.text.NumberFormat}.</li>
      * </ul>
      *
+     * Implementations are encouraged to return a non-null value in every cases.
+     * Nevertheless client codes should be prepared to receive null values.
+     *
      * @return The locale, or {@code null} if not explicitly defined.
      *
      * @see org.apache.sis.io.CompoundFormat#getLocale()

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/Localized.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/NullArgumentException.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/NullArgumentException.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/NullArgumentException.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/NullArgumentException.java [UTF-8] Thu May  9 12:24:13 2013
@@ -38,7 +38,7 @@ public class NullArgumentException exten
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = -9191547216229354211L;
+    private static final long serialVersionUID = 7924011726325288438L;
 
     /**
      * Constructs an exception with no detail message.

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/util/NullArgumentException.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8



Mime
View raw message