Package com.fasterxml.aalto.in
Class PNameC
java.lang.Object
com.fasterxml.aalto.in.PName
com.fasterxml.aalto.in.PNameC
An alternate implementation of PName: instead of coming straight from
byte contents, it is actually just built from a character array.
Note: one unfortunate result of this being a somewhat different PName is that equality comparison between this and other implementations will not work as expected. As such, these should only be used as temporary names.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final int
Since the hash may be calculated different from the way eventual String's hash will be (right now it is not), we better store "our" hash here.Fields inherited from class com.fasterxml.aalto.in.PName
_localName, _namespaceBinding, _prefix, _prefixedName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
calcHash
(char[] buffer, int start, int len) Implementation of a hashing method for variable length Strings.static int
static PNameC
static PNameC
createBoundName
(NsBinding nsb) boolean
equalsPName
(char[] buffer, int start, int len, int hash) int
int
final int
int
getQuad
(int index) int
hashCode()
Whether we should use internal hash, or the hash of prefixed name string itself is an open question.int
This method should never get called on instances of this class, so let's throw an exception if that does happen.Methods inherited from class com.fasterxml.aalto.in.PName
boundEquals, boundEquals, boundHashCode, boundHashCode, constructQName, constructQName, equals, getLocalName, getNsBinding, getNsUri, getPrefix, getPrefixedName, hasPrefix, hasPrefixedName, isBound, needsBinding, toString, unboundEquals, unboundHashCode
-
Field Details
-
mHash
protected final int mHashSince the hash may be calculated different from the way eventual String's hash will be (right now it is not), we better store "our" hash here.
-
-
Constructor Details
-
PNameC
-
-
Method Details
-
createBoundName
- Specified by:
createBoundName
in classPName
-
construct
-
construct
-
equalsPName
public boolean equalsPName(char[] buffer, int start, int len, int hash) -
getCustomHash
public int getCustomHash() -
calcHash
public static int calcHash(char[] buffer, int start, int len) Implementation of a hashing method for variable length Strings. Most of the time intention is that this calculation is done by caller during parsing, not here; however, sometimes it needs to be done for parsed "String" too.- Parameters:
len
- Length of String; has to be at least 1 (caller guarantees this pre-condition)
-
calcHash
-
sizeInQuads
public int sizeInQuads()This method should never get called on instances of this class, so let's throw an exception if that does happen.- Specified by:
sizeInQuads
in classPName
-
getFirstQuad
public int getFirstQuad()- Specified by:
getFirstQuad
in classPName
-
getLastQuad
public final int getLastQuad()- Specified by:
getLastQuad
in classPName
-
getQuad
public int getQuad(int index) -
hashCode
public int hashCode()Whether we should use internal hash, or the hash of prefixed name string itself is an open question. For now, let's use former.
-