# Interface ScopedName

All Superinterfaces:
  `Comparable<GenericName>, GenericName`

All Known Implementing Classes:
  `DefaultScopedName`

@UML(identifier="ScopedName", specification=ISO_19103) public interface ScopedName extends GenericName
A composite of a local name (as head) for locating another name space, and a generic name (as tail) valid in that name space. This definition allows for iteration. The tail may be either a local name or a scoped name. If it is a scoped name, then another another step towards a remote local name is taken. In this way, a scoped name may represent an arbitrarily distant local name simply by the number of times the `tail()` method evaluates to a `ScopedName` before finally terminating on a `LocalName`.

It may be seen that `ScopedName` is the means by which fully-qualified names are expressed. However, a `ScopedName` is not, in itself, what is commonly thought of as a fully qualified name. The `ScopedName` type is one link in the chain, not the entire chain. A scoped name is a fully qualified name only if its scope is global.

Example: The illustration below shows the head, tail, path and name of `"org​.opengis​.util​.Record"`.

> org | . | opengis | . | util | . | Record
> --- | --- | --- | --- | --- | --- | ---
> head |  | tail
> path |  | tip

Since:
  2.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `LocalName`
  `head()`
  Returns the first element in the sequence of parsed names.
  `GenericName`
  `path()`
  Returns every elements of the parsed names list except for the tip.
  `GenericName`
  `tail()`
  Returns every elements of the parsed names list except for the head.
  `LocalName`
  `tip()`
  Returns the last element in the sequence of parsed names.
  `String`
  `toString()`
  Returns a locale-independent string representation of this scoped name.

  ### Methods inherited from interface Comparable

  `compareTo`

  ### Methods inherited from interface GenericName

  `depth, getParsedNames, push, scope, toFullyQualifiedName, toInternationalString`

- ## Method Details

  - ### head

    @UML(identifier="head", obligation=MANDATORY, specification=ISO_19103) LocalName head()
    Returns the first element 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() equals this.scope()`

    This method is similar in purpose to `Name​.get(0)` from the Java Naming and Directory Interface.

    Example: If `this` name is `"org​.opengis​.util​.Record"`, then this method shall returns `"org"`.

    Specified by:
      `head` in interface `GenericName`
    Returns:
      The first element in the list of parsed names.
    Since:
      2.2

  - ### tail

    @UML(identifier="tail", obligation=MANDATORY, specification=ISO_19103) GenericName tail()
    Returns every elements of the parsed names list except for the head. In other words, the following relationship must holds:

    - `tail()​.getParsedNames() equals this.getParsedNames().sublist(1, depth)`

    This method is similar in purpose to ``Name​.getSuffix`(1)` from the Java Naming and Directory Interface.

    Returns:
      All elements except the first one in the in the list of parsed names.
    Since:
      2.1

  - ### path

    GenericName path()
    Returns every elements of the parsed names list except for the tip. In other words, the following relationship must holds:

    - `tip()​.getParsedNames() equals this.getParsedNames().sublist(0, depth-1)`

    This method is similar in purpose to ``Name​.getPrefix`(size-1)` from the Java Naming and Directory Interface.

    Returns:
      All elements except the last one in the in the list of parsed names.
    Since:
      2.1

  - ### tip

    LocalName tip()
    Returns the last element in the sequence of parsed names.

    This method is similar in purpose to `Name​.get(size-1)` from the Java Naming and Directory Interface.

    Specified by:
      `tip` in interface `GenericName`
    Returns:
      The last element in the list of parsed names.
    Since:
      2.1

  - ### toString

    @UML(identifier="scopedName", obligation=MANDATORY, specification=ISO_19103) String toString()
    Returns a locale-independent string representation of this scoped name. This method encapsulates the domain logic which formats the parsed names into a legal string representation of the name. There will be variants on this theme. XML aficionados may require URIs. For Java classes, a dotted notation is more appropriate, for C/C++, a double-colon, for directories, a forward or reverse slash, and for CRS, it will depend on the mode of expression: URN or `Authority:Identifier` notation.
    Specified by:
      `toString` in interface `GenericName`
    Overrides:
      `toString` in class `Object`
    Returns:
      A local-independent string representation of this name.