|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJSHOP2.CompileTimeObject
JSHOP2.DelAddElement
JSHOP2.DelAddAtomic
public class DelAddAtomic
Each atomic element in the delete/add list of an operator both at compile time and run time is represented as an instance of this class.
Field Summary | |
---|---|
private Predicate |
atom
The atom to be deleted/added. |
Fields inherited from class JSHOP2.CompileTimeObject |
---|
endl |
Constructor Summary | |
---|---|
DelAddAtomic(Predicate atomIn)
To initialize this atomic delete/add element. |
Method Summary | |
---|---|
void |
add(State s,
Term[] binding,
java.util.Vector[] delAddList)
To add this atomic delete/add element to the current state of the world. |
boolean |
del(State s,
Term[] binding,
java.util.Vector[] delAddList)
To delete this atomic delete/add element from the current state of the world. |
void |
setVarCount(int varCount)
To set the number of variables in this atomic delete/add element. |
java.lang.String |
toCode()
This function produces Java code to create this atomic delete/add element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Predicate atom
Constructor Detail |
---|
public DelAddAtomic(Predicate atomIn)
atomIn
- the atom to be deleted/added.Method Detail |
---|
public void add(State s, Term[] binding, java.util.Vector[] delAddList)
add
in class DelAddElement
s
- the current state of the world.binding
- the binding to be applied before adding the element.delAddList
- an array of size 4 of atoms and protections deleted and added.
This is useful when a backtrack happens: Added atoms and
protections are retracted, and deleted atoms and protections are
added back to change the state of the world to what it was before
backtracked decision was made. The 4 elements of the array are
the deleted atoms, the added atoms, the deleted protections, and
the added protections repectively.public boolean del(State s, Term[] binding, java.util.Vector[] delAddList)
del
in class DelAddElement
s
- the current state of the world.binding
- the binding to be applied before deleting the element.delAddList
- an array of size 4 of atoms and protections deleted and added.
This is useful when a backtrack happens: Added atoms and
protections are retracted, and deleted atoms and protections are
added back to change the state of the world to what it was before
backtracked decision was made. The 4 elements of array are the
the deleted atoms, added atoms, deleted protections and added
protections in that order.
true
if the atom(s) associated with this
delete/add element were deleted, false
otherwise,
i.e., when at least one of the atoms to be deleted was protected.
If this function returns false
, it means the
operator has failed and should be backtracked.public void setVarCount(int varCount)
setVarCount
in class DelAddElement
varCount
- the number of variables.public java.lang.String toCode()
toCode
in class CompileTimeObject
String
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |