Class AbstractName

    • Constructor Detail

      • AbstractName

        protected AbstractName()
        Creates a new instance of generic name.
    • Method Detail

      • castOrCopy

        public static AbstractName castOrCopy​(GenericName object)
        Returns a SIS name implementation with the values of the given arbitrary implementation. This method performs the first applicable action in the following choices:
        Parameters:
        object - the object to get as a SIS implementation, or null if none.
        Returns:
        a SIS implementation containing the values of the given object (may be the given object itself), or null if the argument was null.
      • scope

        public abstract NameSpace scope()
        Returns the scope (name space) in which this name is local. For example if a fully qualified name is "org​.opengis​.util​.Record" and if this instance is the "util​.Record" part, then its scope is named "org​.opengis".

        Continuing with the above example, the full "org​.opengis​.util​.Record" name has no scope. If this method is invoked on such name, then the SIS implementation returns a global scope instance (i.e. an instance for which Default­Name­Space​.is­Global() returns true) which is unique and named "global".

        Specified by:
        scope in interface Generic­Name
        Returns:
        the scope of this name.
      • depth

        public int depth()
        Indicates the number of levels specified by this name. The default implementation returns the size of the list returned by the get­Parsed­Names() method.
        Specified by:
        depth in interface Generic­Name
        Returns:
        the depth of this name.
      • getParsedNames

        public abstract List<? extends LocalName> getParsedNames()
        Returns the sequence of local names making this generic name. The length of this sequence is the depth. It does not include the scope.
        Specified by:
        get­Parsed­Names in interface Generic­Name
        Returns:
        the local names making this generic name, without the scope. Shall never be null neither empty.
      • head

        public LocalName head()
        Returns the first element in the sequence of parsed names. For any Local­Name, this is always this.
        Example: If this name is "org​.opengis​.util​.Record" (no matter its scope, then this method returns "org".
        Specified by:
        head in interface Generic­Name
        Returns:
        the first element in the list of parsed names.
      • tip

        public LocalName tip()
        Returns the last element in the sequence of parsed names. For any Local­Name, this is always this.
        Example: If this name is "org​.opengis​.util​.Record" (no matter its scope, then this method returns "Record".
        Specified by:
        tip in interface Generic­Name
        Returns:
        the last element in the list of parsed names.
      • toFullyQualifiedName

        public GenericName toFullyQualifiedName()
        Returns a view of this name as a fully-qualified name. The scope of a fully qualified name is global. If the scope of this name is already global, then this method returns this.
        Specified by:
        to­Fully­Qualified­Name in interface Generic­Name
        Returns:
        the fully-qualified name (never null).
      • push

        public ScopedName push​(GenericName scope)
        Returns this name expanded with the specified scope. One may represent this operation as a concatenation of the specified scope with this. For example if this name is "util​.Record" and the given scope argument is "org​.opengis", then this​.push(scope) shall return "org​.opengis​.util​.Record".
        Specified by:
        push in interface Generic­Name
        Parameters:
        scope - the name to use as prefix.
        Returns:
        a concatenation of the given scope with this name.
      • toString

        public String toString()
        Returns a string representation of this generic name. This string representation is local-independent. It contains all elements listed by get­Parsed­Names() separated by a namespace-dependent character (usually ':' or '/'). This rule implies that the result may or may not be fully qualified. Special cases:
        Specified by:
        to­String in interface Generic­Name
        Overrides:
        to­String in class Object
        Returns:
        a local-independent string representation of this name.
      • toInternationalString

        public InternationalString toInternationalString()
        Returns a local-dependent string representation of this generic name. This string is similar to the one returned by to­String() except that each element has been localized in the specified locale. If no international string is available, then this method returns an implementation mapping to to­String() for all locales.
        Specified by:
        to­International­String in interface Generic­Name
        Returns:
        a localizable string representation of this name.
      • compareTo

        public int compareTo​(GenericName name)
        Compares this name with the specified name for order. Returns a negative integer, zero, or a positive integer as this name lexicographically precedes, is equal to, or follows the specified name. The comparison is performed in the following way:
        • For each element of the list of parsed names taken in iteration order, compare the Local­Name. If a name lexicographically precedes or follows the corresponding element of the specified name, returns a negative or a positive integer respectively.
        • If all elements in both names are lexicographically equal, then if this name has less or more elements than the specified name, returns a negative or a positive integer respectively.
        • Otherwise, returns 0.
        Specified by:
        compare­To in interface Comparable<Generic­Name>
        Parameters:
        name - the other name to compare with this name.
        Returns:
        -1 if this name precedes the given one, +1 if it follows, 0 if equals.
      • equals

        public boolean equals​(Object object)
        Compares this generic name with the specified object for equality. The default implementation returns true if the scopes and the lists of parsed names are equal.
        Overrides:
        equals in class Object
        Parameters:
        object - the object to compare with this name for equality.
        Returns:
        true if the given object is equal to this name.
      • hashCode

        public int hashCode()
        Returns a hash code value for this generic name.
        Overrides:
        hash­Code in class Object