org.jscience.computing.ai.planning
Class Precondition

java.lang.Object
  extended by org.jscience.computing.ai.planning.Precondition
Direct Known Subclasses:
PreconditionAssign, PreconditionAtomic, PreconditionCall, PreconditionForAll, PreconditionNegation, PreconditionNil

public abstract class Precondition
extends java.lang.Object

This abstract class represents an iterator over all the possible bindings that can satisfy its corresponding logical expression at run time.


Constructor Summary
Precondition()
           
 
Method Summary
abstract  void bind(Term[] binding)
          This abstract function binds the logical expression to a given binding.
 Term[] nextBinding()
          This function returns the next satisfier for this logical expression.
protected abstract  Term[] nextBindingHelper()
          This abstract function is called by the nextBinding function and does the subclass-specific part of the finding the next binding.
 void reset()
          This function resets this iterator so that it can iterate over again.
protected abstract  void resetHelper()
          This abstract function is called by the reset function and does the subclass-specific part of the resetting.
 Precondition setComparator(java.util.Comparator compIn)
          To set the function to be used to sort the possible bindings that satisfy this logical precondition.
 void setFirst(boolean firstIn)
          To set whether or not this function is marked :fist.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Precondition

public Precondition()
Method Detail

bind

public abstract void bind(Term[] binding)
This abstract function binds the logical expression to a given binding.

Parameters:
binding - the given binding.

nextBinding

public Term[] nextBinding()
This function returns the next satisfier for this logical expression.

Returns:
the next satisfier as an array of terms, each element of which is either what its corresponding variable should be mapped to, or null when that variable is not mapped under this satisfier, null if there is no such satisfier.

nextBindingHelper

protected abstract Term[] nextBindingHelper()
This abstract function is called by the nextBinding function and does the subclass-specific part of the finding the next binding.

Returns:
DOCUMENT ME!

reset

public void reset()
This function resets this iterator so that it can iterate over again. Note that this will undo any bindings and/or iterations done before.


resetHelper

protected abstract void resetHelper()
This abstract function is called by the reset function and does the subclass-specific part of the resetting.


setComparator

public Precondition setComparator(java.util.Comparator compIn)
To set the function to be used to sort the possible bindings that satisfy this logical precondition.

Parameters:
compIn - the function to be used to sort the possible bindings in case this is a :sort-by logical precondition, null otherwise.
Returns:
this object.

setFirst

public void setFirst(boolean firstIn)
To set whether or not this function is marked :fist.

Parameters:
firstIn - true if this logical expression is marked :first, false otherwise.