Package com.fasterxml.aalto.in
Class PNameC
- java.lang.Object
-
- com.fasterxml.aalto.in.PName
-
- com.fasterxml.aalto.in.PNameC
-
public final class PNameC extends PName
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
Fields Modifier and Type Field Description protected intmHashSince 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 Constructor Description PNameC(java.lang.String pname, java.lang.String prefix, java.lang.String ln, int hash)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intcalcHash(char[] buffer, int start, int len)Implementation of a hashing method for variable length Strings.static intcalcHash(java.lang.String key)static PNameCconstruct(java.lang.String pname)static PNameCconstruct(java.lang.String pname, int hash)PNamecreateBoundName(NsBinding nsb)booleanequalsPName(char[] buffer, int start, int len, int hash)intgetCustomHash()intgetFirstQuad()intgetLastQuad()intgetQuad(int index)inthashCode()Whether we should use internal hash, or the hash of prefixed name string itself is an open question.intsizeInQuads()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
-
-
-
-
Method Detail
-
createBoundName
public PName createBoundName(NsBinding nsb)
- Specified by:
createBoundNamein classPName
-
construct
public static PNameC construct(java.lang.String pname)
-
construct
public static PNameC construct(java.lang.String pname, int hash)
-
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
public static int calcHash(java.lang.String key)
-
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
-
-