Class CharBasedPNameTable
java.lang.Object
com.fasterxml.aalto.util.NameTable
com.fasterxml.aalto.in.CharBasedPNameTable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.fasterxml.aalto.in.CharBasedPNameTable.Bucket[]Overflow buckets; if primary doesn't match, lookup is done from here.protected booleanFlag 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 intMask used to get index from hash values; equal tomBuckets.length - 1, when mBuckets.length is a power of two.protected intCurrent size (number of entries); needed to know if and when rehash.protected intLimit that indicates maximum size this instance can hold before it needs to be expanded and rehashed.protected PNameC[]Primary matching symbols; it's expected most match occur from here.protected static final float -
Constructor Summary
ConstructorsConstructorDescriptionCharBasedPNameTable(int initialSize) Main method for constructing a master symbol table instance; will be called by other public constructors. -
Method Summary
Modifier and TypeMethodDescriptionaddSymbol(char[] buffer, int start, int len, int hash) findSymbol(char[] buffer, int start, int len, int hash) booleanMethod called to check to quickly see if a child symbol table may have gotten additional entries.voidMethod that allows contents of child table to potentially be "merged in" with contents of this symbol table.intsize()
-
Field Details
-
DEFAULT_FILL_FACTOR
protected static final float DEFAULT_FILL_FACTOR- See Also:
-
_symbols
Primary matching symbols; it's expected most match occur from here. -
_buckets
protected com.fasterxml.aalto.in.CharBasedPNameTable.Bucket[] _bucketsOverflow buckets; if primary doesn't match, lookup is done from here.Note: Number of buckets is half of number of symbol entries, on assumption there's less need for buckets.
-
_size
protected int _sizeCurrent size (number of entries); needed to know if and when rehash. -
_sizeThreshold
protected int _sizeThresholdLimit that indicates maximum size this instance can hold before it needs to be expanded and rehashed. Calculated using fill factor passed in to constructor. -
_indexMask
protected int _indexMaskMask used to get index from hash values; equal tomBuckets.length - 1, when mBuckets.length is a power of two. -
_dirty
protected boolean _dirtyFlag 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.
-
-
Constructor Details
-
CharBasedPNameTable
public CharBasedPNameTable(int initialSize) Main method for constructing a master symbol table instance; will be called by other public constructors.- Parameters:
initialSize- Minimum initial size for bucket array; internally will always use a power of two equal to or bigger than this value.
-
-
Method Details
-
mergeFromChild
Method that allows contents of child table to potentially be "merged in" with contents of this symbol table.Note that caller has to make sure symbol table passed in is really a child or sibling of this symbol table.
-
size
-
maybeDirty
public boolean maybeDirty()Description copied from class:NameTableMethod 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.- Specified by:
maybeDirtyin classNameTable
-
findSymbol
-
addSymbol
-