Package net.sf.saxon.om
Class FingerprintedQName
- java.lang.Object
-
- net.sf.saxon.om.StructuredQName
-
- net.sf.saxon.om.FingerprintedQName
-
- All Implemented Interfaces:
NodeName
public class FingerprintedQName extends StructuredQName 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 nameCode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intallocateNameCode(NamePool pool)Allocate a nameCode from the NamePool (if none has already been allocated).booleanequals(java.lang.Object other)Compare two StructuredQName values for equality.static FingerprintedQNamefromClarkName(java.lang.String expandedName)Make a structuredQName from a Clark nameintgetFingerprint()Get the fingerprint of this name if known.intgetNameCode()Get the nameCode of this name if known.booleanhasFingerprint()Ask whether this node name representation has a known namecode and fingerprintvoidsetNameCode(int nameCode)Set the nameCode for this QName.-
Methods inherited from class net.sf.saxon.om.StructuredQName
computeHashCode, fromLexicalQName, getClarkName, getDisplayName, getLocalPart, getNamespaceBinding, getPrefix, getStructuredQName, getURI, hashCode, isInNamespace, isInSameNamespace, toJaxpQName, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.NodeName
getDisplayName, getLocalPart, getNamespaceBinding, getPrefix, getStructuredQName, getURI, isInNamespace, isInSameNamespace
-
-
-
-
Method Detail
-
fromClarkName
public static FingerprintedQName fromClarkName(java.lang.String expandedName)
Make a structuredQName 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 StructuredQName
- Throws:
java.lang.IllegalArgumentException- if the Clark name is malformed
-
hasFingerprint
public boolean hasFingerprint()
Ask whether this node name representation has a known namecode and fingerprint- Specified by:
hasFingerprintin interfaceNodeName- Overrides:
hasFingerprintin classStructuredQName- 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:
getFingerprintin interfaceNodeName- Overrides:
getFingerprintin classStructuredQName- 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:
getNameCodein interfaceNodeName- Overrides:
getNameCodein classStructuredQName- Returns:
- the fingerprint if known; otherwise -1
-
setNameCode
public void setNameCode(int nameCode)
Set the nameCode for this QName. Note that this modifies the FingerprintedQName object and makes it unusable with a different NamePool.- Parameters:
nameCode- the nameCode associated with this QName by the NamePool
-
allocateNameCode
public int allocateNameCode(NamePool pool)
Allocate a nameCode from the NamePool (if none has already been allocated). Note that this modifies the FingerprintedQName object and makes it unusable with a different NamePool.- Specified by:
allocateNameCodein interfaceNodeName- Parameters:
pool- the namePool- Returns:
- the allocated name code (or the existing namecode if there already was one)
-
equals
public boolean equals(java.lang.Object other)
Description copied from class:StructuredQNameCompare two StructuredQName values for equality. This compares the URI and local name parts, excluding any prefix- Overrides:
equalsin classStructuredQName
-
-