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 boolean
add(E o)
boolean
addAll(Collection<? extends E> c)
boolean
addWithTracking(E _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(Object o)
boolean
containsAll(Collection<?> c)
void
dump()
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()
boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
removeWithTracking(E _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(Collection<?> c)
void
selfAdded()
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:TrackableCollectionIF
INTERNAL: Clears the list of added and removed objects without touching the original collection.- Specified by:
resetTracking
in interfaceTrackableCollectionIF<E>
-
selfAdded
public void selfAdded()
Description copied from interface:TrackableCollectionIF
INTERNAL: Consider existing collection elements as having just been added.- Specified by:
selfAdded
in interfaceTrackableCollectionIF<E>
-
getAdded
public Collection<E> 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 interfaceTrackableCollectionIF<E>
-
getRemoved
public Collection<E> 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 interfaceTrackableCollectionIF<E>
-
addWithTracking
public boolean addWithTracking(E _o)
Description copied from interface:TrackableCollectionIF
INTERNAL: Adds the item to the collection tracking the change.- Specified by:
addWithTracking
in interfaceTrackableCollectionIF<E>
-
removeWithTracking
public boolean removeWithTracking(E _o)
Description copied from interface:TrackableCollectionIF
INTERNAL: Removes the item from the collection tracking the change.- Specified by:
removeWithTracking
in interfaceTrackableCollectionIF<E>
-
clearWithTracking
public void clearWithTracking()
Description copied from interface:TrackableCollectionIF
INTERNAL: Removes all items from the collection tracking the changes.- Specified by:
clearWithTracking
in interfaceTrackableCollectionIF<E>
-
clear
public void clear()
-
add
public boolean add(E o)
-
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAll
in interfaceCollection<E>
- Specified by:
addAll
in interfaceSet<E>
- Overrides:
addAll
in classAbstractCollection<E>
-
remove
public boolean remove(Object o)
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<E>
- Specified by:
removeAll
in interfaceSet<E>
- Overrides:
removeAll
in classAbstractSet<E>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<E>
- Specified by:
retainAll
in interfaceSet<E>
- Overrides:
retainAll
in classAbstractCollection<E>
-
contains
public boolean contains(Object o)
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceSet<E>
- Overrides:
containsAll
in classAbstractCollection<E>
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<E>
- Specified by:
toArray
in interfaceSet<E>
- Overrides:
toArray
in classAbstractCollection<E>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interfaceCollection<E>
- Specified by:
toArray
in interfaceSet<E>
- Overrides:
toArray
in classAbstractCollection<E>
-
spliterator
public Spliterator<E> spliterator()
- Specified by:
spliterator
in interfaceCollection<E>
- Specified by:
spliterator
in interfaceIterable<E>
- Specified by:
spliterator
in interfaceSet<E>
- Overrides:
spliterator
in classHashSet<E>
-
-