|
JanosVM v1.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.utah.janosvm.kit.util.SharedTable
The SharedTable class is the core implementation of a hash table that can be shared between multiple teams.
Field Summary | |
private int |
depth
The table's position in the stack. |
private static int |
DEPTH_THRESHOLD
The maximum number of SharedTable object's to stack together. |
private Association[] |
entries
The array of references to Associations for this table. |
private int |
entryCount
The number of entries in this table. |
private static int |
INITIAL_OVERFLOW_SIZE
Default overflow array size for a new shared table. |
private static int |
INITIAL_PRIMARY_SIZE
Default primary array size for a new shared table. |
private SharedTable |
lastGeneration
Link to the next table in the stack. |
private int[] |
overflowLink
Array of indexes that link the collision list together. |
private int |
overflowTableSize
The size of the overflow array. |
private int |
overflowTableUsed
The number of slots used in the overflow array. |
private int |
primaryTableSize
The size of the primary hash table. |
Constructor Summary | |
|
SharedTable()
Construct a SharedTable with the default primary and overflow array sizes. |
private |
SharedTable(int primarySize,
int overflowSize)
Construct a SharedTable with the given primary and overflow array sizes. |
Method Summary | |
(package private) java.lang.Object |
get(java.lang.Object name)
Get an Association from the table using the given identifier object. |
int |
getEntryCount()
|
int |
getTotalEntryCount()
|
private int |
hashName(java.lang.Object name)
Compute the hash for the given identitifer object. |
(package private) SharedTable |
merge(SharedTable diff,
boolean collapse)
Merge the current table with the differences introduced by another table. |
(package private) void |
put(Association assoc)
Put an Association into the table. |
private void |
remove(java.lang.Object name)
Remove an Association with the given identifier from the table. |
void |
walk(SharedTableWriter stw,
SharedTableWalker walker)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait, wait0 |
Field Detail |
private static final int DEPTH_THRESHOLD
private static final int INITIAL_PRIMARY_SIZE
private static final int INITIAL_OVERFLOW_SIZE
private SharedTable lastGeneration
private int depth
private Association[] entries
private final int primaryTableSize
private int[] overflowLink
private int overflowTableUsed
private final int overflowTableSize
private int entryCount
Constructor Detail |
public SharedTable()
private SharedTable(int primarySize, int overflowSize)
primarySize
- The size of the primary hash table array.overflowSize
- The size of the overflow array for the table.Method Detail |
public int getEntryCount()
public int getTotalEntryCount()
private int hashName(java.lang.Object name)
name
- The identifier to hash.void put(Association assoc) throws TableFullException
assoc
- The Association object to put in the table.Throws
- TableFullException if the overflow array is full and
can't accomodate anymore elements.java.lang.Object get(java.lang.Object name)
name
- The identifier to lookup in the table.private void remove(java.lang.Object name)
name
- The identifier to lookup and remove from the table.public void walk(SharedTableWriter stw, SharedTableWalker walker)
SharedTable merge(SharedTable diff, boolean collapse)
diff
- A table containing changes to the current table.collapse
- Force the stack of tables to be coalesced into acollapse
- single table.
|
JanosVM v1.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |