org.jikesrvm.util
Class AbstractHashSetRVM<T>

java.lang.Object
  extended by org.jikesrvm.util.AbstractHashSetRVM<T>
All Implemented Interfaces:
Iterable<T>
Direct Known Subclasses:
HashSetRVM, ImmutableEntryHashSetRVM

abstract class AbstractHashSetRVM<T>
extends Object
implements Iterable<T>

Common super class for all VM hash sets.


Nested Class Summary
(package private) static class AbstractHashSetRVM.AbstractBucket<T>
           
(package private)  class AbstractHashSetRVM.SetIterator
          Iterator
 
Field Summary
protected  AbstractHashSetRVM.AbstractBucket<T>[] buckets
           
protected static int DEFAULT_SIZE
           
private static float LOAD
           
protected  int numElems
           
 
Constructor Summary
AbstractHashSetRVM(int size)
           
 
Method Summary
 void add(T key)
           
 void addAll(AbstractHashSetRVM<T> c)
           
private  int bucketIndex(T key, int divisor)
           
 boolean contains(T key)
           
(package private) abstract  AbstractHashSetRVM.AbstractBucket<T> createNewBucket(T key, AbstractHashSetRVM.AbstractBucket<T> next)
           
 T get(T 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
 Iterator<T> iterator()
           
protected  AbstractHashSetRVM.AbstractBucket<T>[] newBucketArray(int size)
           
 void remove(T key)
           
 void removeAll()
           
 int size()
           
 
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 AbstractHashSetRVM.AbstractBucket<T>[] buckets

numElems

protected int numElems
Constructor Detail

AbstractHashSetRVM

AbstractHashSetRVM(int size)
Method Detail

createNewBucket

abstract AbstractHashSetRVM.AbstractBucket<T> createNewBucket(T key,
                                                              AbstractHashSetRVM.AbstractBucket<T> next)

newBucketArray

protected AbstractHashSetRVM.AbstractBucket<T>[] newBucketArray(int size)

size

public int size()

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


add

public void add(T key)

get

public T get(T key)

contains

public boolean contains(T key)

addAll

public void addAll(AbstractHashSetRVM<T> c)

growMap

private void growMap()

remove

public void remove(T key)

removeAll

public void removeAll()

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>

bucketIndex

private int bucketIndex(T key,
                        int divisor)