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 intSince 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 intcalcHash(char[] buffer, int start, int len) Implementation of a hashing method for variable length Strings.static intstatic PNameCstatic PNameCcreateBoundName(NsBinding nsb) booleanequalsPName(char[] buffer, int start, int len, int hash) intintfinal intintgetQuad(int index) inthashCode()Whether we should use internal hash, or the hash of prefixed name string itself is an open question.intThis 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:
createBoundNamein 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:
sizeInQuadsin classPName
-
getFirstQuad
public int getFirstQuad()- Specified by:
getFirstQuadin classPName
-
getLastQuad
public final int getLastQuad()- Specified by:
getLastQuadin 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.
-