org.apache.cayenne.graph
Class CompoundDiff

java.lang.Object
  extended by org.apache.cayenne.graph.CompoundDiff
All Implemented Interfaces:
java.io.Serializable, GraphDiff

public class CompoundDiff
extends java.lang.Object
implements GraphDiff

A GraphDiff that is a list of other GraphDiffs.

Since:
1.2
Author:
Andrus Adamchik
See Also:
Serialized Form

Field Summary
protected  java.util.List diffs
           
 
Constructor Summary
CompoundDiff()
          Creates an empty CompoundDiff instance.
CompoundDiff(java.util.List diffs)
          Creates CompoundDiff instance.
 
Method Summary
 void add(GraphDiff diff)
           
 void addAll(java.util.Collection diffs)
           
 void apply(GraphChangeHandler tracker)
          Iterates over diffs list, calling "apply" on each individual diff.
 java.util.List getDiffs()
           
 boolean isNoop()
          Returns true if this diff has no other diffs or if all of its diffs are noops.
 void undo(GraphChangeHandler tracker)
          Iterates over diffs list in reverse order, calling "apply" on each individual diff.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

diffs

protected java.util.List diffs
Constructor Detail

CompoundDiff

public CompoundDiff()
Creates an empty CompoundDiff instance.


CompoundDiff

public CompoundDiff(java.util.List diffs)
Creates CompoundDiff instance. Note that a List is not cloned in this constructor, so subsequent calls to add and addAll would modify the original list.

Method Detail

isNoop

public boolean isNoop()
Returns true if this diff has no other diffs or if all of its diffs are noops.

Specified by:
isNoop in interface GraphDiff

getDiffs

public java.util.List getDiffs()

add

public void add(GraphDiff diff)

addAll

public void addAll(java.util.Collection diffs)

apply

public void apply(GraphChangeHandler tracker)
Iterates over diffs list, calling "apply" on each individual diff.

Specified by:
apply in interface GraphDiff

undo

public void undo(GraphChangeHandler tracker)
Iterates over diffs list in reverse order, calling "apply" on each individual diff.

Specified by:
undo in interface GraphDiff


Copyright © 2001-2006 Apache.org All Rights Reserved.