org.jscience.computing.ai.planning
Class DelAddForAll

java.lang.Object
  extended by org.jscience.computing.ai.planning.CompileTimeObject
      extended by org.jscience.computing.ai.planning.DelAddElement
          extended by org.jscience.computing.ai.planning.DelAddForAll

public class DelAddForAll
extends DelAddElement

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.


Constructor Summary
DelAddForAll(LogicalExpression expIn, java.util.Vector 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
 

Constructor Detail

DelAddForAll

public DelAddForAll(LogicalExpression expIn,
                    java.util.Vector atomsIn)
To initialize this ForAll delete/add element at compile time.

Parameters:
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.

DelAddForAll

public DelAddForAll(Precondition preIn,
                    Predicate[] atomsIn)
To initialize this ForAll delete/add element at run time.

Parameters:
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

add

public 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.

Specified by:
add in class DelAddElement
Parameters:
s - DOCUMENT ME!
binding - DOCUMENT ME!
delAddList - DOCUMENT ME!

del

public 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.

Specified by:
del in class DelAddElement
Parameters:
s - DOCUMENT ME!
binding - DOCUMENT ME!
delAddList - DOCUMENT ME!
Returns:
DOCUMENT ME!

getExpCode

public 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.

Returns:
the produced code as a String.

getInitCode

public 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. 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.

Returns:
the Java code as a String.

setVarCount

public void setVarCount(int varCount)
To set the number of variables in this ForAll delete/add element.

Specified by:
setVarCount in class DelAddElement
Parameters:
varCount - DOCUMENT ME!

toCode

public java.lang.String toCode()
This function produces Java code to create this ForAll delete/add element.

Specified by:
toCode in class CompileTimeObject
Returns:
DOCUMENT ME!