The hash code uses the same algorithm as SymbolTable class.
| Modifier and Type | Class and Description |
|---|---|
| protected static class | SymbolHash.Entry
This class is a key table entry. |
| Modifier and Type | Field and Description |
|---|---|
| protected SymbolHash. | fBuckets
Buckets. |
| protected int[] | fHashMultipliers
Array of randomly selected hash function multipliers or |
| protected int | fNum
Number of elements. |
| protected int | fTableSize
Actual table size |
| protected static final int | MAX_HASH_COLLISIONS
Maximum hash collisions per bucket. |
| protected static final int | |
| protected static final int | |
| protected static final int | TABLE_SIZE
Default table size. |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public Object | |
| public Object[] | |
| public int | Returns: the number of key/value pairs stored in this table.Get the number of key/value pairs stored in this table. |
| public int | |
| protected int | |
| private int | |
| public SymbolHash | |
| public void | |
| protected void | rebalance()
Randomly selects a new hash function and reorganizes this SymbolHash in order to more evenly distribute its entries across the table. |
| protected void | rehash()
Increases the capacity of and internally reorganizes this SymbolHash, in order to accommodate and access its entries more efficiently. |
| private void | |
| protected SymbolHash. |
| fBuckets | back to summary |
|---|---|
| protected SymbolHash. Buckets. | |
| fHashMultipliers | back to summary |
|---|---|
| protected int[] fHashMultipliers Array of randomly selected hash function multipliers or | |
| fNum | back to summary |
|---|---|
| protected int fNum Number of elements. | |
| fTableSize | back to summary |
|---|---|
| protected int fTableSize Actual table size | |
| MAX_HASH_COLLISIONS | back to summary |
|---|---|
| protected static final int MAX_HASH_COLLISIONS Maximum hash collisions per bucket. | |
| MULTIPLIERS_MASK | back to summary |
|---|---|
| protected static final int MULTIPLIERS_MASK | |
| MULTIPLIERS_SIZE | back to summary |
|---|---|
| protected static final int MULTIPLIERS_SIZE | |
| TABLE_SIZE | back to summary |
|---|---|
| protected static final int TABLE_SIZE Default table size. | |
| SymbolHash | back to summary |
|---|---|
| public SymbolHash() Constructs a key table with the default size. | |
| SymbolHash | back to summary |
|---|---|
| public SymbolHash(int size) Constructs a key table with a given size.
| |
| clear | back to summary |
|---|---|
| public void clear() Remove all key/value association. This tries to save a bit of GC'ing by at least keeping the fBuckets array around. | |
| get | back to summary |
|---|---|
| public Object get(Object key) Get the value associated with the given key.
| |
| getEntries | back to summary |
|---|---|
| public Object[] getEntries() Return key/value pairs of all entries in the map | |
| getLength | back to summary |
|---|---|
| public int getLength() Get the number of key/value pairs stored in this table.
| |
| getValues | back to summary |
|---|---|
| public int getValues(Object[] elements, int from) Add all values to the given array. The array must have enough entry.
| |
| hash | back to summary |
|---|---|
| protected int hash(Object key) Returns a hashcode value for the specified key.
| |
| hash0 | back to summary |
|---|---|
| private int hash0(String symbol) | |
| makeClone | back to summary |
|---|---|
| public SymbolHash makeClone() Make a clone of this object. | |
| put | back to summary |
|---|---|
| public void put(Object key, Object value) Adds the key/value mapping to the key table. If the key already exists, the previous value associated with this key is overwritten by the new value. | |
| rebalance | back to summary |
|---|---|
| protected void rebalance() Randomly selects a new hash function and reorganizes this SymbolHash in order to more evenly distribute its entries across the table. This method is called automatically when the number keys in one of the SymbolHash's buckets exceeds MAX_HASH_COLLISIONS. | |
| rehash | back to summary |
|---|---|
| protected void rehash() Increases the capacity of and internally reorganizes this SymbolHash, in order to accommodate and access its entries more efficiently. This method is called automatically when the number of keys in the SymbolHash exceeds its number of buckets. | |
| rehashCommon | back to summary |
|---|---|
| private void rehashCommon(final int newCapacity) | |
| search | back to summary |
|---|---|
| protected SymbolHash. | |
| Modifier and Type | Field and Description |
|---|---|
| public Object | |
| public SymbolHash. | next
The next entry. |
| public Object |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public SymbolHash. |
| key | back to summary |
|---|---|
| public Object key | |
| next | back to summary |
|---|---|
| public SymbolHash. The next entry. | |
| value | back to summary |
|---|---|
| public Object value | |
| Entry | back to summary |
|---|---|
| public Entry() | |
| Entry | back to summary |
|---|---|
| public Entry(Object key, Object value, SymbolHash. | |
| makeClone | back to summary |
|---|---|
| public SymbolHash. | |