net.ontopia.utils
Class UniqueSet<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by net.ontopia.utils.CompactHashSet<E>
              extended by 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:


Constructor Summary
UniqueSet()
           
UniqueSet(java.util.Collection<E> c)
           
UniqueSet(int size)
           
UniqueSet(UniqueSet<E> s)
           
UniqueSet(UniqueSet<E> s1, UniqueSet<E> s2)
           
 
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.
 UniqueSet<E> get(java.util.Set<E> set)
          INTERNAL: Get the internal representation of a given set.
 int getReferenceCount()
           
 int hashCode()
           
 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 net.ontopia.utils.CompactHashSet
contains, isEmpty, iterator, 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
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
containsAll
 

Constructor Detail

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)
Method Detail

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.


dereference

public void dereference(UniqueSet<E> set)

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-2010 Ontopia.