net.ontopia.persistence.proxy
Class TrackableLazySet

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.TrackableLazySet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.Set, TrackableCollectionIF

public class TrackableLazySet
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. 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

Field Summary
protected  java.util.Set added
           
protected  int field
           
protected  IdentityIF identity
           
protected  boolean loaded
           
protected  java.util.Set removed
           
protected  TransactionIF txn
           
 
Constructor Summary
TrackableLazySet(TransactionIF txn, IdentityIF identity, int field)
           
 
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()
           
 boolean equals(java.lang.Object o)
           
 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.
 int hashCode()
           
 boolean isEmpty()
           
 boolean isLoaded()
           
 java.util.Iterator iterator()
           
protected  void loadField()
           
 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.
 int size()
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 
Methods inherited from class java.util.HashSet
clone
 
Methods inherited from class java.util.AbstractCollection
toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

txn

protected TransactionIF txn

identity

protected IdentityIF identity

field

protected int field

loaded

protected boolean loaded

added

protected java.util.Set added

removed

protected java.util.Set removed
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 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

equals

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

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.Set
Overrides:
hashCode in class java.util.AbstractSet

isEmpty

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

size

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

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

isLoaded

public boolean isLoaded()

loadField

protected void loadField()


Copyright © 2000-2012 Ontopia.