public class IntHashTable
extends java.lang.Object
OutPort
Modifier and Type | Field and Description |
---|---|
protected int[] |
ints |
protected int |
mask |
protected int |
num_bindings |
protected java.lang.Object[] |
objs |
Constructor and Description |
---|
IntHashTable()
Construct an Object-to-int hash table.
|
IntHashTable(int capacity)
Construct an Object-to-int hash table with a specified amount of mappings.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all mappings from this map.
|
int |
getFromIndex(int index)
Return the value stored at the specified index in the table.
|
int |
hash(java.lang.Object key)
Compute the hash code of a given object.
|
int |
lookup(java.lang.Object key)
Lookup a given key's value in the hash table.
|
int |
lookup(java.lang.Object key,
int hash)
Find either the index of a key's value, or the index of an available space.
|
int |
putAtIndex(java.lang.Object key,
int value,
int index)
Associates the specified key with the specified value in this map.
|
protected void |
rehash()
Expand the hash table when it exceeds the load factor.
|
int |
remove(java.lang.Object key) |
protected java.lang.Object[] objs
protected int[] ints
protected int mask
protected int num_bindings
public IntHashTable()
public IntHashTable(int capacity)
capacity
- The number of default mappings in this hash table.public int hash(java.lang.Object key)
key
- The object whose hash code is to be computed.public int lookup(java.lang.Object key, int hash)
key
- The key to whose value you want to find.hash
- The hash code of this key.public int lookup(java.lang.Object key)
key
- The key whose value you want to find.public int getFromIndex(int index)
index
- The index to inspect, as returned from lookup(java.lang.Object, int)
public int putAtIndex(java.lang.Object key, int value, int index)
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.index
- the index at which to place this binding, as returned
from lookup(java.lang.Object, int)
.public int remove(java.lang.Object key)
protected void rehash()
public void clear()