Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.jdt.internal.junit.runner
Class CustomHashtable  view CustomHashtable download CustomHashtable.java

java.lang.Object
  extended byorg.eclipse.jdt.internal.junit.runner.CustomHashtable

final class CustomHashtable
extends java.lang.Object

This is a copy of CustomHashtable from org.eclipse.jface.viewers


Nested Class Summary
private static class CustomHashtable.EmptyEnumerator
           
private  class CustomHashtable.HashEnumerator
           
private static class CustomHashtable.HashMapEntry
          HashMapEntry is an internal class which is used to hold the entries of a Hashtable.
 
Field Summary
private  IElementComparer comparer
           
static int DEFAULT_CAPACITY
          The default capacity used when not specified in the constructor.
(package private)  int elementCount
           
(package private)  CustomHashtable.HashMapEntry[] elementData
           
private static CustomHashtable.EmptyEnumerator emptyEnumerator
           
(package private)  int firstSlot
           
(package private)  int lastSlot
           
private  float loadFactor
           
private  int threshold
           
 
Constructor Summary
CustomHashtable()
          Constructs a new Hashtable using the default capacity and load factor.
CustomHashtable(CustomHashtable table, IElementComparer comparer)
          Constructs a new hash table with enough capacity to hold all keys in the given hash table, then adds all key/value pairs in the given hash table to the new one, using the given element comparer.
CustomHashtable(IElementComparer comparer)
          Constructs a new hash table with the default capacity and the given element comparer.
CustomHashtable(int capacity)
          Constructs a new Hashtable using the specified capacity and the default load factor.
CustomHashtable(int capacity, IElementComparer comparer)
          Constructs a new hash table with the given capacity and the given element comparer.
 
Method Summary
private  void computeMaxSize()
           
 boolean containsKey(java.lang.Object key)
          Answers if this Hashtable contains the specified object as a key of one of the key/value pairs.
 java.util.Enumeration elements()
          Answers an Enumeration on the values of this Hashtable.
 java.lang.Object get(java.lang.Object key)
          Answers the value associated with the specified key in this Hashtable.
private  CustomHashtable.HashMapEntry getEntry(java.lang.Object key)
           
 java.lang.Object getKey(java.lang.Object key)
          Answers the stored key that is equal to the specified key.
private  int hashCode(java.lang.Object key)
          Answers the hash code for the given key.
private  boolean keyEquals(java.lang.Object a, java.lang.Object b)
          Compares two keys for equality.
 java.util.Enumeration keys()
          Answers an Enumeration on the keys of this Hashtable.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Associate the specified value with the specified key in this Hashtable.
private  void rehash()
          Increases the capacity of this Hashtable.
 java.lang.Object remove(java.lang.Object key)
          Remove the key/value pair with the specified key from this Hashtable.
 int size()
          Answers the number of key/value pairs in this Hashtable.
 java.lang.String toString()
          Answers the string representation of this Hashtable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

elementCount

transient int elementCount

elementData

transient CustomHashtable.HashMapEntry[] elementData

loadFactor

private float loadFactor

threshold

private int threshold

firstSlot

transient int firstSlot

lastSlot

transient int lastSlot

comparer

private transient IElementComparer comparer

emptyEnumerator

private static final CustomHashtable.EmptyEnumerator emptyEnumerator

DEFAULT_CAPACITY

public static final int DEFAULT_CAPACITY
The default capacity used when not specified in the constructor.

See Also:
Constant Field Values
Constructor Detail

CustomHashtable

public CustomHashtable()
Constructs a new Hashtable using the default capacity and load factor.


CustomHashtable

public CustomHashtable(int capacity)
Constructs a new Hashtable using the specified capacity and the default load factor.


CustomHashtable

public CustomHashtable(IElementComparer comparer)
Constructs a new hash table with the default capacity and the given element comparer.


CustomHashtable

public CustomHashtable(int capacity,
                       IElementComparer comparer)
Constructs a new hash table with the given capacity and the given element comparer.


CustomHashtable

public CustomHashtable(CustomHashtable table,
                       IElementComparer comparer)
Constructs a new hash table with enough capacity to hold all keys in the given hash table, then adds all key/value pairs in the given hash table to the new one, using the given element comparer.

Method Detail

computeMaxSize

private void computeMaxSize()

containsKey

public boolean containsKey(java.lang.Object key)
Answers if this Hashtable contains the specified object as a key of one of the key/value pairs.


elements

public java.util.Enumeration elements()
Answers an Enumeration on the values of this Hashtable. The results of the Enumeration may be affected if the contents of this Hashtable are modified.


get

public java.lang.Object get(java.lang.Object key)
Answers the value associated with the specified key in this Hashtable.


getKey

public java.lang.Object getKey(java.lang.Object key)
Answers the stored key that is equal to the specified key.


getEntry

private CustomHashtable.HashMapEntry getEntry(java.lang.Object key)

hashCode

private int hashCode(java.lang.Object key)
Answers the hash code for the given key.


keyEquals

private boolean keyEquals(java.lang.Object a,
                          java.lang.Object b)
Compares two keys for equality.


keys

public java.util.Enumeration keys()
Answers an Enumeration on the keys of this Hashtable. The results of the Enumeration may be affected if the contents of this Hashtable are modified.


put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Associate the specified value with the specified key in this Hashtable. If the key already exists, the old value is replaced. The key and value cannot be null.


rehash

private void rehash()
Increases the capacity of this Hashtable. This method is sent when the size of this Hashtable exceeds the load factor.


remove

public java.lang.Object remove(java.lang.Object key)
Remove the key/value pair with the specified key from this Hashtable.


size

public int size()
Answers the number of key/value pairs in this Hashtable.


toString

public java.lang.String toString()
Answers the string representation of this Hashtable.