|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.fasterxml.aalto.util.NameTable
com.fasterxml.aalto.in.ByteBasedPNameTable
public final class ByteBasedPNameTable
This is a symbol table implementation used for storing byte-based
PNames
, specifically, instances of (ByteBasedPName
).
Constructor Summary | |
---|---|
ByteBasedPNameTable(int hashSize)
|
Method Summary | |
---|---|
ByteBasedPName |
addSymbol(int hash,
String symbolStr,
int colonIx,
int[] quads,
int qlen)
|
ByteBasedPName |
addSymbol(int hash,
String symbolStr,
int colonIx,
int firstQuad,
int secondQuad)
|
static int |
calcHash(int firstQuad)
|
static int |
calcHash(int[] quads,
int qlen)
|
static int |
calcHash(int firstQuad,
int secondQuad)
|
static int[] |
calcQuads(byte[] wordBytes)
|
ByteBasedPName |
findSymbol(int hash,
int[] quads,
int qlen)
Finds and returns name matching the specified symbol, if such name already exists in the table; or if not, creates name object, adds to the table, and returns it. |
ByteBasedPName |
findSymbol(int hash,
int firstQuad,
int secondQuad)
Finds and returns name matching the specified symbol, if such name already exists in the table; or if not, creates name object, adds to the table, and returns it. |
void |
markAsShared()
|
boolean |
maybeDirty()
Method called to check to quickly see if a child symbol table may have gotten additional entries. |
boolean |
mergeFromChild(ByteBasedPNameTable child)
|
void |
nuke()
Method used by test code, to reset state of the name table. |
int |
size()
|
String |
toDebugString()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ByteBasedPNameTable(int hashSize)
Method Detail |
---|
public boolean mergeFromChild(ByteBasedPNameTable child)
public void markAsShared()
public void nuke()
public int size()
size
in class NameTable
public boolean maybeDirty()
maybeDirty
in class NameTable
public ByteBasedPName findSymbol(int hash, int firstQuad, int secondQuad)
Note: separate methods to optimize common case of relatively short element/attribute names (8 or less ascii characters)
firstQuad
- int32 containing first 4 bytes of the pname;
if the whole name less than 4 bytes, padded with zero bytes
in front (zero MSBs, ie. right aligned)secondQuad
- int32 containing bytes 5 through 8 of the
pname; if less than 8 bytes, padded with up to 4 zero bytes
in front (zero MSBs, ie. right aligned)
public ByteBasedPName findSymbol(int hash, int[] quads, int qlen)
Note: this is the general purpose method that can be called for names of any length. However, if name is less than 9 bytes long, it is preferable to call the version optimized for short names.
quads
- Array of int32s, each of which contain 4 bytes of
encoded nameqlen
- Number of int32s, starting from index 0, in quads
parameter
public ByteBasedPName addSymbol(int hash, String symbolStr, int colonIx, int firstQuad, int secondQuad)
public ByteBasedPName addSymbol(int hash, String symbolStr, int colonIx, int[] quads, int qlen)
public static final int calcHash(int firstQuad)
public static final int calcHash(int firstQuad, int secondQuad)
public static final int calcHash(int[] quads, int qlen)
public static int[] calcQuads(byte[] wordBytes)
public String toString()
toString
in class Object
public String toDebugString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |