Package net.ontopia.utils
Class UniqueSet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
net.ontopia.utils.CompactHashSet<E>
net.ontopia.utils.UniqueSet<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Set<E>
INTERNAL:
-
Field Summary
FieldsFields inherited from class net.ontopia.utils.CompactHashSet
deletedObject, elements, freecells, INITIAL_SIZE, LOAD_FACTOR, modCount, nullObject, objects -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds the specified element to this set if it is not already present.booleanaddAll(Collection<? extends E> coll) voidclear()Removes all of the elements from this set.voiddereference(UniqueSet<E> set) voiddump()INTERNAL: Used for debugging only.protected booleanprotected booleanequalsRemove(UniqueSet<E> other, Object o) INTERNAL: Get the internal representation of a given set.intinthashCode()protected EINTERNAL: Looks up the object in the hashset and returns the actual object stored at the hashset.booleanRemoves the specified element from the set.booleanremoveAll(Collection<?> coll) booleanretainAll(Collection<?> coll) toString()Methods inherited from class net.ontopia.utils.CompactHashSet
contains, isEmpty, iterator, rehash, rehash, size, toArray, toArrayMethods inherited from class java.util.AbstractSet
equalsMethods inherited from class java.util.AbstractCollection
containsAllMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
containsAll, spliterator
-
Field Details
-
hc
protected int hc -
hc_modCount
protected int hc_modCount
-
-
Constructor Details
-
UniqueSet
public UniqueSet() -
UniqueSet
public UniqueSet(int size) -
UniqueSet
-
UniqueSet
-
UniqueSet
-
-
Method Details
-
getReferenceCount
public int getReferenceCount() -
get
INTERNAL: Get the internal representation of a given set. The initial reference count is 1. -
lookup
INTERNAL: Looks up the object in the hashset and returns the actual object stored at the hashset. Note that this might be another object, but one that is considered to be equal. -
dereference
-
equalsAdd
-
equalsRemove
-
add
-
remove
-
dump
public void dump()Description copied from class:CompactHashSetINTERNAL: Used for debugging only.- Overrides:
dumpin classCompactHashSet<E>
-
add
Description copied from class:CompactHashSetAdds the specified element to this set if it is not already present.- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classCompactHashSet<E>- Parameters:
o- element to be added to this set.- Returns:
- true if the set did not already contain the specified element.
-
remove
Description copied from class:CompactHashSetRemoves the specified element from the set.- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceSet<E>- Overrides:
removein classCompactHashSet<E>
-
addAll
- Specified by:
addAllin interfaceCollection<E>- Specified by:
addAllin interfaceSet<E>- Overrides:
addAllin classAbstractCollection<E>
-
removeAll
- Specified by:
removeAllin interfaceCollection<E>- Specified by:
removeAllin interfaceSet<E>- Overrides:
removeAllin classAbstractSet<E>
-
retainAll
- Specified by:
retainAllin interfaceCollection<E>- Specified by:
retainAllin interfaceSet<E>- Overrides:
retainAllin classAbstractCollection<E>
-
clear
public void clear()Description copied from class:CompactHashSetRemoves all of the elements from this set.- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceSet<E>- Overrides:
clearin classCompactHashSet<E>
-
toString
- Overrides:
toStringin classAbstractCollection<E>
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<E>- Specified by:
hashCodein interfaceSet<E>- Overrides:
hashCodein classAbstractSet<E>
-