Modifier and Type | Field and Description |
---|---|
protected com.fasterxml.aalto.in.CharBasedPNameTable.Bucket[] |
_buckets
Overflow buckets; if primary doesn't match, lookup is done
from here.
|
protected boolean |
_dirty
Flag that indicates if any changes have been made to the data;
used to both determine if bucket array needs to be copied when
(first) change is made, and potentially if updated bucket list
is to be resync'ed back to master instance.
|
protected int |
_indexMask
Mask used to get index from hash values; equal to
mBuckets.length - 1 , when mBuckets.length is
a power of two. |
protected int |
_size
Current size (number of entries); needed to know if and when
rehash.
|
protected int |
_sizeThreshold
Limit that indicates maximum size this instance can hold before
it needs to be expanded and rehashed.
|
protected PNameC[] |
_symbols
Primary matching symbols; it's expected most match occur from
here.
|
protected static float |
DEFAULT_FILL_FACTOR |
Constructor and Description |
---|
CharBasedPNameTable(int initialSize)
Main method for constructing a master symbol table instance; will
be called by other public constructors.
|
Modifier and Type | Method and Description |
---|---|
PNameC |
addSymbol(char[] buffer,
int start,
int len,
int hash) |
PNameC |
findSymbol(char[] buffer,
int start,
int len,
int hash) |
boolean |
maybeDirty()
Method called to check to quickly see if a child symbol table
may have gotten additional entries.
|
void |
mergeFromChild(CharBasedPNameTable child)
Method that allows contents of child table to potentially be
"merged in" with contents of this symbol table.
|
int |
size() |
protected static final float DEFAULT_FILL_FACTOR
protected PNameC[] _symbols
protected com.fasterxml.aalto.in.CharBasedPNameTable.Bucket[] _buckets
Note: Number of buckets is half of number of symbol entries, on assumption there's less need for buckets.
protected int _size
protected int _sizeThreshold
protected int _indexMask
mBuckets.length - 1
, when mBuckets.length is
a power of two.protected boolean _dirty
public CharBasedPNameTable(int initialSize)
initialSize
- Minimum initial size for bucket array; internally
will always use a power of two equal to or bigger than this value.public void mergeFromChild(CharBasedPNameTable child)
Note that caller has to make sure symbol table passed in is really a child or sibling of this symbol table.
public boolean maybeDirty()
NameTable
maybeDirty
in class NameTable
public PNameC findSymbol(char[] buffer, int start, int len, int hash)
public PNameC addSymbol(char[] buffer, int start, int len, int hash)
Copyright © 2019 FasterXML. All rights reserved.