Author: desruisseaux
Date: Wed Mar  6 20:34:23 2013
New Revision: 1453537

URL: http://svn.apache.org/r1453537
Log:
Minor adjustments for futur code to be commited.

Modified:
    
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
    
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
    
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
    
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
    
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java
    
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties

Modified: 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1453537&r1=1453536&r2=1453537&view=diff
==============================================================================
--- 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
 [UTF-8] Wed Mar  6 20:34:23 2013
@@ -264,11 +264,11 @@ final class PropertyAccessor {
             Method getter  = getters[i];
             String name    = getter.getName();
             final int base = prefix(name).length();
-            addMapping(names[i] = toPropertyName(name, base), index);
             addMapping(name, index);
+            addMappingWithLowerCase(names[i] = toPropertyName(name, base), 
index);
             final UML annotation = getter.getAnnotation(UML.class);
             if (annotation != null) {
-                addMapping(annotation.identifier(), index);
+                addMappingWithLowerCase(annotation.identifier().intern(), 
index);
             }
             /*
              * Now try to infer the setter from the getter. We replace the 
"get" prefix by
@@ -277,12 +277,12 @@ final class PropertyAccessor {
             Class<?> returnType = getter.getReturnType();
             arguments[0] = returnType;
             if (name.length() > base) {
-                final char lo = name.charAt(base);
-                final char up = Character.toUpperCase(lo);
+                final int lo = name.codePointAt(base);
+                final int up = Character.toUpperCase(lo);
                 final int length = name.length();
-                final StringBuilder buffer = new StringBuilder(length - base + 
3).append(SET);
+                final StringBuilder buffer = new StringBuilder(length - base + 
5).append(SET);
                 if (lo != up) {
-                    buffer.append(up).append(name, base+1, length);
+                    buffer.appendCodePoint(up).append(name, base + 
Character.charCount(lo), length);
                 } else {
                     buffer.append(name, base, length);
                 }
@@ -349,18 +349,24 @@ final class PropertyAccessor {
      * Adds the given (name, index) pair to {@link #mapping}, making sure we 
don't
      * overwrite an existing entry with different value.
      */
-    private void addMapping(String name, final Integer index) throws 
IllegalArgumentException {
+    private void addMapping(final String name, final Integer index) {
         if (!name.isEmpty()) {
-            String original;
-            do {
-                final Integer old = mapping.put(name, index);
-                if (old != null && !old.equals(index)) {
-                    throw new 
IllegalStateException(Errors.format(Errors.Keys.DuplicatedValue_1,
-                            Classes.getShortName(type) + '.' + name));
-                }
-                original = name;
-                name = 
CharSequences.trimWhitespaces(name.toLowerCase(Locale.ROOT));
-            } while (!name.equals(original));
+            final Integer old = mapping.put(name, index);
+            if (old != null && !old.equals(index)) {
+                throw new 
IllegalStateException(Errors.format(Errors.Keys.DuplicatedValue_1,
+                        Classes.getShortName(type) + '.' + name));
+            }
+        }
+    }
+
+    /**
+     * Adds the given (name, index) pair and its lower-case variant.
+     */
+    private void addMappingWithLowerCase(final String name, final Integer 
index) {
+        addMapping(name, index);
+        final String lower = name.toLowerCase(Locale.ROOT);
+        if (lower != name) { // Identity comparison is okay here.
+            addMapping(lower, index);
         }
     }
 
@@ -494,7 +500,7 @@ final class PropertyAccessor {
                 }
             }
         }
-        return CharSequences.trimWhitespaces(name).intern();
+        return name.intern();
     }
 
     /**
@@ -534,19 +540,6 @@ final class PropertyAccessor {
     }
 
     /**
-     * Returns the declaring class of the getter at the given index.
-     *
-     * @param  index The index of the property for which to get the declaring 
class.
-     * @return The declaring class at the given index, or {@code null} if the 
index is out of bounds.
-     */
-    final Class<?> getDeclaringClass(final int index) {
-        if (index >= 0 && index < names.length) {
-            return getters[index].getDeclaringClass();
-        }
-        return null;
-    }
-
-    /**
      * Returns the name of the property at the given index, or {@code null} if 
none.
      *
      * @param  index The index of the property for which to get the name.
@@ -667,13 +660,6 @@ final class PropertyAccessor {
     }
 
     /**
-     * Returns {@code true} if the property at the given index is writable.
-     */
-    final boolean isWritable(final int index) {
-        return (index >= 0) && (index < standardCount) && (setters != null) && 
(setters[index] != null);
-    }
-
-    /**
      * Returns the value for the specified metadata, or {@code null} if none.
      * If the given index is out of bounds, then this method returns {@code 
null},
      * so it is safe to invoke this method even if {@link #indexOf(String, 
boolean)}
@@ -1046,7 +1032,7 @@ final class PropertyAccessor {
 
     /**
      * Replaces every properties in the specified metadata by their
-     * {@linkplain ModifiableMetadata#unmodifiable unmodifiable variant}.
+     * {@linkplain ModifiableMetadata#unmodifiable() unmodifiable variant}.
      *
      * @throws BackingStoreException If the implementation threw a checked 
exception.
      */

