org.jscience.computing.ai.planning
Class NumberedPredicate

java.lang.Object
  extended by org.jscience.computing.ai.planning.NumberedPredicate

public class NumberedPredicate
extends java.lang.Object

This class represents a predicate with an integer number associated with it. It serves two different purposes: First, to represent a protection on some predicate (the integer number being the number of times the predicate is protected), and second, when a predicate is deleted from the current state of the world, an object of this class represents the deleted predicate and where it was deleted from so that in case of a backtrack the deleted predicate can be added back exactly where it was before.


Constructor Summary
NumberedPredicate(Predicate preIn)
          To initialize an object of this class.
NumberedPredicate(Predicate preIn, int numberIn)
          To initialize an object of this class.
 
Method Summary
 boolean dec()
          To decrease the integer by one.
 int getHead()
          To get the head of the predicate.
 int getNumber()
          To get the integer associated with this object.
 Term getParam()
          To get the parameters of the predicate.
 void inc()
          To increase the integer by one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberedPredicate

public NumberedPredicate(Predicate preIn)
To initialize an object of this class. The integer will be set to 1.

Parameters:
preIn - the predicate.

NumberedPredicate

public NumberedPredicate(Predicate preIn,
                         int numberIn)
To initialize an object of this class.

Parameters:
preIn - the predicate.
numberIn - the integer.
Method Detail

dec

public boolean dec()
To decrease the integer by one. This is used when a protection is deleted.

Returns:
false if the integer become zero, true otherwise.

getHead

public int getHead()
To get the head of the predicate.

Returns:
the head of the predicate.

getNumber

public int getNumber()
To get the integer associated with this object.

Returns:
the integer associated with this object.

getParam

public Term getParam()
To get the parameters of the predicate.

Returns:
the parameters of the predicate.

inc

public void inc()
To increase the integer by one. This is used when a protection is added.