net.ontopia.persistence.proxy
Class TrackableSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet
              extended by net.ontopia.persistence.proxy.TrackableSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.Set, TrackableCollectionIF

public class TrackableSet
extends java.util.HashSet
implements TrackableCollectionIF

INTERNAL: A set implementation that track the changes performed on it. It keeps track of the objects that have been added and the ones that has been removed.

See Also:
Serialized Form

Field Summary
protected  java.util.Set added
           
protected  java.util.Set removed
           
protected  TransactionIF txn
           
 
Constructor Summary
TrackableSet(TransactionIF txn, java.util.Collection coll)
           
 
Method Summary
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 boolean addWithTracking(java.lang.Object _o)
          INTERNAL: Adds the item to the collection tracking the change.
 void clear()
           
 void clearWithTracking()
          INTERNAL: Removes all items from the collection tracking the changes.
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection c)
           
 void dump()
           
 java.util.Collection getAdded()
          INTERNAL: Gets the objects that have been added to the set.
 java.util.Collection getRemoved()
          INTERNAL: Gets the objects that have been removed from the set.
 java.util.Iterator iterator()
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 boolean removeWithTracking(java.lang.Object _o)
          INTERNAL: Removes the item from the collection tracking the change.
 void resetTracking()
          INTERNAL: Clears the list of added and removed objects without touching the original collection.
 boolean retainAll(java.util.Collection c)
           
 void selfAdded()
          INTERNAL: Consider existing collection elements as having just been added.
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 
Methods inherited from class java.util.HashSet
clone, isEmpty, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode
 
Methods inherited from class java.util.AbstractCollection
toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode, isEmpty, size
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Field Detail

txn

protected TransactionIF txn

added

protected java.util.Set added

removed

protected java.util.Set removed
Constructor Detail

TrackableSet

public TrackableSet(TransactionIF txn,
                    java.util.Collection coll)
Method Detail

dump

public void dump()

resetTracking

public void resetTracking()
Description copied from interface: TrackableCollectionIF
INTERNAL: Clears the list of added and removed objects without touching the original collection.

Specified by:
resetTracking in interface TrackableCollectionIF

selfAdded

public void selfAdded()
Description copied from interface: TrackableCollectionIF
INTERNAL: Consider existing collection elements as having just been added.

Specified by:
selfAdded in interface TrackableCollectionIF

getAdded

public java.util.Collection getAdded()
Description copied from interface: TrackableCollectionIF
INTERNAL: Gets the objects that have been added to the set. This collection is immutable. Null is returned if the added collection has not been initialized, ie. it is empty.

Specified by:
getAdded in interface TrackableCollectionIF

getRemoved

public java.util.Collection getRemoved()
Description copied from interface: TrackableCollectionIF
INTERNAL: Gets the objects that have been removed from the set. This collection is immutable. Null is returned if the removed collection has not been initialized, ie. it is empty.

Specified by:
getRemoved in interface TrackableCollectionIF

addWithTracking

public boolean addWithTracking(java.lang.Object _o)
Description copied from interface: TrackableCollectionIF
INTERNAL: Adds the item to the collection tracking the change.

Specified by:
addWithTracking in interface TrackableCollectionIF

removeWithTracking

public boolean removeWithTracking(java.lang.Object _o)
Description copied from interface: TrackableCollectionIF
INTERNAL: Removes the item from the collection tracking the change.

Specified by:
removeWithTracking in interface TrackableCollectionIF

clearWithTracking

public void clearWithTracking()
Description copied from interface: TrackableCollectionIF
INTERNAL: Removes all items from the collection tracking the changes.

Specified by:
clearWithTracking in interface TrackableCollectionIF

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.Set
Overrides:
clear in class java.util.HashSet

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Overrides:
add in class java.util.HashSet

addAll

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

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.Set
Overrides:
remove in class java.util.HashSet

removeAll

public boolean removeAll(java.util.Collection c)
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 c)
Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.Set
Overrides:
retainAll in class java.util.AbstractCollection

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set
Overrides:
iterator in class java.util.HashSet

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.Set
Overrides:
contains in class java.util.HashSet

containsAll

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

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set
Overrides:
toArray in class java.util.AbstractCollection

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.Set
Overrides:
toArray in class java.util.AbstractCollection


Copyright © 2000-2012 Ontopia.