Save This Page
Home » mahout-collections-1.0-src » org.apache.mahout.math.set » [javadoc | source]
public class: OpenHashSet [javadoc | source]

All Implemented Interfaces:
    Set, Cloneable, Serializable

Open hashing alternative to java.util.HashSet.
Field Summary
protected static final  byte FREE     
protected static final  byte FULL     
protected static final  byte REMOVED     
protected static final  char NO_KEY_VALUE     
Fields inherited from org.apache.mahout.math.set.AbstractSet:
distinct,  lowWaterMark,  highWaterMark,  minLoadFactor,  maxLoadFactor,  defaultCapacity,  defaultMinLoadFactor,  defaultMaxLoadFactor
 public OpenHashSet() 
 public OpenHashSet(int initialCapacity) 
 public OpenHashSet(int initialCapacity,
    double minLoadFactor,
    double maxLoadFactor) 
Method from org.apache.mahout.math.set.OpenHashSet Summary:
add,   addAll,   clear,   clone,   contains,   containsAll,   ensureCapacity,   equals,   forEachKey,   getInternalFactors,   indexOfInsertion,   indexOfKey,   isEmpty,   iterator,   keys,   keys,   rehash,   remove,   removeAll,   retainAll,   setUp,   toArray,   toArray,   trimToSize
Methods from org.apache.mahout.math.set.AbstractSet:
chooseGrowCapacity,   chooseHighWaterMark,   chooseLowWaterMark,   chooseMeanCapacity,   chooseShrinkCapacity,   clear,   ensureCapacity,   equalsMindTheNull,   isEmpty,   nextPrime,   setUp,   size,   trimToSize
Methods from org.apache.mahout.math.PersistentObject:
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.mahout.math.set.OpenHashSet Detail:
 public boolean add(Object key) 
 public boolean addAll(Collection<? extends T> c) 
 public  void clear() 
    Removes all values associations from the receiver. Implicitly calls trimToSize().
 public Object clone() 
    Returns a deep copy of the receiver.
 public boolean contains(Object key) 
    Returns true if the receiver contains the specified key.
 public boolean containsAll(Collection<?> c) 
 public  void ensureCapacity(int minCapacity) 
    Ensures that the receiver can hold at least the specified number of associations without needing to allocate new internal memory. If necessary, allocates new internal memory and increases the capacity of the receiver.

    This method never need be called; it is for performance tuning only. Calling this method before add()ing a large number of associations boosts performance, because the receiver will grow only once instead of potentially many times and hash collisions get less probable.

 public boolean equals(Object obj) 
    OpenHashSet instances are only equal to other OpenHashSet instances, not to any other collection. Hypothetically, we should check for and permit equals on other Sets.
 public boolean forEachKey(ObjectProcedure<T> procedure) 
    Applies a procedure to each key of the receiver, if any. Note: Iterates over the keys in no particular order. Subclasses can define a particular order, for example, "sorted by key". All methods which can be expressed in terms of this method (most methods can) must guarantee to use the same order defined by this method, even if it is no particular order. This is necessary so that, for example, methods keys and values will yield association pairs, not two uncorrelated lists.
  void getInternalFactors(int[] capacity,
    double[] minLoadFactor,
    double[] maxLoadFactor) 
    Access for unit tests.
 protected int indexOfInsertion(T key) 
 protected int indexOfKey(T key) 
 public boolean isEmpty() 
 public Iterator<T> iterator() 
    Implement the standard Java Collections iterator. Note that 'remove' is silently ineffectual here. This method is provided for convenience, only.
 public List<T> keys() 
 public  void keys(List<T> list) 
    Fills all keys contained in the receiver into the specified list. Fills the list, starting at index 0. After this call returns the specified list has a new size that equals this.size(). This method can be used to iterate over the keys of the receiver.
 protected  void rehash(int newCapacity) 
    Rehashes the contents of the receiver into a new table with a smaller or larger capacity. This method is called automatically when the number of keys in the receiver exceeds the high water mark or falls below the low water mark.
 public boolean remove(Object key) 
    Removes the given key with its associated element from the receiver, if present.
 public boolean removeAll(Collection<?> c) 
 public boolean retainAll(Collection<?> c) 
 protected  void setUp(int initialCapacity,
    double minLoadFactor,
    double maxLoadFactor) 
    Initializes the receiver.
 public Object[] toArray() 
 public T2[] toArray(T2[] a) 
 public  void trimToSize() 
    Trims the capacity of the receiver to be the receiver's current size. Releases any superfluous internal memory. An application can use this operation to minimize the storage of the receiver.