gnu.kawa.util
Class WeakIdentityHashMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by gnu.kawa.util.AbstractHashTable<WeakHashNode<K,V>,K,V>
          extended by gnu.kawa.util.WeakIdentityHashMap<K,V>
All Implemented Interfaces:
java.util.Map<K,V>

public class WeakIdentityHashMap<K,V>
extends AbstractHashTable<WeakHashNode<K,V>,K,V>


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
 
Fields inherited from class gnu.kawa.util.AbstractHashTable
DEFAULT_INITIAL_SIZE, mask, num_bindings, table
 
Constructor Summary
WeakIdentityHashMap()
           
WeakIdentityHashMap(int capacity)
           
 
Method Summary
protected  WeakHashNode<K,V>[] allocEntries(int n)
          Allocate Entry[n].
 V get(java.lang.Object key, V defaultValue)
          Find value for given key.
protected  int getEntryHashCode(WeakHashNode<K,V> entry)
          Extract hash-code from Entry.
protected  WeakHashNode<K,V> getEntryNext(WeakHashNode<K,V> entry)
          Extract next Entry in same hash-bucket.
 int hash(java.lang.Object key)
          Calculate hash code of a key.
protected  WeakHashNode<K,V> 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.
 V put(K key, int hash, V value)
           
 V remove(java.lang.Object key)
           
protected  void setEntryNext(WeakHashNode<K,V> entry, WeakHashNode<K,V> next)
          Set next Entry in same hash-bucket.
 
Methods inherited from class gnu.kawa.util.AbstractHashTable
clear, entrySet, get, getNode, hashToIndex, matches, put, rehash, 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
 

Constructor Detail

WeakIdentityHashMap

public WeakIdentityHashMap()

WeakIdentityHashMap

public WeakIdentityHashMap(int capacity)
Method Detail

getEntryHashCode

protected int getEntryHashCode(WeakHashNode<K,V> entry)
Description copied from class: AbstractHashTable
Extract hash-code from Entry.

Specified by:
getEntryHashCode in class AbstractHashTable<WeakHashNode<K,V>,K,V>

getEntryNext

protected WeakHashNode<K,V> getEntryNext(WeakHashNode<K,V> entry)
Description copied from class: AbstractHashTable
Extract next Entry in same hash-bucket.

Specified by:
getEntryNext in class AbstractHashTable<WeakHashNode<K,V>,K,V>

setEntryNext

protected void setEntryNext(WeakHashNode<K,V> entry,
                            WeakHashNode<K,V> next)
Description copied from class: AbstractHashTable
Set next Entry in same hash-bucket.

Specified by:
setEntryNext in class AbstractHashTable<WeakHashNode<K,V>,K,V>

allocEntries

protected WeakHashNode<K,V>[] allocEntries(int n)
Description copied from class: AbstractHashTable
Allocate Entry[n].

Specified by:
allocEntries in class AbstractHashTable<WeakHashNode<K,V>,K,V>

hash

public int hash(java.lang.Object key)
Description copied from class: AbstractHashTable
Calculate hash code of a key.

Overrides:
hash in class AbstractHashTable<WeakHashNode<K,V>,K,V>

matches

protected boolean matches(K key1,
                          java.lang.Object key2)
Description copied from class: AbstractHashTable
Compare two keys for equivalence. Override this and the AbstractHashTable.hash(Object) method if you want a different equivalence relation.

Overrides:
matches in class AbstractHashTable<WeakHashNode<K,V>,K,V>

makeEntry

protected WeakHashNode<K,V> makeEntry(K key,
                                      int hash,
                                      V value)
Description copied from class: AbstractHashTable
Allocate a new node in the hash table.

Specified by:
makeEntry in class AbstractHashTable<WeakHashNode<K,V>,K,V>

get

public V get(java.lang.Object key,
             V defaultValue)
Description copied from class: AbstractHashTable
Find value for given key. Return defaultValue if not found.

Overrides:
get in class AbstractHashTable<WeakHashNode<K,V>,K,V>

put

public V put(K key,
             int hash,
             V value)
Overrides:
put in class AbstractHashTable<WeakHashNode<K,V>,K,V>

remove

public V remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map<K,V>
Overrides:
remove in class AbstractHashTable<WeakHashNode<K,V>,K,V>