edu.emory.mathcs.util.collections.ints
Class IntRadkeHashSet

java.lang.Object
  extended byedu.emory.mathcs.util.collections.ints.AbstractIntCollection
      extended byedu.emory.mathcs.util.collections.ints.AbstractIntSet
          extended byedu.emory.mathcs.util.collections.ints.IntRadkeHashSet
All Implemented Interfaces:
java.lang.Cloneable, IntCollection, IntSet, java.io.Serializable

public class IntRadkeHashSet
extends AbstractIntSet
implements java.lang.Cloneable, java.io.Serializable

Hash set of int numbers. It uses open addressing with quadratic residue search to avoid clustering. No additional memory per entry is needed, there is therefore no memory allocation on add() unless rehashing is required.

Version:
1.0
Author:
Dawid Kurzyniec
See Also:
Serialized Form

Constructor Summary
IntRadkeHashSet()
           
IntRadkeHashSet(int minInitialCapacity)
           
IntRadkeHashSet(IntCollection c)
           
IntRadkeHashSet(int minInitialCapacity, float loadFactor, float resizeTreshold)
           
IntRadkeHashSet(int minInitialCapacity, int min, int max)
           
IntRadkeHashSet(int minInitialCapacity, int min, int max, float loadFactor, float resizeTreshold)
           
IntRadkeHashSet(IntSet m)
           
 
Method Summary
 boolean add(int elem)
          Adds the specified number to this set if it is not already present and if it falls within the domain.
 void clear()
          Removes all of the elements from this set.
 java.lang.Object clone()
           
 boolean contains(int elem)
          Returns true if this set contains the specified number; false otherwise.
 boolean equals(java.lang.Object other)
          Two sets are equal if they consists of the same elements.
 int hashCode()
           
 boolean isEmpty()
          Returns true if this set is empty; false otherwise.
 IntIterator iterator()
          Returns the iterator over numbers contained in this set.
 int max()
          The largest number that can be stored in this set.
 int min()
          The smallest number that can be stored in this set.
 boolean remove(int elem)
          Removes the specified number from this set if it is present.
 boolean removeAll(IntCollection c)
          Removes from this set all of its elements that are contained in the specified collection.
 boolean retainAll(IntCollection c)
          Retains only the elements in this set that are contained in the specified collection.
 int size()
          Returns the number of elements in this set.
 int size64()
          Returns the number of elements in this set.
 int[] toArray()
          Returns the newly allocated array containing all numbers from this set, in the order returned by its iterator.
 int[] toArray(int[] a)
          Returns an array containing all of the numbers in this set.
 
Methods inherited from class edu.emory.mathcs.util.collections.ints.AbstractIntSet
addAll, addInterval, complementSet, containsInterval, removeInterval, retainInterval
 
Methods inherited from class edu.emory.mathcs.util.collections.ints.AbstractIntCollection
containsAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.emory.mathcs.util.collections.ints.IntSet
containsAll
 

Constructor Detail

IntRadkeHashSet

public IntRadkeHashSet()

IntRadkeHashSet

public IntRadkeHashSet(int minInitialCapacity)

IntRadkeHashSet

public IntRadkeHashSet(int minInitialCapacity,
                       int min,
                       int max)

IntRadkeHashSet

public IntRadkeHashSet(int minInitialCapacity,
                       float loadFactor,
                       float resizeTreshold)

IntRadkeHashSet

public IntRadkeHashSet(int minInitialCapacity,
                       int min,
                       int max,
                       float loadFactor,
                       float resizeTreshold)

IntRadkeHashSet

public IntRadkeHashSet(IntSet m)

IntRadkeHashSet

public IntRadkeHashSet(IntCollection c)
Method Detail

min

public int min()
Description copied from interface: IntSet
The smallest number that can be stored in this set.

Specified by:
min in interface IntSet
Overrides:
min in class AbstractIntSet

max

public int max()
Description copied from interface: IntSet
The largest number that can be stored in this set.

Specified by:
max in interface IntSet
Overrides:
max in class AbstractIntSet

add

public boolean add(int elem)
Description copied from interface: IntSet
Adds the specified number to this set if it is not already present and if it falls within the domain.

Specified by:
add in interface IntSet
Overrides:
add in class AbstractIntCollection

contains

public boolean contains(int elem)
Description copied from interface: IntSet
Returns true if this set contains the specified number; false otherwise.

Specified by:
contains in interface IntSet
Overrides:
contains in class AbstractIntCollection

remove

public boolean remove(int elem)
Description copied from interface: IntSet
Removes the specified number from this set if it is present.

Specified by:
remove in interface IntSet
Overrides:
remove in class AbstractIntCollection

clear

public void clear()
Description copied from interface: IntSet
Removes all of the elements from this set. The set will be empty after this call returns.

Specified by:
clear in interface IntSet
Overrides:
clear in class AbstractIntCollection

isEmpty

public boolean isEmpty()
Description copied from interface: IntSet
Returns true if this set is empty; false otherwise.

Specified by:
isEmpty in interface IntSet
Overrides:
isEmpty in class AbstractIntSet

size64

public int size64()
Description copied from interface: IntSet
Returns the number of elements in this set.

Specified by:
size64 in interface IntSet
Overrides:
size64 in class AbstractIntCollection

size

public int size()
Description copied from interface: IntSet
Returns the number of elements in this set. If exceeds Integer.MAX_VALUE, then Integer.MAX_VALUE is returned.

Specified by:
size in interface IntSet
Overrides:
size in class AbstractIntCollection

iterator

public IntIterator iterator()
Description copied from interface: IntSet
Returns the iterator over numbers contained in this set.

Specified by:
iterator in interface IntSet
Specified by:
iterator in class AbstractIntCollection

equals

public boolean equals(java.lang.Object other)
Description copied from interface: IntSet
Two sets are equal if they consists of the same elements.

Specified by:
equals in interface IntSet
Overrides:
equals in class AbstractIntSet

hashCode

public int hashCode()
Specified by:
hashCode in interface IntSet
Overrides:
hashCode in class AbstractIntSet

clone

public java.lang.Object clone()

removeAll

public boolean removeAll(IntCollection c)
Description copied from interface: IntSet
Removes from this set all of its elements that are contained in the specified collection. If the specified collection is also a set, this operation effectively modifies this set so that its value is the asymmetric set difference of the two sets.

Specified by:
removeAll in interface IntSet
Overrides:
removeAll in class AbstractIntSet

retainAll

public boolean retainAll(IntCollection c)
Description copied from interface: IntSet
Retains only the elements in this set that are contained in the specified collection. In other words, removes from this set all of its elements that are not contained in the specified collection. If the specified collection is also a set, this operation effectively modifies this set so that its value is the intersection of the two sets.

Specified by:
retainAll in interface IntSet
Overrides:
retainAll in class AbstractIntSet

toArray

public int[] toArray(int[] a)
Description copied from interface: IntSet
Returns an array containing all of the numbers in this set. If the set fits in the specified array, it is returned therein. Otherwise, a new array is allocated.

If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.

Like the IntSet.toArray() method, this method acts as bridge between array-based and collection-based APIs. Further, this method may, under certain circumstances, be used to save allocation costs.

Specified by:
toArray in interface IntSet
Overrides:
toArray in class AbstractIntCollection

toArray

public int[] toArray()
Description copied from interface: IntSet
Returns the newly allocated array containing all numbers from this set, in the order returned by its iterator.

Specified by:
toArray in interface IntSet
Overrides:
toArray in class AbstractIntCollection