|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap<K,V>
gnu.kawa.util.AbstractHashTable<Entry,K,V>
public abstract class AbstractHashTable<Entry extends java.util.Map.Entry<K,V>,K,V>
An abstract hash map from K to V. The entries are represented by an Entry type parameter.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Field Summary | |
---|---|
static int |
DEFAULT_INITIAL_SIZE
|
protected int |
mask
|
protected int |
num_bindings
|
protected Entry[] |
table
|
Constructor Summary | |
---|---|
AbstractHashTable()
|
|
AbstractHashTable(int capacity)
|
Method Summary | |
---|---|
protected abstract Entry[] |
allocEntries(int n)
Allocate Entry[n]. |
void |
clear()
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
|
V |
get(java.lang.Object key)
Find value for given key. |
V |
get(java.lang.Object key,
V defaultValue)
Find value for given key. |
protected abstract int |
getEntryHashCode(Entry entry)
Extract hash-code from Entry. |
protected abstract Entry |
getEntryNext(Entry entry)
Extract next Entry in same hash-bucket. |
Entry |
getNode(java.lang.Object key)
Find Entry for given key. |
int |
hash(java.lang.Object key)
Calculate hash code of a key. |
protected int |
hashToIndex(int hash)
Map hash-code to bucket index in table. |
protected abstract Entry |
makeEntry(K key,
int hash,
V value)
Allocate a new node in the hash table. |
protected boolean |
matches(K key1,
java.lang.Object key2)
Compare two keys for equivalence. |
protected boolean |
matches(java.lang.Object key,
int hash,
Entry node)
True if an Entry matches a key. |
V |
put(K key,
int hash,
V value)
|
V |
put(K key,
V value)
|
protected void |
rehash()
|
V |
remove(java.lang.Object key)
|
protected abstract void |
setEntryNext(Entry entry,
Entry next)
Set next Entry in same hash-bucket. |
int |
size()
|
Methods inherited from class java.util.AbstractMap |
---|
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Entry extends java.util.Map.Entry<K,V>[] table
protected int mask
protected int num_bindings
public static final int DEFAULT_INITIAL_SIZE
Constructor Detail |
---|
public AbstractHashTable()
public AbstractHashTable(int capacity)
Method Detail |
---|
protected abstract int getEntryHashCode(Entry entry)
protected abstract Entry getEntryNext(Entry entry)
protected abstract void setEntryNext(Entry entry, Entry next)
protected abstract Entry[] allocEntries(int n)
protected abstract Entry makeEntry(K key, int hash, V value)
public int hash(java.lang.Object key)
protected int hashToIndex(int hash)
protected boolean matches(java.lang.Object key, int hash, Entry node)
protected boolean matches(K key1, java.lang.Object key2)
hash(Object)
method if you want
a different equivalence relation.
public V get(java.lang.Object key)
get
in interface java.util.Map<K,V>
get
in class java.util.AbstractMap<K,V>
public Entry getNode(java.lang.Object key)
public V get(java.lang.Object key, V defaultValue)
protected void rehash()
public V put(K key, V value)
put
in interface java.util.Map<K,V>
put
in class java.util.AbstractMap<K,V>
public V put(K key, int hash, V value)
public V remove(java.lang.Object key)
remove
in interface java.util.Map<K,V>
remove
in class java.util.AbstractMap<K,V>
public void clear()
clear
in interface java.util.Map<K,V>
clear
in class java.util.AbstractMap<K,V>
public int size()
size
in interface java.util.Map<K,V>
size
in class java.util.AbstractMap<K,V>
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet
in interface java.util.Map<K,V>
entrySet
in class java.util.AbstractMap<K,V>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |