All Packages Class Hierarchy This Package Previous Next Index
Class collections.HashedSet
java.lang.Object
|
+----collections.UpdatableImpl
|
+----collections.UpdatableSetImpl
|
+----collections.HashedSet
- public class HashedSet
- extends UpdatableSetImpl
- implements UpdatableSet, HashTableParams
Hash table implementation of set
-
loadFactor_
- The threshold load factor
-
table_
- The table.
-
HashedSet()
- Make an empty HashedSet.
-
HashedSet(Predicate)
- Make an empty HashedSet using given element screener
-
HashedSet(Predicate, float)
- Special version of constructor needed by clone()
-
buckets()
- Implements collections.HashTableParams.buckets.
-
buckets(int)
- Implements collections.HashTableParams.buckets.
-
checkImplementation()
- Implements collections.ImplementationCheckable.checkImplementation.
-
checkLoadFactor()
- Check to see if we are past load factor threshold.
-
clear()
- Implements collections.UpdatableCollection.clear.
-
clone()
- Make an independent copy of the table.
-
elements()
- Implements collections.Collection.elements.
-
exclude(Object)
- Implements collections.UpdatableCollection.exclude.
-
hashOf(Object)
- Mask off and remainder the hashCode for element
so it can be used as table index
-
include(Object)
- Implements collections.UpdatableSet.include.
-
includes(Object)
- Implements collections.Collection.includes.
-
occurrencesOf(Object)
- Implements collections.Collection.occurrencesOf.
-
removeOneOf(Object)
- Remove an instance of the indicated element from the collection.
-
replaceAllOf(Object, Object)
- Replace all occurrences of oldElement with newElement.
-
replaceOneOf(Object, Object)
- Replace an occurrence of oldElement with newElement.
-
resize(int)
- resize table to new capacity, rehashing all elements
-
take()
- Implements collections.UpdatableCollection.take.
-
thresholdLoadFactor()
- Implements collections.HashTableParams.thresholdLoadfactor
Time complexity: O(1).
-
thresholdLoadFactor(float)
- Implements collections.HashTableParams.thresholdLoadfactor
Time complexity: O(n).
table_
protected LLCell table_[]
- The table. Each entry is a list. Null if no table allocated
loadFactor_
protected float loadFactor_
- The threshold load factor
HashedSet
public HashedSet()
- Make an empty HashedSet.
HashedSet
public HashedSet(Predicate screener)
- Make an empty HashedSet using given element screener
HashedSet
protected HashedSet(Predicate s,
float f)
- Special version of constructor needed by clone()
clone
protected Object clone() throws CloneNotSupportedException
- Make an independent copy of the table. Does not clone elements.
- Overrides:
- clone in class Object
buckets
public synchronized int buckets()
- Implements collections.HashTableParams.buckets.
Time complexity: O(1).
- See Also:
- buckets.
buckets
public synchronized void buckets(int newCap) throws IllegalArgumentException
- Implements collections.HashTableParams.buckets.
Time complexity: O(n).
- See Also:
- buckets.
thresholdLoadFactor
public synchronized float thresholdLoadFactor()
- Implements collections.HashTableParams.thresholdLoadfactor
Time complexity: O(1).
- See Also:
- thresholdLoadfactor
thresholdLoadFactor
public synchronized void thresholdLoadFactor(float desired) throws IllegalArgumentException
- Implements collections.HashTableParams.thresholdLoadfactor
Time complexity: O(n).
- See Also:
- thresholdLoadfactor
includes
public synchronized boolean includes(Object element)
- Implements collections.Collection.includes.
Time complexity: O(1) average; O(n) worst.
- Overrides:
- includes in class UpdatableImpl
- See Also:
- includes
occurrencesOf
public synchronized int occurrencesOf(Object element)
- Implements collections.Collection.occurrencesOf.
Time complexity: O(n).
- Overrides:
- occurrencesOf in class UpdatableImpl
- See Also:
- occurrencesOf
elements
public synchronized CollectionEnumeration elements()
- Implements collections.Collection.elements.
Time complexity: O(1).
- Overrides:
- elements in class UpdatableImpl
- See Also:
- elements
clear
public synchronized void clear()
- Implements collections.UpdatableCollection.clear.
Time complexity: O(1).
- Overrides:
- clear in class UpdatableImpl
- See Also:
- clear
exclude
public synchronized void exclude(Object element)
- Implements collections.UpdatableCollection.exclude.
Time complexity: O(1) average; O(n) worst.
- Overrides:
- exclude in class UpdatableImpl
- See Also:
- exclude
removeOneOf
public synchronized void removeOneOf(Object element)
- Remove an instance of the indicated element from the collection.
- Overrides:
- removeOneOf in class UpdatableImpl
replaceOneOf
public synchronized void replaceOneOf(Object oldElement,
Object newElement) throws IllegalElementException
- Replace an occurrence of oldElement with newElement.
- Overrides:
- replaceOneOf in class UpdatableImpl
replaceAllOf
public synchronized void replaceAllOf(Object oldElement,
Object newElement) throws IllegalElementException
- Replace all occurrences of oldElement with newElement.
- Overrides:
- replaceAllOf in class UpdatableImpl
take
public synchronized Object take() throws NoSuchElementException
- Implements collections.UpdatableCollection.take.
Time complexity: O(number of buckets).
- Overrides:
- take in class UpdatableImpl
- See Also:
- take
include
public synchronized void include(Object element)
- Implements collections.UpdatableSet.include.
Time complexity: O(1) average; O(n) worst.
- Overrides:
- include in class UpdatableSetImpl
- See Also:
- include
checkLoadFactor
protected void checkLoadFactor()
- Check to see if we are past load factor threshold. If so, resize
so that we are at half of the desired threshold.
Also while at it, check to see if we are empty so can just
unlink table.
hashOf
protected final int hashOf(Object element)
- Mask off and remainder the hashCode for element
so it can be used as table index
resize
protected void resize(int newCap)
- resize table to new capacity, rehashing all elements
checkImplementation
public synchronized void checkImplementation() throws ImplementationError
- Implements collections.ImplementationCheckable.checkImplementation.
- Overrides:
- checkImplementation in class UpdatableImpl
- See Also:
- checkImplementation
All Packages Class Hierarchy This Package Previous Next Index