sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1565291 - in /sis/branches/JDK7/core: sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
Date Thu, 06 Feb 2014 14:51:32 GMT
Author: desruisseaux
Date: Thu Feb  6 14:51:32 2014
New Revision: 1565291

URL: http://svn.apache.org/r1565291
Log:
Moved 'getName' private method back to its original location.
This has been made possible by the previous commit on WKT Formatter.

Modified:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java

Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java?rev=1565291&r1=1565290&r2=1565291&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingUtilities.java
[UTF-8] Thu Feb  6 14:51:32 2014
@@ -17,7 +17,6 @@
 package org.apache.sis.internal.metadata;
 
 import java.util.Collection;
-import java.util.Iterator;
 import javax.measure.unit.Unit;
 import org.opengis.parameter.*;
 import org.opengis.referencing.*;
@@ -25,15 +24,8 @@ import org.opengis.referencing.cs.*;
 import org.opengis.referencing.crs.*;
 import org.opengis.referencing.datum.*;
 import org.opengis.referencing.operation.*;
-import org.opengis.metadata.Identifier;
-import org.opengis.metadata.citation.Citation;
-import org.opengis.util.GenericName;
-import org.opengis.util.NameSpace;
 import org.apache.sis.util.Static;
 
-import static org.apache.sis.internal.util.Citations.iterator;
-import static org.apache.sis.internal.util.Citations.identifierMatches;
-
 
 /**
  * A set of static methods working on GeoAPI referencing objects.
@@ -109,96 +101,6 @@ public final class ReferencingUtilities 
     }
 
     /**
-     * Returns an object name according the given authority. This method is {@code null}-safe:
-     * every properties are checked for null values, even the properties that are supposed
to
-     * be mandatory (not all implementation defines all mandatory values).
-     *
-     * @param  object    The object to get the name from, or {@code null}.
-     * @param  authority The authority for the name to return, or {@code null} for any authority.
-     * @param  addTo     If non-null, the collection where to add all names found.
-     * @return The object's name (either an {@linkplain ReferenceIdentifier#getCode() identifier
code}
-     *         or a {@linkplain GenericName#tip() name tip}), or {@code null} if no name
matching the
-     *         specified authority has been found.
-     */
-    public static String getName(final IdentifiedObject object, final Citation authority,
final Collection<String> addTo) {
-        if (object != null) {
-            Identifier identifier = object.getName();
-            if (authority == null) {
-                if (identifier != null) {
-                    final String name = identifier.getCode();
-                    if (name != null) {
-                        if (addTo == null) {
-                            return name;
-                        }
-                        addTo.add(name);
-                    }
-                }
-                final Iterator<GenericName> it = iterator(object.getAlias());
-                if (it != null) while (it.hasNext()) {
-                    final GenericName alias = it.next();
-                    if (alias != null) {
-                        final String name = (alias instanceof Identifier) ?
-                                ((Identifier) alias).getCode() : alias.toString();
-                        if (name != null) {
-                            if (addTo == null) {
-                                return name;
-                            }
-                            addTo.add(name);
-                        }
-                    }
-                }
-            } else {
-                if (identifier != null) {
-                    if (identifierMatches(authority, identifier.getAuthority())) {
-                        final String name = identifier.getCode();
-                        if (name != null) {
-                            if (addTo == null) {
-                                return name;
-                            }
-                            addTo.add(name);
-                        }
-                    }
-                }
-                final Iterator<GenericName> it = iterator(object.getAlias());
-                if (it != null) while (it.hasNext()) {
-                    final GenericName alias = it.next();
-                    if (alias != null) {
-                        if (alias instanceof Identifier) {
-                            identifier = (Identifier) alias;
-                            if (identifierMatches(authority, identifier.getAuthority()))
{
-                                final String name = identifier.getCode();
-                                if (name != null) {
-                                    if (addTo == null) {
-                                        return name;
-                                    }
-                                    addTo.add(name);
-                                }
-                            }
-                        } else {
-                            final NameSpace ns = alias.scope();
-                            if (ns != null) {
-                                final GenericName scope = ns.name();
-                                if (scope != null) {
-                                    if (identifierMatches(authority, scope.toString())) {
-                                        final String name = alias.toString();
-                                        if (name != null) {
-                                            if (addTo == null) {
-                                                return name;
-                                            }
-                                            addTo.add(name);
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
      * Returns the unit used for all axes in the given coordinate system.
      * If not all axes use the same unit, then this method returns {@code null}.
      *

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java?rev=1565291&r1=1565290&r2=1565291&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
[UTF-8] Thu Feb  6 14:51:32 2014
@@ -22,6 +22,7 @@ import java.util.LinkedHashSet;
 import java.util.Iterator;
 import java.util.Collection;
 
+import org.opengis.util.NameSpace;
 import org.opengis.util.GenericName;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
@@ -33,7 +34,6 @@ import org.apache.sis.util.Static;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.iso.DefaultNameSpace;
 import org.apache.sis.metadata.iso.citation.Citations; // For javadoc.
-import org.apache.sis.internal.metadata.ReferencingUtilities;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.util.Characters.Filter.LETTERS_AND_DIGITS;
@@ -108,7 +108,7 @@ public final class IdentifiedObjects ext
      */
     public static Set<String> getNames(final IdentifiedObject object, final Citation
authority) {
         final Set<String> names = new LinkedHashSet<>(8);
-        ReferencingUtilities.getName(object, authority, names);
+        getName(object, authority, names);
         return names;
     }
 
@@ -145,7 +145,97 @@ public final class IdentifiedObjects ext
      * @see AbstractIdentifiedObject#getName()
      */
     public static String getName(final IdentifiedObject object, final Citation authority)
{
-        return ReferencingUtilities.getName(object, authority, null);
+        return getName(object, authority, null);
+    }
+
+    /**
+     * Returns an object name according the given authority. This method is {@code null}-safe:
+     * every properties are checked for null values, even the properties that are supposed
to
+     * be mandatory (not all implementation defines all mandatory values).
+     *
+     * @param  object    The object to get the name from, or {@code null}.
+     * @param  authority The authority for the name to return, or {@code null} for any authority.
+     * @param  addTo     If non-null, the collection where to add all names found.
+     * @return The object's name (either an {@linkplain ReferenceIdentifier#getCode() identifier
code}
+     *         or a {@linkplain GenericName#tip() name tip}), or {@code null} if no name
matching the
+     *         specified authority has been found.
+     */
+    private static String getName(final IdentifiedObject object, final Citation authority,
final Collection<String> addTo) {
+        if (object != null) {
+            Identifier identifier = object.getName();
+            if (authority == null) {
+                if (identifier != null) {
+                    final String name = identifier.getCode();
+                    if (name != null) {
+                        if (addTo == null) {
+                            return name;
+                        }
+                        addTo.add(name);
+                    }
+                }
+                final Iterator<GenericName> it = iterator(object.getAlias());
+                if (it != null) while (it.hasNext()) {
+                    final GenericName alias = it.next();
+                    if (alias != null) {
+                        final String name = (alias instanceof Identifier) ?
+                                ((Identifier) alias).getCode() : alias.toString();
+                        if (name != null) {
+                            if (addTo == null) {
+                                return name;
+                            }
+                            addTo.add(name);
+                        }
+                    }
+                }
+            } else {
+                if (identifier != null) {
+                    if (identifierMatches(authority, identifier.getAuthority())) {
+                        final String name = identifier.getCode();
+                        if (name != null) {
+                            if (addTo == null) {
+                                return name;
+                            }
+                            addTo.add(name);
+                        }
+                    }
+                }
+                final Iterator<GenericName> it = iterator(object.getAlias());
+                if (it != null) while (it.hasNext()) {
+                    final GenericName alias = it.next();
+                    if (alias != null) {
+                        if (alias instanceof Identifier) {
+                            identifier = (Identifier) alias;
+                            if (identifierMatches(authority, identifier.getAuthority()))
{
+                                final String name = identifier.getCode();
+                                if (name != null) {
+                                    if (addTo == null) {
+                                        return name;
+                                    }
+                                    addTo.add(name);
+                                }
+                            }
+                        } else {
+                            final NameSpace ns = alias.scope();
+                            if (ns != null) {
+                                final GenericName scope = ns.name();
+                                if (scope != null) {
+                                    if (identifierMatches(authority, scope.toString())) {
+                                        final String name = alias.toString();
+                                        if (name != null) {
+                                            if (addTo == null) {
+                                                return name;
+                                            }
+                                            addTo.add(name);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return null;
     }
 
     /**



Mime
View raw message