Package net.ontopia.persistence.proxy
Class TrackableSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- java.util.HashSet<E>
-
- net.ontopia.persistence.proxy.TrackableSet<E>
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<E>,Collection<E>,Set<E>,TrackableCollectionIF<E>
public class TrackableSet<E> extends HashSet<E> implements TrackableCollectionIF<E>
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
-
-
Constructor Summary
Constructors Constructor Description TrackableSet(TransactionIF txn, Collection<E> coll)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E o)booleanaddAll(Collection<? extends E> c)booleanaddWithTracking(E _o)INTERNAL: Adds the item to the collection tracking the change.voidclear()voidclearWithTracking()INTERNAL: Removes all items from the collection tracking the changes.booleancontains(Object o)booleancontainsAll(Collection<?> c)voiddump()Collection<E>getAdded()INTERNAL: Gets the objects that have been added to the set.Collection<E>getRemoved()INTERNAL: Gets the objects that have been removed from the set.Iterator<E>iterator()booleanremove(Object o)booleanremoveAll(Collection<?> c)booleanremoveWithTracking(E _o)INTERNAL: Removes the item from the collection tracking the change.voidresetTracking()INTERNAL: Clears the list of added and removed objects without touching the original collection.booleanretainAll(Collection<?> c)voidselfAdded()INTERNAL: Consider existing collection elements as having just been added.Spliterator<E>spliterator()Object[]toArray()<T> T[]toArray(T[] a)-
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
parallelStream, removeIf, stream, toArray
-
-
-
-
Field Detail
-
txn
protected TransactionIF txn
-
-
Constructor Detail
-
TrackableSet
public TrackableSet(TransactionIF txn, Collection<E> coll)
-
-
Method Detail
-
dump
public void dump()
-
resetTracking
public void resetTracking()
Description copied from interface:TrackableCollectionIFINTERNAL: Clears the list of added and removed objects without touching the original collection.- Specified by:
resetTrackingin interfaceTrackableCollectionIF<E>
-
selfAdded
public void selfAdded()
Description copied from interface:TrackableCollectionIFINTERNAL: Consider existing collection elements as having just been added.- Specified by:
selfAddedin interfaceTrackableCollectionIF<E>
-
getAdded
public Collection<E> getAdded()
Description copied from interface:TrackableCollectionIFINTERNAL: 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:
getAddedin interfaceTrackableCollectionIF<E>
-
getRemoved
public Collection<E> getRemoved()
Description copied from interface:TrackableCollectionIFINTERNAL: 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:
getRemovedin interfaceTrackableCollectionIF<E>
-
addWithTracking
public boolean addWithTracking(E _o)
Description copied from interface:TrackableCollectionIFINTERNAL: Adds the item to the collection tracking the change.- Specified by:
addWithTrackingin interfaceTrackableCollectionIF<E>
-
removeWithTracking
public boolean removeWithTracking(E _o)
Description copied from interface:TrackableCollectionIFINTERNAL: Removes the item from the collection tracking the change.- Specified by:
removeWithTrackingin interfaceTrackableCollectionIF<E>
-
clearWithTracking
public void clearWithTracking()
Description copied from interface:TrackableCollectionIFINTERNAL: Removes all items from the collection tracking the changes.- Specified by:
clearWithTrackingin interfaceTrackableCollectionIF<E>
-
clear
public void clear()
-
add
public boolean add(E o)
-
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAllin interfaceCollection<E>- Specified by:
addAllin interfaceSet<E>- Overrides:
addAllin classAbstractCollection<E>
-
remove
public boolean remove(Object o)
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<E>- Specified by:
removeAllin interfaceSet<E>- Overrides:
removeAllin classAbstractSet<E>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<E>- Specified by:
retainAllin interfaceSet<E>- Overrides:
retainAllin classAbstractCollection<E>
-
contains
public boolean contains(Object o)
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceSet<E>- Overrides:
containsAllin classAbstractCollection<E>
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<E>- Specified by:
toArrayin interfaceSet<E>- Overrides:
toArrayin classAbstractCollection<E>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfaceCollection<E>- Specified by:
toArrayin interfaceSet<E>- Overrides:
toArrayin classAbstractCollection<E>
-
spliterator
public Spliterator<E> spliterator()
- Specified by:
spliteratorin interfaceCollection<E>- Specified by:
spliteratorin interfaceIterable<E>- Specified by:
spliteratorin interfaceSet<E>- Overrides:
spliteratorin classHashSet<E>
-
-