edu.cmu.cs.coral.icf.plan_based.planners.pip
Class SetChange

java.lang.Object
  |
  +--edu.cmu.cs.coral.icf.plan_based.planners.pip.SetChange

public class SetChange
extends java.lang.Object
implements Change

Represents a addition/deletion to a set.

Since:
ICF 0.0
Version:
$Id$

Field Summary
static int add
          Code for adding an element to the set.
private  int addDel
          the type of change made to the set (addition/deletion)
static int del
          Code for removing an element from the set
private  java.lang.Object elem
          the element affected
private  java.util.Set set
          the set modified
 
Constructor Summary
private SetChange(int add_del, java.util.Set set, java.lang.Object elem)
          Constructs a set change of the appopriate type.
 
Method Summary
 void apply()
          Applies the change to the set.
static SetChange makeSetChange(int add_del, java.util.Set set, java.lang.Object elem)
          Performs the designated operation and returns a set change that can be used to undo the operation.
 void undo()
          Undoes the change to the set.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

add

public static final int add
Code for adding an element to the set.
Since:
ICF 0.0

del

public static final int del
Code for removing an element from the set
Since:
ICF 0.0

addDel

private int addDel
the type of change made to the set (addition/deletion)
Since:
ICF 0.0

set

private java.util.Set set
the set modified
Since:
ICF 0.0

elem

private java.lang.Object elem
the element affected
Since:
ICF 0.0
Constructor Detail

SetChange

private SetChange(int add_del,
                  java.util.Set set,
                  java.lang.Object elem)
Constructs a set change of the appopriate type.
Parameters:
add_del - SetChange.add if the elemented is added to the set, SetChange.del if the elemented is deleted to the set,
set - the set that is modified
elem - the element that is added/removed from the set
Since:
ICF 0.0
Method Detail

makeSetChange

public static SetChange makeSetChange(int add_del,
                                      java.util.Set set,
                                      java.lang.Object elem)
Performs the designated operation and returns a set change that can be used to undo the operation.
Parameters:
add_del - SetChange.add if the elemented is added to the set, SetChange.del if the elemented is deleted to the set,
set - the set that is modified
elem - the element that is added/removed from the set
Returns:
a SetChange object that can undo the requested operation or null if no change resulted
Since:
ICF 0.0

undo

public void undo()
Undoes the change to the set.
Specified by:
undo in interface Change
Since:
ICF 0.0

apply

public void apply()
Applies the change to the set.
Specified by:
apply in interface Change
Since:
ICF 0.0