Modified: 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java?rev=1453537&r1=1453536&r2=1453537&view=diff
==============================================================================
--- 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyComparator.java
 [UTF-8] Wed Mar  6 20:34:23 2013
@@ -26,7 +26,7 @@ import org.opengis.annotation.Obligation
 
 /**
  * The comparator for sorting method order. This comparator puts mandatory 
methods first,
- * which is necessary for reducing the risk of ambiguity in {@link 
PropertyTree#parse}.
+ * which is necessary for reducing the risk of ambiguity in {@link 
MetadataTreeFormat#parse}.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.4)

Modified: 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java?rev=1453537&r1=1453536&r2=1453537&view=diff
==============================================================================
--- 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
 [UTF-8] Wed Mar  6 20:34:23 2013
@@ -67,7 +67,8 @@ final class Pruner extends ThreadLocal<M
      * Returns {@code true} if the value for the given entry is a primitive 
type.
      */
     private static boolean isPrimitive(final Map.Entry<String,Object> entry) {
-        return (entry instanceof PropertyMap.Property) && 
((PropertyMap.Property) entry).getValueType().isPrimitive();
+        return (entry instanceof PropertyMap.Property) &&
+                ((PropertyMap.Property) entry).getValueType().isPrimitive();
     }
 
     /**

Modified: 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java?rev=1453537&r1=1453536&r2=1453537&view=diff
==============================================================================
--- 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
 [UTF-8] Wed Mar  6 20:34:23 2013
@@ -202,7 +202,7 @@ public class DefaultCitation extends ISO
      */
     @Override
     public Collection<Identifier> getIdentifiers() {
-        return null; // Not yet implemented on intend.
+        return java.util.Collections.emptyList(); // TODO: Not yet implemented 
on intend.
     }
 
     /**

Modified: 
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java?rev=1453537&r1=1453536&r2=1453537&view=diff
==============================================================================
--- 
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java
 [UTF-8] Wed Mar  6 20:34:23 2013
@@ -66,6 +66,9 @@ import java.util.Objects;
  * @since   0.3
  * @version 0.3
  * @module
+ *
+ * @see Node
+ * @see TableColumn
  */
 @NotThreadSafe
 public class DefaultTreeTable implements TreeTable, Cloneable, Serializable {
@@ -308,6 +311,9 @@ public class DefaultTreeTable implements
      * @since   0.3
      * @version 0.3
      * @module
+     *
+     * @see DefaultTreeTable
+     * @see TableColumn
      */
     @NotThreadSafe
     public static class Node implements TreeTable.Node, Cloneable, 
Serializable {
@@ -443,7 +449,7 @@ public class DefaultTreeTable implements
         }
 
         /**
-         * Creates a node with a single column for object names 
(c<cite>convenience constructor</cite>).
+         * Creates a node with a single column for object names 
(<cite>convenience constructor</cite>).
          * The node will have the following columns:
          *
          * <table class="sis">

Modified: 
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1453537&r1=1453536&r2=1453537&view=diff
==============================================================================
--- 
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
 [UTF-8] Wed Mar  6 20:34:23 2013
@@ -78,6 +78,11 @@ public final class Errors extends Indexe
         public static final int CanNotConvertValue_2 = 74;
 
         /**
+         * Can not instantiate an object of type ‘{0}’.
+         */
+        public static final int CanNotInstantiate_1 = 81;
+
+        /**
          * Can not set a value for property “{0}”.
          */
         public static final int CanNotSetPropertyValue_1 = 75;
@@ -103,6 +108,16 @@ public final class Errors extends Indexe
         public static final int DuplicatedValue_1 = 38;
 
         /**
+         * Found {0} duplicated values.
+         */
+        public static final int DuplicatedValuesCount_1 = 78;
+
+        /**
+         * Duplicated values for the “{0}” property.
+         */
+        public static final int DuplicatedValuesForProperty_1 = 79;
+
+        /**
          * Element “{0}” is already present.
          */
         public static final int ElementAlreadyPresent_1 = 36;
@@ -255,6 +270,11 @@ public final class Errors extends Indexe
         public static final int MismatchedDimension_3 = 58;
 
         /**
+         * Missing value in the “{0}” column.
+         */
+        public static final int MissingValueInColumn_1 = 77;
+
+        /**
          * Argument ‘{0}’ shall not be negative. The given value was {1}.
          */
         public static final int NegativeArgument_2 = 8;
@@ -380,6 +400,11 @@ public final class Errors extends Indexe
         public static final int UnexpectedEndOfString_1 = 30;
 
         /**
+         * Type of the “{0}” property is unknown.
+         */
+        public static final int UnknownTypeForProperty_1 = 80;
+
+        /**
          * Type ‘{0}’ is unknown in this context.
          */
         public static final int UnknownType_1 = 76;

Modified: 
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1453537&r1=1453536&r2=1453537&view=diff
==============================================================================
--- 
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
 [ISO-8859-1] (original)
+++ 
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
 [ISO-8859-1] Wed Mar  6 20:34:23 2013
@@ -27,11 +27,14 @@
 CanNotConvertFromType_2         = Can not convert from type \u2018{0}\u2019 to 
type \u2018{1}\u2019.
 CanNotConvertValue_2            = Can not convert value \u201c{0}\u201d to 
type \u2018{1}\u2019.
 CanNotComputeDerivative         = Can not compute the derivative.
+CanNotInstantiate_1             = Can not instantiate an object of type 
\u2018{0}\u2019.
 CanNotSetPropertyValue_1        = Can not set a value for property 
\u201c{0}\u201d.
 ClassNotFinal_1                 = Class \u2018{0}\u2019 is not final.
 CloneNotSupported_1             = Can not clone an object of type 
\u2018{0}\u2019.
 DeadThread_1                    = Thread \u201c{0}\u201d is dead.
 DuplicatedValue_1               = Value \u201c{0}\u201d is duplicated.
+DuplicatedValuesForProperty_1   = Duplicated values for the \u201c{0}\u201d 
property.
+DuplicatedValuesCount_1         = Found {0} duplicated values.
 ElementAlreadyPresent_1         = Element \u201c{0}\u201d is already present.
 EmptyArgument_1                 = Argument \u2018{0}\u2019 shall not be empty.
 EmptyDictionary                 = The dictionary shall contains at least one 
entry.
@@ -62,6 +65,7 @@ MandatoryAttribute_2            = Attrib
 MismatchedCRS                   = The coordinate reference system must be the 
same for all objects.
 MismatchedDimension_2           = Mismatched object dimension: {0}D and {1}D.
 MismatchedDimension_3           = Argument \u2018{0}\u2019 has {2} 
dimension{2,choice,1#|2#s}, while {1} was expected.
+MissingValueInColumn_1          = Missing value in the \u201c{0}\u201d column.
 NegativeArgument_2              = Argument \u2018{0}\u2019 shall not be 
negative. The given value was {1}.
 NodeChildOfItself_1             = Node \u201c{0}\u201d can not be a child of 
itself.
 NodeHasAnotherParent_1          = Node \u201c{0}\u201d already has another 
parent.
@@ -89,6 +93,7 @@ UndefinedOrderingForElements_2  = Orderi
 UnexpectedChange_1              = Unexpected change in \u2018{0}\u2019.
 UnexpectedEndOfString_1         = More characters were expected at the end of 
\u201c{0}\u201d.
 UnknownType_1                   = Type \u2018{0}\u2019 is unknown in this 
context.
+UnknownTypeForProperty_1        = Type of the \u201c{0}\u201d property is 
unknown.
 UnmodifiableAffineTransform     = This affine transform is unmodifiable.
 UnmodifiableGeometry            = This geometry is unmodifiable.
 UnmodifiableMetadata            = This metadata is unmodifiable.

Modified: 
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1453537&r1=1453536&r2=1453537&view=diff
==============================================================================
--- 
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
 [ISO-8859-1] (original)
+++ 
sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
 [ISO-8859-1] Wed Mar  6 20:34:23 2013
@@ -17,11 +17,14 @@
 CanNotConvertFromType_2         = Ne peut pas convertir du type 
\u2018{0}\u2019 vers le type \u2018{1}\u2019.
 CanNotConvertValue_2            = La valeur \u201c{0}\u201d ne peut pas 
\u00eatre convertie vers le type \u2018{1}\u2019.
 CanNotComputeDerivative         = La d\u00e9riv\u00e9 ne peut pas \u00eatre 
calcul\u00e9e.
+CanNotInstantiate_1             = Ne peut pas cr\u00e9er un objet de type 
\u2018{0}\u2019.
 CanNotSetPropertyValue_1        = Ne peut pas d\u00e9finir une valeur pour la 
propri\u00e9t\u00e9 \u201c{0}\u201d.
 ClassNotFinal_1                 = La classe \u2018{0}\u2019 n\u2019est pas 
finale.
 CloneNotSupported_1             = Un objet de type \u2018{0}\u2019 ne peut pas 
\u00eatre clon\u00e9.
 DeadThread_1                    = La t\u00e2che \u201c{0}\u201d est morte.
 DuplicatedValue_1               = La valeur \u201c{0}\u201d est dupliqu\u00e9e.
+DuplicatedValuesForProperty_1   = Plusieurs valeurs ont \u00e9t\u00e9 
sp\u00e9cifi\u00e9es pour la propri\u00e9t\u00e9 \u201c{0}\u201d.
+DuplicatedValuesCount_1         = {0} valeurs dupliqu\u00e9es ont 
\u00e9t\u00e9 trouv\u00e9es.
 ElementAlreadyPresent_1         = L\u2019\u00e9lement \u201c{0}\u201d est 
d\u00e9j\u00e0 pr\u00e9sent.
 EmptyArgument_1                 = L\u2019argument \u2018{0}\u2019 ne doit pas 
\u00eatre vide.
 EmptyDictionary                 = Le dictionnaire doit contenir au moins une 
entr\u00e9e.
@@ -52,6 +55,7 @@ MandatoryAttribute_2            = L\u201
 MismatchedCRS                   = Le syst\u00e8me de r\u00e9f\u00e9rence des 
coordonn\u00e9es doit \u00eatre le m\u00eame pour tous les objets.
 MismatchedDimension_2           = Les dimensions des objets ({0}D et {1}D) ne 
concordent pas.
 MismatchedDimension_3           = L\u2019argument \u2018{0}\u2019 a {2} 
dimension{2,choice,1#|2#s}, alors qu\u2019on en attendait {1}.
+MissingValueInColumn_1          = Il manque une valeur dans la colonne 
\u201c{0}\u201d.
 NegativeArgument_2              = L\u2019argument \u2018{0}\u2019 ne doit pas 
\u00eatre n\u00e9gatif. La valeur donn\u00e9e \u00e9tait {1}.
 NodeChildOfItself_1             = Le n\u0153ud \u201c{0}\u201d ne peut pas 
\u00eatre un enfant de lui-m\u00eame.
 NodeHasAnotherParent_1          = Le n\u0153ud \u201c{0}\u201d a 
d\u00e9j\u00e0 un autre parent.
@@ -78,6 +82,7 @@ UndefinedOrderingForElements_2  = L\u201
 UnexpectedChange_1              = Changement inattendu dans \u2018{0}\u2019.
 UnexpectedEndOfString_1         = D\u2019autres caract\u00e8res \u00e9taient 
attendus \u00e0 la fin du texte \u201c{0}\u201d.
 UnknownType_1                   = Le type \u2018{0}\u2019 n\u2019est pas 
reconnu dans ce contexte.
+UnknownTypeForProperty_1        = Le type de la propri\u00e9t\u00e9 
\u201c{0}\u201d est inconnu.
 UnmodifiableAffineTransform     = Cette transformation affine n\u2019est pas 
modifiable.
 UnmodifiableGeometry            = Cette g\u00e9om\u00e9trie n\u2019est pas 
modifiable.
 UnmodifiableMetadata            = Cette m\u00e9ta-donn\u00e9e n\u2019est pas 
modifiable.


Reply via email to