Class Operator

  extended by
      extended by

public abstract class Operator
extends DomainElement

Each operator at run time is represented as a class derived from this abstract class.

Constructor Summary
Operator(Predicate head, int delVarIdxIn, int addVarIdxIn, Term costIn)
          To initialize the operator.
Method Summary
 boolean apply(Term[] binding, State s, java.util.Vector[] delAdd)
          This function is used to apply this operator to a given state.
 double getCost(Term[] binding)
          To get the cost of this operator.
 void setAdd(DelAddElement[] addIn)
          To set the add list.
 void setDel(DelAddElement[] delIn)
          To set the delete list.
Methods inherited from class
getHead, getIterator, unify
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Operator(Predicate head,
                int delVarIdxIn,
                int addVarIdxIn,
                Term costIn)
To initialize the operator.

head - head of the operator.
delVarIdxIn - the index of the delete list as a variable, -1 if the delete list is not a variable.
addVarIdxIn - the index of the add list as a variable, -1 if the add list is not a variable.
costIn - the cost of the operator.
Method Detail


public boolean apply(Term[] binding,
                     State s,
                     java.util.Vector[] delAdd)
This function is used to apply this operator to a given state.

binding - the current binding.
s - current state of the world.
delAdd - a 4-member array of type Vector used to keep track of the atoms and protections deleted from and added to the current state of the world as the result of applying this operator. This data can be used later in case of a backtrack to undo these changes.
true if the operator was applicable, false otherwise. An operator is not applicable when at least one of the atoms it tries to delete is protected.


public double getCost(Term[] binding)
To get the cost of this operator.

binding - the binding to be applied to the cost term.
the cost of applying this operator.


public void setAdd(DelAddElement[] addIn)
To set the add list.

addIn - the add list.


public void setDel(DelAddElement[] delIn)
To set the delete list.

delIn - the delete list.