SymbolTable
| Modifier and Type | Class and Description |
|---|---|
| protected static class | SoftReferenceSymbolTable.SREntry
This class is a symbol table entry. |
| protected static class |
| Modifier and Type | Field and Description |
|---|---|
| protected SoftReferenceSymbolTable. | |
| private final ReferenceQueue |
| Access | Constructor and Description |
|---|---|
| public | SoftReferenceSymbolTable(int
the initial capacity of the SymbolTable. initialCapacity, float the load factor of the SymbolTable. loadFactor)Constructs a new, empty SymbolTable with the specified initial capacity and the specified load factor. |
| public | SoftReferenceSymbolTable(int
the initial capacity of the hashtable. initialCapacity)Constructs a new, empty SymbolTable with the specified initial capacity and default load factor, which is 0.75. |
| public | SoftReferenceSymbolTable()
Constructs a new, empty SymbolTable with a default initial capacity (101) and load factor, which is 0.75. |
| Modifier and Type | Method and Description |
|---|---|
| public String | addSymbol(String
The new symbol. symbol)Overrides org. |
| public String | addSymbol(char[]
The buffer containing the new symbol. buffer, int The offset into the buffer of the new symbol. offset, int The length of the new symbol in the buffer. length)Overrides org. |
| private String | addSymbol0(String symbol, int bucket, int collisionCount)
|
| private String | addSymbol0(char[] buffer, int offset, int length, int bucket, int collisionCount)
|
| private void | |
| protected void | compact()
Reduces the capacity of and internally reorganizes this SymbolTable, in order to accommodate and access its entries in a more memory efficient way. |
| public boolean | containsSymbol(String
The symbol to look for. symbol)Overrides org. |
| public boolean | containsSymbol(char[]
The buffer containing the symbol to look for. buffer, int The offset into the buffer. offset, int The length of the symbol in the buffer. length)Overrides org. |
| protected void | rebalance()
Overrides org. |
| protected void | rehash()
Overrides org. |
| private void | |
| private void |
| fBuckets | back to summary |
|---|---|
| protected SoftReferenceSymbolTable. | |
| fReferenceQueue | back to summary |
|---|---|
| private final ReferenceQueue<T> fReferenceQueue | |
| SoftReferenceSymbolTable | back to summary |
|---|---|
| public SoftReferenceSymbolTable(int initialCapacity, float loadFactor) Constructs a new, empty SymbolTable with the specified initial capacity and the specified load factor.
| |
| SoftReferenceSymbolTable | back to summary |
|---|---|
| public SoftReferenceSymbolTable(int initialCapacity) Constructs a new, empty SymbolTable with the specified initial capacity and default load factor, which is 0.75.
| |
| SoftReferenceSymbolTable | back to summary |
|---|---|
| public SoftReferenceSymbolTable() Constructs a new, empty SymbolTable with a default initial capacity (101) and load factor, which is 0.75. | |
| addSymbol | back to summary |
|---|---|
| public String addSymbol(String symbol) Overrides org. Adds the specified symbol to the symbol table and returns a reference to the unique symbol. If the symbol already exists, the previous symbol reference is returned instead, in order guarantee that symbol references remain unique.
| |
| addSymbol | back to summary |
|---|---|
| public String addSymbol(char[] buffer, int offset, int length) Overrides org. Adds the specified symbol to the symbol table and returns a reference to the unique symbol. If the symbol already exists, the previous symbol reference is returned instead, in order guarantee that symbol references remain unique.
| |
| addSymbol0 | back to summary |
|---|---|
| private String addSymbol0(String symbol, int bucket, int collisionCount) | |
| addSymbol0 | back to summary |
|---|---|
| private String addSymbol0(char[] buffer, int offset, int length, int bucket, int collisionCount) | |
| clean | back to summary |
|---|---|
| private void clean() Removes stale symbols from the table. | |
| compact | back to summary |
|---|---|
| protected void compact() Reduces the capacity of and internally reorganizes this SymbolTable, in order to accommodate and access its entries in a more memory efficient way. This method is called automatically when the number of keys in the SymbolTable drops below 25% of this hashtable's load factor (as a result of SoftReferences which have been cleared). | |
| containsSymbol | back to summary |
|---|---|
| public boolean containsSymbol(String symbol) Overrides org. Returns true if the symbol table already contains the specified symbol.
| |
| containsSymbol | back to summary |
|---|---|
| public boolean containsSymbol(char[] buffer, int offset, int length) Overrides org. Returns true if the symbol table already contains the specified symbol.
| |
| rebalance | back to summary |
|---|---|
| protected void rebalance() Overrides org. Randomly selects a new hash function and reorganizes this SymbolTable in order to more evenly distribute its entries across the table. This method is called automatically when the number keys in one of the SymbolTable's buckets exceeds the given collision threshold. | |
| rehash | back to summary |
|---|---|
| protected void rehash() Overrides org. Increases the capacity of and internally reorganizes this SymbolTable, in order to accommodate and access its entries more efficiently. This method is called automatically when the number of keys in the SymbolTable exceeds this hashtable's capacity and load factor. | |
| rehashCommon | back to summary |
|---|---|
| private void rehashCommon(final int newCapacity) | |
| removeEntry | back to summary |
|---|---|
| private void removeEntry(SoftReferenceSymbolTable. | |
| Modifier and Type | Field and Description |
|---|---|
| public int | bucket
The bucket this entry is contained in; -1 if it has been removed from the table. |
| public SoftReferenceSymbolTable. | next
Hides java. |
| public SoftReferenceSymbolTable. | prev
The previous entry. |
| Access | Constructor and Description |
|---|---|
| public | SREntry(String internedSymbol, SoftReferenceSymbolTable.
Constructs a new entry from the specified symbol and next entry reference. |
| public | SREntry(String internedSymbol, char[] ch, int offset, int length, SoftReferenceSymbolTable.
Constructs a new entry from the specified symbol information and next entry reference. |
| Modifier and Type | Method and Description |
|---|---|
| private void |
| bucket | back to summary |
|---|---|
| public int bucket The bucket this entry is contained in; -1 if it has been removed from the table. | |
| next | back to summary |
|---|---|
| public SoftReferenceSymbolTable. Hides java. The next entry. | |
| prev | back to summary |
|---|---|
| public SoftReferenceSymbolTable. The previous entry. | |
| SREntry | back to summary |
|---|---|
| public SREntry(String internedSymbol, SoftReferenceSymbolTable. Constructs a new entry from the specified symbol and next entry reference. | |
| SREntry | back to summary |
|---|---|
| public SREntry(String internedSymbol, char[] ch, int offset, int length, SoftReferenceSymbolTable. Constructs a new entry from the specified symbol information and next entry reference. | |
| initialize | back to summary |
|---|---|
| private void initialize(SoftReferenceSymbolTable. | |
| Modifier and Type | Field and Description |
|---|---|
| public final char[] | |
| public final String |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| characters | back to summary |
|---|---|
| public final char[] characters | |
| symbol | back to summary |
|---|---|
| public final String symbol | |
| SREntryData | back to summary |
|---|---|
| public SREntryData(String internedSymbol) | |
| SREntryData | back to summary |
|---|---|
| public SREntryData(String internedSymbol, char[] ch, int offset, int length) | |