Class ScopedName

    • Constructor Detail

      • ScopedName

        public ScopedName​(GenericName scope,
                          CharSequence name)
        Constructs a scoped name from the specified international string. If the specified name is an InternationalString, then the toString(null) method will be used in order to fetch an unlocalized name. Otherwise, the toString() method will be used.
        Parameters:
        scope - The scope (or "tail") of the variable.
        name - The head (never null).
      • ScopedName

        public ScopedName​(GenericName scope,
                          char separator,
                          CharSequence name)
        Constructs a scoped name from the specified international string. If the specified name is an InternationalString, then the toString(null) method will be used in order to fetch an unlocalized name. Otherwise, the toString() method will be used.
        Parameters:
        scope - The scope (or "tail") of the variable.
        separator - The separator character (usually ':' or '/').
        name - The head (never null).
    • Method Detail

      • head

        public LocalName head()
        Returns the head of this scoped name. This is the first elements in the sequence of parsed names. The head element must exists in the same name space than this scoped name. In other words, the following relationship must holds:

        • head().scope() == this.scope()
        Specified by:
        head in interface GenericName
        Specified by:
        head in interface ScopedName
        Overrides:
        head in class GenericName
        Returns:
        The first element of this name.
        Since:
        2.3
      • tail

        public GenericName tail()
        Returns the tail of this scoped name. The returned name contains every elements of the parsed names list except for the first one, which is the head. In other words, the following relationship must holds:

        Note: This condition can be understood in terms of the Java equals method instead of the Java identity comparator ==.

        Specified by:
        tail in interface ScopedName
        Returns:
        All elements except the first one in the in the list of parsed names.
        Since:
        2.3
      • getSeparator

        public char getSeparator()
        Returns the separator character.
      • tip

        public LocalName tip()
        Returns a view of this object as a local name. This is the last element in the sequence of parsed names. The local name returned by this method will still have the same scope than this scoped name. Note however that the string returned by LocalName.toString() will differs.
        Specified by:
        tip in interface GenericName
        Specified by:
        tip in interface ScopedName
        Overrides:
        tip in class GenericName
        Returns:
        The last element of this name.
      • getInternalScope

        protected GenericName getInternalScope()
        Description copied from class: GenericName
        Returns the scope (name space) of this generic name. If this name has no scope (e.g. is the * root), then this method returns null. Can be a no-op if the subclass overrides GenericName.scope()
        Specified by:
        getInternalScope in class GenericName
      • toFullyQualifiedName

        public GenericName toFullyQualifiedName()
        Returns a view of this name as a fully-qualified name. The scope of a fully qualified name must be global. This method never returns null.
        Specified by:
        toFullyQualifiedName in interface GenericName
        Returns:
        The fully-qualified name (never null).
        Since:
        2.3
      • 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 name with this. In pseudo-code, the following relationships must hold:

        Note: Those conditions can be understood in terms of the Java equals method instead of the Java identity comparator ==.

        Specified by:
        push in interface GenericName
        Parameters:
        scope - The name to use as prefix.
        Returns:
        A concatenation of the given name with this name.
        Since:
        2.3
      • equals

        public boolean equals​(Object object)
        Compares this scoped name with the specified object for equality.
        Overrides:
        equals in class GenericName
        Parameters:
        object - The object to compare with this name.
        Returns:
        true if the given object is equals to this one.
      • hashCode

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