org.jikesrvm.util
Class AbstractHashMapRVM<K,V>

java.lang.Object
  extended by org.jikesrvm.util.AbstractHashMapRVM<K,V>
Direct Known Subclasses:
HashMapRVM, IdentityHashMapRVM, ImmutableEntryHashMapRVM, ImmutableEntryIdentityHashMapRVM

abstract class AbstractHashMapRVM<K,V>
extends Object

Common super class for all VM hash maps.


Nested Class Summary
(package private) static class AbstractHashMapRVM.AbstractBucket<K,V>
           
private  class AbstractHashMapRVM.BucketIterator
          Iterator types for key and value
private  class AbstractHashMapRVM.KeyIterator
           
private  class AbstractHashMapRVM.ValueIterator
           
 
Field Summary
protected  AbstractHashMapRVM.AbstractBucket<K,V>[] buckets
           
protected static int DEFAULT_SIZE
           
private static float LOAD
           
protected  int numElems
           
 
Constructor Summary
AbstractHashMapRVM(int size)
           
 
Method Summary
private  int bucketIndex(K key, int divisor)
           
(package private) abstract  AbstractHashMapRVM.AbstractBucket<K,V> createNewBucket(K k, V v, AbstractHashMapRVM.AbstractBucket<K,V> n)
           
 V get(K key)
           
private  void growMap()
           
private  boolean growMapAllowed()
          Advise against growing the buckets if they are immortal, as it will lead to multiple sets of buckets that will be scanned
(package private) abstract  int hashTheKey(K key)
           
 Iterator<K> keyIterator()
           
 Iterable<K> keys()
           
private  AbstractHashMapRVM.AbstractBucket<K,V>[] newBucketArray(int size)
           
 V put(K key, V value)
           
 V remove(K key)
           
(package private) abstract  boolean same(K key1, K key2)
          Are two keys the same?
 int size()
           
 Iterator<V> valueIterator()
           
 Iterable<V> values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SIZE

protected static final int DEFAULT_SIZE
See Also:
Constant Field Values

LOAD

private static final float LOAD
See Also:
Constant Field Values

buckets

protected AbstractHashMapRVM.AbstractBucket<K,V>[] buckets

numElems

protected int numElems
Constructor Detail

AbstractHashMapRVM

AbstractHashMapRVM(int size)
Method Detail

same

abstract boolean same(K key1,
                      K key2)
Are two keys the same?


hashTheKey

abstract int hashTheKey(K key)

createNewBucket

abstract AbstractHashMapRVM.AbstractBucket<K,V> createNewBucket(K k,
                                                                V v,
                                                                AbstractHashMapRVM.AbstractBucket<K,V> n)

size

public final int size()

get

public final V get(K key)

growMapAllowed

private boolean growMapAllowed()
Advise against growing the buckets if they are immortal, as it will lead to multiple sets of buckets that will be scanned


put

public final V put(K key,
                   V value)

newBucketArray

private AbstractHashMapRVM.AbstractBucket<K,V>[] newBucketArray(int size)

growMap

private void growMap()

remove

public V remove(K key)

valueIterator

public final Iterator<V> valueIterator()

keyIterator

public final Iterator<K> keyIterator()

bucketIndex

private int bucketIndex(K key,
                        int divisor)

values

public final Iterable<V> values()
Returns:
a java.lang.Iterable for the values in the hash map

keys

public final Iterable<K> keys()
Returns:
a java.lang.Iterable for the values in the hash map