Class FingerprintedQName
java.lang.Object
net.sf.saxon.om.StructuredQName
net.sf.saxon.om.FingerprintedQName
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionFingerprintedQName(String prefix, String uri, String localName) FingerprintedQName(String prefix, String uri, String localName, int nameCode) -
Method Summary
Modifier and TypeMethodDescriptionintallocateNameCode(NamePool pool) Allocate a nameCode from the NamePool (if none has already been allocated).booleanCompare two StructuredQName values for equality.static FingerprintedQNamefromClarkName(String expandedName) Make a structuredQName from a Clark nameintGet the fingerprint of this name if known.intGet the nameCode of this name if known.booleanAsk whether this node name representation has a known namecode and fingerprintvoidsetNameCode(int nameCode) Set the nameCode for this QName.Methods inherited from class StructuredQName
computeHashCode, fromLexicalQName, getClarkName, getDisplayName, getLocalPart, getNamespaceBinding, getPrefix, getStructuredQName, getURI, hashCode, isInNamespace, isInSameNamespace, toJaxpQName, toStringMethods inherited from interface NodeName
getDisplayName, getLocalPart, getNamespaceBinding, getPrefix, getStructuredQName, getURI, isInNamespace, isInSameNamespace
-
Constructor Details
-
FingerprintedQName
-
FingerprintedQName
-
-
Method Details
-
fromClarkName
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:
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
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
Description copied from class:StructuredQNameCompare two StructuredQName values for equality. This compares the URI and local name parts, excluding any prefix- Overrides:
equalsin classStructuredQName
-