|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJSHOP2.CompileTimeObject
JSHOP2.DelAddElement
JSHOP2.DelAddForAll
public class DelAddForAll
Each ForAll
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[] |
atoms
The atoms to be deleted/added. |
private static int |
classCnt
The number of objects already instantiated from this class. |
private int |
cnt
The number of objects already instantiated from this class before this object was instantiated. |
private LogicalExpression |
exp
The precondtion of the ForAll statement at compile time is
represented by this variable. |
private Precondition |
pre
The precondtion of the ForAll statement at run time is
represented by this variable. |
Fields inherited from class JSHOP2.CompileTimeObject |
---|
endl |
Constructor Summary | |
---|---|
DelAddForAll(LogicalExpression expIn,
java.util.Vector<Predicate> atomsIn)
To initialize this ForAll delete/add element at compile
time. |
|
DelAddForAll(Precondition preIn,
Predicate[] atomsIn)
To initialize this ForAll delete/add element at run time. |
Method Summary | |
---|---|
void |
add(State s,
Term[] binding,
java.util.Vector[] delAddList)
To add the atoms of this ForAll delete/add element to the
current state of the world. |
boolean |
del(State s,
Term[] binding,
java.util.Vector[] delAddList)
To delete the atoms of this ForAll delete/add element from
the current state of the world. |
java.lang.String |
getExpCode()
This function produces Java code that initializes some data structures that will be needed to create the precondition object that implements the precondition of this ForAll delete/add element at run
time. |
java.lang.String |
getInitCode()
This function produces Java code used to initialize an array of type predicate this ForAll delete/add element will use at run
time to represent the atoms that will be deleted/added by this element. |
void |
setVarCount(int varCount)
To set the number of variables in this ForAll delete/add
element. |
java.lang.String |
toCode()
This function produces Java code to create this ForAll
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[] atoms
private static int classCnt
private int cnt
private LogicalExpression exp
ForAll
statement at compile time is
represented by this variable.
private Precondition pre
ForAll
statement at run time is
represented by this variable.
Constructor Detail |
---|
public DelAddForAll(LogicalExpression expIn, java.util.Vector<Predicate> atomsIn)
ForAll
delete/add element at compile
time.
expIn
- the logical expression to be the precondition of this
ForAll
delete/add element.atomsIn
- the atoms to be added/deleted as a Vector
. Note that
we use a Vector
rather than an array at compile time
because at compile time we do not know how many atoms there will
be.public DelAddForAll(Precondition preIn, Predicate[] atomsIn)
ForAll
delete/add element at run time.
preIn
- the logical expression to be the precondition of this
ForAll
delete/add element.atomsIn
- the atoms to be added/deleted as an array. Note that we use an
array rather than a Vector
at run time because at
run time we know how many atoms there will be.Method Detail |
---|
public void add(State s, Term[] binding, java.util.Vector[] delAddList)
ForAll
delete/add element to the
current state of the world.
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)
ForAll
delete/add element from
the current state of the world.
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 java.lang.String getExpCode()
ForAll
delete/add element at run
time.
String
.public java.lang.String getInitCode()
ForAll
delete/add element will use at run
time to represent the atoms that will be deleted/added by this element.
It also produces the code to set the current unifier for the precondition
of this element to an empty one (i.e., an array of null
elements, because when this precondition is created there is still no
binding to be applied to it.
String
.public void setVarCount(int varCount)
ForAll
delete/add
element.
setVarCount
in class DelAddElement
varCount
- the number of variables.public java.lang.String toCode()
ForAll
delete/add element.
toCode
in class CompileTimeObject
String
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |