net.sf.saxon.om

## Class NameOfNode

- java.lang.Object
- - net.sf.saxon.om.NameOfNode

- All Implemented Interfaces:
    IdentityComparable, NodeName

      public class NameOfNode
      extends Object
      implements NodeName

  An implementation of NodeName that gets the name of an existing NodeInfo object. Useful when nodes are copied.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NameOfNode(NodeInfo node)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `allocateNameCode(NamePool namePool)` Get the nameCode of this name, allocating a new code from the namepool if necessary
    `boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
    `String` | `getDisplayName()` Get the display name, that is the lexical QName in the form [prefix:]local-part
    `int` | `getFingerprint()` Get the fingerprint of this name if known.
    `String` | `getLocalPart()` Get the local part of the QName
    `int` | `getNameCode()` Get the nameCode of this name if known.
    `NamespaceBinding` | `getNamespaceBinding()` Get a `NamespaceBinding` whose (prefix, uri) pair are the prefix and URI of this node name
    `String` | `getPrefix()` Get the prefix of the QName.
    `StructuredQName` | `getStructuredQName()` Get the name in the form of a StructuredQName
    `String` | `getURI()` Get the namespace URI of the QName.
    `boolean` | `hasFingerprint()` Ask whether this node name representation has a known namecode and fingerprint
    `int` | `hashCode()` Returns a hash code value for the object.
    `boolean` | `isIdentical(IdentityComparable other)` Determine whether two IdentityComparable objects are identical.
    `boolean` | `isInNamespace(String ns)` Test whether this name is in a given namespace
    `boolean` | `isInSameNamespace(NodeName other)` Test whether this name is in the same namespace as another name

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NameOfNode

          public NameOfNode(NodeInfo node)

  - ### Method Detail

    - #### getPrefix

          public String getPrefix()

      Get the prefix of the QName.
      Specified by:
        `getPrefix` in interface `NodeName`
      Returns:
        the prefix. Returns the empty string if the name is unprefixed.

    - #### getURI

          public String getURI()

      Get the namespace URI of the QName.
      Specified by:
        `getURI` in interface `NodeName`
      Returns:
        the URI. Returns the empty string to represent the no-namespace

    - #### getLocalPart

          public String getLocalPart()

      Get the local part of the QName
      Specified by:
        `getLocalPart` in interface `NodeName`
      Returns:
        the local part of the QName

    - #### getDisplayName

          public String getDisplayName()

      Get the display name, that is the lexical QName in the form [prefix:]local-part
      Specified by:
        `getDisplayName` in interface `NodeName`
      Returns:
        the lexical QName

    - #### getStructuredQName

          public StructuredQName getStructuredQName()

      Get the name in the form of a StructuredQName
      Specified by:
        `getStructuredQName` in interface `NodeName`
      Returns:
        the name in the form of a StructuredQName

    - #### isInSameNamespace

          public boolean isInSameNamespace(NodeName other)

      Test whether this name is in the same namespace as another name
      Specified by:
        `isInSameNamespace` in interface `NodeName`
      Parameters:
        `other` - the other name
      Returns:
        true if the two names are in the same namespace

    - #### isInNamespace

          public boolean isInNamespace(String ns)

      Test whether this name is in a given namespace
      Specified by:
        `isInNamespace` in interface `NodeName`
      Parameters:
        `ns` - the namespace to be tested against
      Returns:
        true if the name is in the specified namespace

    - #### getNamespaceBinding

          public NamespaceBinding getNamespaceBinding()

      Get a `NamespaceBinding` whose (prefix, uri) pair are the prefix and URI of this node name
      Specified by:
        `getNamespaceBinding` in interface `NodeName`
      Returns:
        the corresponding NamespaceBinding

    - #### hasFingerprint

          public boolean hasFingerprint()

      Ask whether this node name representation has a known namecode and fingerprint
      Specified by:
        `hasFingerprint` in interface `NodeName`
      Returns:
        true if the methods getFingerprint() and getNameCode() will return a result other than -1

    - #### getFingerprint

          public int getFingerprint()

      Get the fingerprint of this name if known. This method should not to any work to allocate a fingerprint if none is already available
      Specified by:
        `getFingerprint` in interface `NodeName`
      Returns:
        the fingerprint if known; otherwise -1

    - #### getNameCode

          public int getNameCode()

      Get the nameCode of this name if known. This method should not to any work to allocate a nameCode if none is already available
      Specified by:
        `getNameCode` in interface `NodeName`
      Returns:
        the nameCode if known; otherwise -1

    - #### allocateNameCode

          public int allocateNameCode(NamePool namePool)

      Get the nameCode of this name, allocating a new code from the namepool if necessary
      Specified by:
        `allocateNameCode` in interface `NodeName`
      Parameters:
        `namePool` - the NamePool used to allocate the name
      Returns:
        a nameCode for this name, newly allocated if necessary

    - #### hashCode

          public int hashCode()

      Returns a hash code value for the object.
      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Indicates whether some other object is "equal to" this one.
      Overrides:
        `equals` in class `Object`

    - #### isIdentical

          public boolean isIdentical(IdentityComparable other)

      Description copied from interface: `IdentityComparable`
      Determine whether two IdentityComparable objects are identical. This is a stronger test than equality (even schema-equality); for example two dateTime values are not identical unless they are in the same timezone.
      Specified by:
        `isIdentical` in interface `IdentityComparable`
      Returns:
        true if the two values are indentical, false otherwise

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.