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 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()
boolean
equals(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.int
hashCode()
boolean
isEmpty()
boolean
isLoaded()
Iterator<E>
iterator()
protected void
loadField()
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.int
size()
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: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>
-
equals
public boolean equals(Object o)
- Specified by:
equals
in interfaceCollection<E>
- Specified by:
equals
in interfaceSet<E>
- Overrides:
equals
in classAbstractSet<E>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<E>
- Specified by:
hashCode
in interfaceSet<E>
- Overrides:
hashCode
in classAbstractSet<E>
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
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>
-
isLoaded
public boolean isLoaded()
-
loadField
protected void loadField()
-
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>
-
-