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>
public class UniqueSet<E> extends CompactHashSet<E>
INTERNAL:
-
-
Field Summary
Fields Modifier and Type Field Description protected inthcprotected inthc_modCount-
Fields inherited from class net.ontopia.utils.CompactHashSet
deletedObject, elements, freecells, INITIAL_SIZE, LOAD_FACTOR, modCount, nullObject, objects
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(Object o)Adds the specified element to this set if it is not already present.UniqueSet<E>add(UniqueSet<E> set, Object o, boolean dereference)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 booleanequalsAdd(UniqueSet<E> other, Object o)protected booleanequalsRemove(UniqueSet<E> other, Object o)UniqueSet<E>get(Set<E> set)INTERNAL: Get the internal representation of a given set.intgetReferenceCount()inthashCode()protected Elookup(Object o)INTERNAL: Looks up the object in the hashset and returns the actual object stored at the hashset.booleanremove(Object o)Removes the specified element from the set.UniqueSet<E>remove(UniqueSet<E> set, Object o, boolean dereference)booleanremoveAll(Collection<?> coll)booleanretainAll(Collection<?> coll)StringtoString()-
Methods inherited from class net.ontopia.utils.CompactHashSet
contains, isEmpty, iterator, rehash, rehash, size, toArray, toArray
-
Methods inherited from class java.util.AbstractSet
equals
-
Methods inherited from class java.util.AbstractCollection
containsAll
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
containsAll, spliterator
-
-
-
-
Method Detail
-
getReferenceCount
public int getReferenceCount()
-
get
public UniqueSet<E> get(Set<E> set)
INTERNAL: Get the internal representation of a given set. The initial reference count is 1.
-
lookup
protected E lookup(Object o)
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.
-
dump
public void dump()
Description copied from class:CompactHashSetINTERNAL: Used for debugging only.- Overrides:
dumpin classCompactHashSet<E>
-
add
public boolean add(Object o)
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
public boolean remove(Object o)
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
public boolean addAll(Collection<? extends E> coll)
- Specified by:
addAllin interfaceCollection<E>- Specified by:
addAllin interfaceSet<E>- Overrides:
addAllin classAbstractCollection<E>
-
removeAll
public boolean removeAll(Collection<?> coll)
- Specified by:
removeAllin interfaceCollection<E>- Specified by:
removeAllin interfaceSet<E>- Overrides:
removeAllin classAbstractSet<E>
-
retainAll
public boolean retainAll(Collection<?> coll)
- 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
public String toString()
- Overrides:
toStringin classAbstractCollection<E>
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<E>- Specified by:
hashCodein interfaceSet<E>- Overrides:
hashCodein classAbstractSet<E>
-
-