Package net.ontopia.persistence.proxy
Class TrackableLazySet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- java.util.HashSet<E>
-
- net.ontopia.persistence.proxy.TrackableLazySet<E>
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<E>,Collection<E>,Set<E>,TrackableCollectionIF<E>
public class TrackableLazySet<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. What makes this implementation different from TrackableSet is that the field value is only loaded from the storage when it is actually needed.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TrackableLazySet(TransactionIF txn, IdentityIF identity, int field)
-
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()booleanequals(Object o)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.inthashCode()booleanisEmpty()booleanisLoaded()Iterator<E>iterator()protected voidloadField()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.intsize()Spliterator<E>spliterator()Object[]toArray()<T> T[]toArray(T[] a)-
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
-
identity
protected IdentityIF identity
-
field
protected int field
-
loaded
protected boolean loaded
-
-
Constructor Detail
-
TrackableLazySet
public TrackableLazySet(TransactionIF txn, IdentityIF identity, int field)
-
-
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>
-
equals
public boolean equals(Object o)
- Specified by:
equalsin interfaceCollection<E>- Specified by:
equalsin interfaceSet<E>- Overrides:
equalsin classAbstractSet<E>
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<E>- Specified by:
hashCodein interfaceSet<E>- Overrides:
hashCodein classAbstractSet<E>
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
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>
-
isLoaded
public boolean isLoaded()
-
loadField
protected void loadField()
-
spliterator
public Spliterator<E> spliterator()
- Specified by:
spliteratorin interfaceCollection<E>- Specified by:
spliteratorin interfaceIterable<E>- Specified by:
spliteratorin interfaceSet<E>- Overrides:
spliteratorin classHashSet<E>
-
-