Package net.sf.saxon.om
Class FingerprintedQName
- java.lang.Object
-
- net.sf.saxon.om.FingerprintedQName
-
- All Implemented Interfaces:
IdentityComparable
,NodeName
public class FingerprintedQName extends java.lang.Object implements NodeName
A QName triple (prefix, URI, local) with the additional ability to hold an integer fingerprint. The integer fingerprint provides a fast way of checking equality. A FingerprintedQName makes sense only in the context of a known NamePool, and instances must be compared only if they relate to the same NamePool. The fingerprint is optional, and is used only if present.
-
-
Constructor Summary
Constructors Constructor Description FingerprintedQName(java.lang.String prefix, java.lang.String uri, java.lang.String localName)
FingerprintedQName(java.lang.String prefix, java.lang.String uri, java.lang.String localName, int fingerprint)
FingerprintedQName(java.lang.String prefix, java.lang.String uri, java.lang.String localName, NamePool pool)
FingerprintedQName(StructuredQName qName, int fingerprint)
FingerprintedQName(StructuredQName qName, NamePool pool)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
static FingerprintedQName
fromClarkName(java.lang.String expandedName)
Make a FingerprintedQName from a Clark namestatic FingerprintedQName
fromEQName(java.lang.String expandedName)
Make a FingerprintedQName from a Clark namejava.lang.String
getDisplayName()
Get the display name, that is the lexical QName in the form [prefix:]local-partint
getFingerprint()
Get the fingerprint of this name if known.java.lang.String
getLocalPart()
Get the local part of the QNameNamespaceBinding
getNamespaceBinding()
Get aNamespaceBinding
whose (prefix, uri) pair are the prefix and URI of this node namejava.lang.String
getPrefix()
Get the prefix of the QName.StructuredQName
getStructuredQName()
Get the name in the form of a StructuredQNamejava.lang.String
getURI()
Get the namespace URI of the QName.boolean
hasFingerprint()
Ask whether this node name representation has a known namecode and fingerprintint
hashCode()
Returns a hash code value for the object.boolean
hasURI(java.lang.String ns)
Test whether this name is in a given namespaceint
identityHashCode()
Get a hashCode that offers the guarantee that if A.isIdentical(B), then A.identityHashCode() == B.identityHashCode()boolean
isIdentical(IdentityComparable other)
Determine whether two IdentityComparable objects are identical.int
obtainFingerprint(NamePool pool)
Get the fingerprint of this name, allocating a new code from the namepool if necessaryjava.lang.String
toString()
-
-
-
Constructor Detail
-
FingerprintedQName
public FingerprintedQName(java.lang.String prefix, java.lang.String uri, java.lang.String localName)
-
FingerprintedQName
public FingerprintedQName(java.lang.String prefix, java.lang.String uri, java.lang.String localName, int fingerprint)
-
FingerprintedQName
public FingerprintedQName(java.lang.String prefix, java.lang.String uri, java.lang.String localName, NamePool pool)
-
FingerprintedQName
public FingerprintedQName(StructuredQName qName, int fingerprint)
-
FingerprintedQName
public FingerprintedQName(StructuredQName qName, NamePool pool)
-
-
Method Detail
-
fromClarkName
public static FingerprintedQName fromClarkName(java.lang.String expandedName)
Make a FingerprintedQName from a Clark name- Parameters:
expandedName
- the name in Clark notation "{uri}local" if in a namespace, or "local" otherwise. The format "{}local" is also accepted for a name in no namespace.- Returns:
- the constructed FingerprintedQName
- Throws:
java.lang.IllegalArgumentException
- if the Clark name is malformed
-
fromEQName
public static FingerprintedQName fromEQName(java.lang.String expandedName)
Make a FingerprintedQName from a Clark name- Parameters:
expandedName
- the name in EQName notation "Q{uri}local" if in a namespace, or "local" otherwise. The format "Q{}local" is also accepted for a name in no namespace.- Returns:
- the constructed FingerprintedQName
- Throws:
java.lang.IllegalArgumentException
- if the EQName name is malformed
-
hasFingerprint
public boolean hasFingerprint()
Ask whether this node name representation has a known namecode and fingerprint- Specified by:
hasFingerprint
in interfaceNodeName
- 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 interfaceNodeName
- Returns:
- the fingerprint if known; otherwise -1
-
obtainFingerprint
public int obtainFingerprint(NamePool pool)
Get the fingerprint of this name, allocating a new code from the namepool if necessary- Specified by:
obtainFingerprint
in interfaceNodeName
- Parameters:
pool
- the NamePool used to allocate the name- Returns:
- a fingerprint for this name, newly allocated if necessary
-
getDisplayName
public java.lang.String getDisplayName()
Get the display name, that is the lexical QName in the form [prefix:]local-part- Specified by:
getDisplayName
in interfaceNodeName
- Returns:
- the lexical QName
-
getPrefix
public java.lang.String getPrefix()
Get the prefix of the QName.
-
getURI
public java.lang.String getURI()
Get the namespace URI of the QName.
-
getLocalPart
public java.lang.String getLocalPart()
Get the local part of the QName- Specified by:
getLocalPart
in interfaceNodeName
- Returns:
- the local part of the QName
-
getStructuredQName
public StructuredQName getStructuredQName()
Get the name in the form of a StructuredQName- Specified by:
getStructuredQName
in interfaceNodeName
- Returns:
- the name in the form of a StructuredQName
-
hasURI
public boolean hasURI(java.lang.String ns)
Test whether this name is in a given namespace
-
getNamespaceBinding
public NamespaceBinding getNamespaceBinding()
Get aNamespaceBinding
whose (prefix, uri) pair are the prefix and URI of this node name- Specified by:
getNamespaceBinding
in interfaceNodeName
- Returns:
- the corresponding NamespaceBinding
-
identityHashCode
public int identityHashCode()
Get a hashCode that offers the guarantee that if A.isIdentical(B), then A.identityHashCode() == B.identityHashCode()- Specified by:
identityHashCode
in interfaceIdentityComparable
- Returns:
- a hashCode suitable for use when testing for identity.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Returns a hash code value for the object.- Overrides:
hashCode
in classjava.lang.Object
-
isIdentical
public boolean isIdentical(IdentityComparable other)
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 interfaceIdentityComparable
- Parameters:
other
- the value to be compared with- Returns:
- true if the two values are identical, false otherwise
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-