PNames, specifically, instances of (ByteBasedPName).
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final int | |
| pack-priv static final int | LAST_VALID_BUCKET
Bucket index is 8 bits, and value 0 is reserved to represent 'empty' status. |
| private int | mCollCount
Total number of PNames in collision buckets (included in
|
| private int | mCollEnd
Index of the first unused collision bucket entry (== size of the used portion of collision list): less than or equal to 0xFF (255), since max number of entries is 255 (8-bit, minus 0 used as 'empty' marker) |
| private ByteBasedPNameTable. | mCollList
Array of heads of collision bucket chains; size dynamically |
| private boolean | mCollListShared
Flag that indicates whether underlying data structures for the collision list are shared or not. |
| private int | mCount
Total number of PNames in the symbol table |
| pack-priv static final int | |
| private int[] | mMainHash
Array of 2^N size, which contains combination of 24-bits of hash (0 to indicate 'empty' slot), and 8-bit collision bucket index (0 to indicate empty collision bucket chain; otherwise subtract one from index) |
| private int | mMainHashMask
Mask used to truncate 32-bit hash value to current hash array size; essentially, hash array size - 1 (since hash array sizes are 2^N). |
| private boolean | mMainHashShared
Flag that indicates whether underlying data structures for the main hash area are shared or not. |
| private ByteBasedPName[] | mMainNames
Array that contains |
| private boolean | |
| private transient boolean | mNeedRehash
This flag is set if, after adding a new entry, it is deemed that a rehash is warranted if any more entries are to be added. |
| Access | Constructor and Description |
|---|---|
| public | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBasedPName | |
| public ByteBasedPName | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static int[] | |
| private void | |
| private void | |
| private int | findBestBucket()
Method called to find the best bucket to spill a PName over to: usually the first bucket that has only one entry, but in general first one of the buckets with least number of entries |
| public ByteBasedPName | Returns: PName matching the symbol passed (or constructed for it)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) firstQuad, int 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) 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. |
| public ByteBasedPName | Returns: PName matching the symbol passed (or constructed for it)Array of int32s, each of which contain 4 bytes of
encoded name quads, int Number of int32s, starting from index 0, in quads
parameter 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. |
| public void | |
| public boolean | maybeDirty()
Implements abstract com. |
| public boolean | |
| public void | |
| private void | |
| public int | |
| public String | |
| private void | |
| private void | |
| private void |
| INITIAL_COLLISION_LEN | back to summary |
|---|---|
| pack-priv static final int INITIAL_COLLISION_LEN | |
| LAST_VALID_BUCKET | back to summary |
|---|---|
| pack-priv static final int LAST_VALID_BUCKET Bucket index is 8 bits, and value 0 is reserved to represent 'empty' status. | |
| mCollCount | back to summary |
|---|---|
| private int mCollCount Total number of PNames in collision buckets (included in
| |
| mCollEnd | back to summary |
|---|---|
| private int mCollEnd Index of the first unused collision bucket entry (== size of the used portion of collision list): less than or equal to 0xFF (255), since max number of entries is 255 (8-bit, minus 0 used as 'empty' marker) | |
| mCollList | back to summary |
|---|---|
| private ByteBasedPNameTable. Array of heads of collision bucket chains; size dynamically | |
| mCollListShared | back to summary |
|---|---|
| private boolean mCollListShared Flag that indicates whether underlying data structures for the collision list are shared or not. If they are, then they need to be handled in copy-on-write way, i.e. if they need to be modified, a copy needs to be made first; at this point it will not be shared any more, and can be modified. This flag needs to be checked when adding new collision entries. | |
| mCount | back to summary |
|---|---|
| private int mCount Total number of PNames in the symbol table | |
| MIN_HASH_SIZE | back to summary |
|---|---|
| pack-priv static final int MIN_HASH_SIZE | |
| mMainHash | back to summary |
|---|---|
| private int[] mMainHash Array of 2^N size, which contains combination of 24-bits of hash (0 to indicate 'empty' slot), and 8-bit collision bucket index (0 to indicate empty collision bucket chain; otherwise subtract one from index) | |
| mMainHashMask | back to summary |
|---|---|
| private int mMainHashMask Mask used to truncate 32-bit hash value to current hash array size; essentially, hash array size - 1 (since hash array sizes are 2^N). | |
| mMainHashShared | back to summary |
|---|---|
| private boolean mMainHashShared Flag that indicates whether underlying data structures for the main hash area are shared or not. If they are, then they need to be handled in copy-on-write way, i.e. if they need to be modified, a copy needs to be made first; at this point it will not be shared any more, and can be modified. This flag needs to be checked both when adding new main entries, and when adding new collision list queues (i.e. creating a new collision list head entry) | |
| mMainNames | back to summary |
|---|---|
| private ByteBasedPName[] mMainNames Array that contains | |
| mMainNamesShared | back to summary |
|---|---|
| private boolean mMainNamesShared | |
| mNeedRehash | back to summary |
|---|---|
| private transient boolean mNeedRehash This flag is set if, after adding a new entry, it is deemed that a rehash is warranted if any more entries are to be added. | |
| ByteBasedPNameTable | back to summary |
|---|---|
| public ByteBasedPNameTable(int hashSize) | |
| ByteBasedPNameTable | back to summary |
|---|---|
| pack-priv ByteBasedPNameTable(ByteBasedPNameTable parent) Constructor used when creating a child instance | |
| addSymbol | back to summary |
|---|---|
| public ByteBasedPName addSymbol(int hash, String symbolStr, int colonIx, int firstQuad, int secondQuad) | |
| addSymbol | back to summary |
|---|---|
| public ByteBasedPName addSymbol(int hash, String symbolStr, int colonIx, int[] quads, int qlen) | |
| calcHash | back to summary |
|---|---|
| public static final int calcHash(int firstQuad) | |
| calcHash | back to summary |
|---|---|
| public static final int calcHash(int firstQuad, int secondQuad) | |
| calcHash | back to summary |
|---|---|
| public static final int calcHash(int[] quads, int qlen) | |
| calcQuads | back to summary |
|---|---|
| public static int[] calcQuads(byte[] wordBytes) | |
| doAddSymbol | back to summary |
|---|---|
| private void doAddSymbol(int hash, ByteBasedPName symbol) | |
| expandCollision | back to summary |
|---|---|
| private void expandCollision() | |
| findBestBucket | back to summary |
|---|---|
| private int findBestBucket() Method called to find the best bucket to spill a PName over to: usually the first bucket that has only one entry, but in general first one of the buckets with least number of entries | |
| findSymbol | back to summary |
|---|---|
| public 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. Note separate methods to optimize common case of relatively short element/attribute names (8 or less ascii characters)
| |
| findSymbol | back to summary |
|---|---|
| public 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. 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.
| |
| markAsShared | back to summary |
|---|---|
| public void markAsShared() | |
| maybeDirty | back to summary |
|---|---|
| public boolean maybeDirty() Implements abstract com. Method called to check to quickly see if a child symbol table may have gotten additional entries. Used for checking to see if a child table should be merged into shared table.
| |
| mergeFromChild | back to summary |
|---|---|
| public boolean mergeFromChild(ByteBasedPNameTable child) | |
| nuke | back to summary |
|---|---|
| public void nuke() Method used by test code, to reset state of the name table. | |
| rehash | back to summary |
|---|---|
| private void rehash() | |
| size | back to summary |
|---|---|
| public int size() Implements abstract com.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| unshareCollision | back to summary |
|---|---|
| private void unshareCollision() | |
| unshareMain | back to summary |
|---|---|
| private void unshareMain() Method that needs to be called, if the main hash structure is (may be) shared. This happens every time something is added, even if addition is to the collision list (since collision list index comes from lowest 8 bits of the primary hash entry) | |
| unshareNames | back to summary |
|---|---|
| private void unshareNames() | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final ByteBasedPName | |
| pack-priv final ByteBasedPNameTable. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBasedPName | |
| public ByteBasedPName | |
| public int |
| mName | back to summary |
|---|---|
| pack-priv final ByteBasedPName mName | |
| mNext | back to summary |
|---|---|
| pack-priv final ByteBasedPNameTable. | |
| Bucket | back to summary |
|---|---|
| pack-priv Bucket(ByteBasedPName name, ByteBasedPNameTable. | |
| find | back to summary |
|---|---|
| public ByteBasedPName find(int hash, int firstQuad, int secondQuad) | |
| find | back to summary |
|---|---|
| public ByteBasedPName find(int hash, int[] quads, int qlen) | |
| length | back to summary |
|---|---|
| public int length() | |