|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.cmu.cs.coral.icf.plan_based.planners.pip.MapChange
Represents a addition/deletion of an element in a map. Null keys and values are not supported.
Field Summary | |
static int |
add
Code for adding an element to the map. |
private int |
addDel
the type of change made to the map (addition[or change]/deletion) |
static int |
del
Code for removing an element from the map |
private java.lang.Object |
key
the key affected |
private java.util.Map |
map
the map changed |
private java.lang.Object |
newValue
the new value associated with the key or null if not applicable |
private java.lang.Object |
oldValue
the old value associated with the key or null if not applicable |
Constructor Summary | |
private |
MapChange(int add_del,
java.util.Map map,
java.lang.Object key,
java.lang.Object old_value,
java.lang.Object new_value)
Constructs a map change of the appopriate type. |
Method Summary | |
void |
apply()
Applies the change to the map. |
static MapChange |
makeMapChange(int add_del,
java.util.Map map,
java.lang.Object key,
java.lang.Object value)
Performs the designated operation and returns a map change that can be used to undo the operation. |
void |
undo()
Undoes the change to the map. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int add
public static final int del
private int addDel
private java.util.Map map
private java.lang.Object key
private java.lang.Object oldValue
private java.lang.Object newValue
Constructor Detail |
private MapChange(int add_del, java.util.Map map, java.lang.Object key, java.lang.Object old_value, java.lang.Object new_value)
add_del
- MapChange.add if the elemented is added to the map,
MapChange.del if the elemented is deleted to the map,map
- the map that is modifiedkey
- the key that is used to index into the mapold_value
- the new value for the key (when no old value, pass in null)new_value
- the new value for the key (when add_del==del, pass in null)Method Detail |
public void undo()
public void apply()
public static MapChange makeMapChange(int add_del, java.util.Map map, java.lang.Object key, java.lang.Object value)
add_del
- MapChange.add if the elemented is added to the map,
MapChange.del if the elemented is deleted to the map,map
- the map that is modifiedkey
- the key that is used to index into the mapvalue
- the new value for the key (ignored when add_del==del, pass in null)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |