net.ontopia.utils
Class PoolableSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by net.ontopia.utils.CompactHashSet
              extended by net.ontopia.utils.PoolableSet
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.Set, PoolableSetIF

public class PoolableSet
extends CompactHashSet
implements PoolableSetIF

INTERNAL: The default PoolableSet implementation. This is class is used by the default SetPool implementation.


Field Summary
protected  int hc
           
protected  int hc_modCount
           
protected  int refcount
           
 
Fields inherited from class net.ontopia.utils.CompactHashSet
deletedObject, elements, freecells, INITIAL_SIZE, LOAD_FACTOR, modCount, nullObject, objects
 
Constructor Summary
PoolableSet()
           
PoolableSet(java.util.Collection c)
           
PoolableSet(CompactHashSet s)
           
PoolableSet(int size)
           
 
Method Summary
 boolean _add(java.lang.Object o)
           
 boolean _remove(java.lang.Object o)
           
 boolean add(java.lang.Object o)
          Adds the specified element to this set if it is not already present.
 boolean addAll(java.util.Collection coll)
           
 void clear()
          Removes all of the elements from this set.
 int dereferenced(SetPoolIF pool)
          INTERNAL: Decrement and return reference count.
 boolean equalsAdd(java.util.Set other, java.lang.Object o)
          INTERNAL: Returns true if the given set will be equal to this set if the given object had been added to this set.
 boolean equalsRemove(java.util.Set other, java.lang.Object o)
          INTERNAL: Returns true if the given set will be equal to this set if the given object had been removed from this set.
 int getReferenceCount()
          INTERNAL: Return the current reference count.
 int hashCode()
           
 int referenced(SetPoolIF pool)
          INTERNAL: Increment and return reference count.
 boolean remove(java.lang.Object o)
          Removes the specified element from the set.
 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, dump, 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.Set
contains, containsAll, equals, isEmpty, iterator, size, toArray, toArray
 

Field Detail

refcount

protected int refcount

hc

protected int hc

hc_modCount

protected int hc_modCount
Constructor Detail

PoolableSet

public PoolableSet()

PoolableSet

public PoolableSet(int size)

PoolableSet

public PoolableSet(java.util.Collection c)

PoolableSet

public PoolableSet(CompactHashSet s)
Method Detail

_add

public boolean _add(java.lang.Object o)

_remove

public boolean _remove(java.lang.Object o)

getReferenceCount

public int getReferenceCount()
Description copied from interface: PoolableSetIF
INTERNAL: Return the current reference count. The reference count is used to control the life cycle of the pooled set. The pool instance that manages this set will use the reference count to figure out when to drop the set from its pool.

Specified by:
getReferenceCount in interface PoolableSetIF

referenced

public int referenced(SetPoolIF pool)
Description copied from interface: PoolableSetIF
INTERNAL: Increment and return reference count.

Specified by:
referenced in interface PoolableSetIF

dereferenced

public int dereferenced(SetPoolIF pool)
Description copied from interface: PoolableSetIF
INTERNAL: Decrement and return reference count.

Specified by:
dereferenced in interface PoolableSetIF

equalsAdd

public boolean equalsAdd(java.util.Set other,
                         java.lang.Object o)
Description copied from interface: PoolableSetIF
INTERNAL: Returns true if the given set will be equal to this set if the given object had been added to this set.

Specified by:
equalsAdd in interface PoolableSetIF

equalsRemove

public boolean equalsRemove(java.util.Set other,
                            java.lang.Object o)
Description copied from interface: PoolableSetIF
INTERNAL: Returns true if the given set will be equal to this set if the given object had been removed from this set.

Specified by:
equalsRemove in interface PoolableSetIF

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
Specified by:
add in interface java.util.Set
Overrides:
add in class CompactHashSet
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
Specified by:
remove in interface java.util.Set
Overrides:
remove in class CompactHashSet

addAll

public boolean addAll(java.util.Collection coll)
Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.Set
Overrides:
addAll in class java.util.AbstractCollection

removeAll

public boolean removeAll(java.util.Collection coll)
Specified by:
removeAll in interface java.util.Collection
Specified by:
removeAll in interface java.util.Set
Overrides:
removeAll in class java.util.AbstractSet

retainAll

public boolean retainAll(java.util.Collection coll)
Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.Set
Overrides:
retainAll in class java.util.AbstractCollection

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
Specified by:
clear in interface java.util.Set
Overrides:
clear in class CompactHashSet

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.Set
Overrides:
hashCode in class java.util.AbstractSet


Copyright © 2000-2012 Ontopia.