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:
hc
protected int hc
hc_modCount
protected int hc_modCount
UniqueSet
public UniqueSet()
UniqueSet
public UniqueSet(int size)
UniqueSet
public UniqueSet(Collection<E> c)
UniqueSet
public UniqueSet(UniqueSet<E> s)
UniqueSet
public UniqueSet(UniqueSet<E> s1,
UniqueSet<E> s2)
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.
dereference
public void dereference(UniqueSet<E> set)
equalsAdd
protected boolean equalsAdd(UniqueSet<E> other,
Object o)
equalsRemove
protected boolean equalsRemove(UniqueSet<E> other,
Object o)
add
public UniqueSet<E> add(UniqueSet<E> set,
Object o,
boolean dereference)
remove
public UniqueSet<E> remove(UniqueSet<E> set,
Object o,
boolean dereference)
dump
public void dump()
- Description copied from class:
CompactHashSet
- INTERNAL: Used for debugging only.
- Overrides:
dump
in class CompactHashSet<E>
add
public boolean add(Object o)
- Description copied from class:
CompactHashSet
- Adds the specified element to this set if it is not already
present.
- Specified by:
add
in interface Collection<E>
- Specified by:
add
in interface Set<E>
- Overrides:
add
in class CompactHashSet<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:
CompactHashSet
- Removes the specified element from the set.
- Specified by:
remove
in interface Collection<E>
- Specified by:
remove
in interface Set<E>
- Overrides:
remove
in class CompactHashSet<E>
addAll
public boolean addAll(Collection<? extends E> coll)
- Specified by:
addAll
in interface Collection<E>
- Specified by:
addAll
in interface Set<E>
- Overrides:
addAll
in class AbstractCollection<E>
removeAll
public boolean removeAll(Collection<?> coll)
- Specified by:
removeAll
in interface Collection<E>
- Specified by:
removeAll
in interface Set<E>
- Overrides:
removeAll
in class AbstractSet<E>
retainAll
public boolean retainAll(Collection<?> coll)
- Specified by:
retainAll
in interface Collection<E>
- Specified by:
retainAll
in interface Set<E>
- Overrides:
retainAll
in class AbstractCollection<E>
clear
public void clear()
- Description copied from class:
CompactHashSet
- Removes all of the elements from this set.
- Specified by:
clear
in interface Collection<E>
- Specified by:
clear
in interface Set<E>
- Overrides:
clear
in class CompactHashSet<E>
toString
public String toString()
- Overrides:
toString
in class AbstractCollection<E>
hashCode
public int hashCode()
- Specified by:
hashCode
in interface Collection<E>
- Specified by:
hashCode
in interface Set<E>
- Overrides:
hashCode
in class AbstractSet<E>
Copyright © 2000-2012 Ontopia.