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:
- java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>
public class UniqueSet<E>
- extends CompactHashSet<E>
INTERNAL:
|
Method Summary |
boolean |
add(java.lang.Object o)
Adds the specified element to this set if it is not already
present. |
UniqueSet<E> |
add(UniqueSet<E> set,
java.lang.Object o,
boolean dereference)
|
boolean |
addAll(java.util.Collection<? extends E> coll)
|
void |
clear()
Removes all of the elements from this set. |
void |
dereference(UniqueSet<E> set)
|
void |
dump()
INTERNAL: Used for debugging only. |
protected boolean |
equalsAdd(UniqueSet<E> other,
java.lang.Object o)
|
protected boolean |
equalsRemove(UniqueSet<E> other,
java.lang.Object o)
|
UniqueSet<E> |
get(java.util.Set<E> set)
INTERNAL: Get the internal representation of a given set. |
int |
getReferenceCount()
|
int |
hashCode()
|
protected E |
lookup(java.lang.Object o)
INTERNAL: Looks up the object in the hashset and returns the
actual object stored at the hashset. |
boolean |
remove(java.lang.Object o)
Removes the specified element from the set. |
UniqueSet<E> |
remove(UniqueSet<E> set,
java.lang.Object o,
boolean dereference)
|
boolean |
removeAll(java.util.Collection<?> coll)
|
boolean |
retainAll(java.util.Collection<?> coll)
|
java.lang.String |
toString()
|
| 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.Set |
containsAll |
hc
protected int hc
hc_modCount
protected int hc_modCount
UniqueSet
public UniqueSet()
UniqueSet
public UniqueSet(int size)
UniqueSet
public UniqueSet(java.util.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(java.util.Set<E> set)
- INTERNAL: Get the internal representation of a given set. The
initial reference count is 1.
lookup
protected E lookup(java.lang.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,
java.lang.Object o)
equalsRemove
protected boolean equalsRemove(UniqueSet<E> other,
java.lang.Object o)
add
public UniqueSet<E> add(UniqueSet<E> set,
java.lang.Object o,
boolean dereference)
remove
public UniqueSet<E> remove(UniqueSet<E> set,
java.lang.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(java.lang.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 java.util.Collection<E>- Specified by:
add in interface java.util.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(java.lang.Object o)
- Description copied from class:
CompactHashSet
- Removes the specified element from the set.
- Specified by:
remove in interface java.util.Collection<E>- Specified by:
remove in interface java.util.Set<E>- Overrides:
remove in class CompactHashSet<E>
addAll
public boolean addAll(java.util.Collection<? extends E> coll)
- Specified by:
addAll in interface java.util.Collection<E>- Specified by:
addAll in interface java.util.Set<E>- Overrides:
addAll in class java.util.AbstractCollection<E>
removeAll
public boolean removeAll(java.util.Collection<?> coll)
- Specified by:
removeAll in interface java.util.Collection<E>- Specified by:
removeAll in interface java.util.Set<E>- Overrides:
removeAll in class java.util.AbstractSet<E>
retainAll
public boolean retainAll(java.util.Collection<?> coll)
- Specified by:
retainAll in interface java.util.Collection<E>- Specified by:
retainAll in interface java.util.Set<E>- Overrides:
retainAll in class java.util.AbstractCollection<E>
clear
public void clear()
- Description copied from class:
CompactHashSet
- Removes all of the elements from this set.
- Specified by:
clear in interface java.util.Collection<E>- Specified by:
clear in interface java.util.Set<E>- Overrides:
clear in class CompactHashSet<E>
toString
public java.lang.String toString()
- Overrides:
toString in class java.util.AbstractCollection<E>
hashCode
public int hashCode()
- Specified by:
hashCode in interface java.util.Collection<E>- Specified by:
hashCode in interface java.util.Set<E>- Overrides:
hashCode in class java.util.AbstractSet<E>
Copyright © 2000-2012 Ontopia.