org.jscience.computing.ai.planning
Class TermConstant

java.lang.Object
  extended by org.jscience.computing.ai.planning.CompileTimeObject
      extended by org.jscience.computing.ai.planning.Term
          extended by org.jscience.computing.ai.planning.TermConstant

public class TermConstant
extends Term

Each constant symbol, both at compile time and at run time, is an instance of this class.


Constructor Summary
TermConstant(int indexIn)
          To initialize this constant symbol.
 
Method Summary
 Term bind(Term[] binding)
          Since this term is a constant symbol, binding will not change it, therefore, simply this constant symbol itself is returned.
 boolean equals(Term t)
          Whether or not another term is equivalent to this constant symbol.
 boolean findUnifier(Term t, Term[] binding)
          Find a unifier between this constant symbol and another given term.
static TermConstant getConstant(int index)
          To return the correponding existing constant symbol.
 int getIndex()
          To get the index for this constant symbol.
static void initialize(int size)
          To initialize an array of constant symbols that we already know exist, so that there will be no duplicate copies of those symbols.
 boolean isGround()
          This function always returns true because a constant symbol is always ground by definition.
 java.lang.String toCode()
          This function produces Java code to create this constant symbol as a term.
 java.lang.String toString()
          Constant symbols are mapped at compile time to integers, this function, for printing purposes, maps them back to the strings they were before.
 
Methods inherited from class org.jscience.computing.ai.planning.Term
isNil, merge, merge, print
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TermConstant

public TermConstant(int indexIn)
To initialize this constant symbol.

Parameters:
indexIn - the integer associated with this constant symbol.
Method Detail

bind

public Term bind(Term[] binding)
Since this term is a constant symbol, binding will not change it, therefore, simply this constant symbol itself is returned.

Specified by:
bind in class Term
Parameters:
binding - DOCUMENT ME!
Returns:
DOCUMENT ME!

equals

public boolean equals(Term t)
Whether or not another term is equivalent to this constant symbol.

Specified by:
equals in class Term
Parameters:
t - DOCUMENT ME!
Returns:
DOCUMENT ME!

findUnifier

public boolean findUnifier(Term t,
                           Term[] binding)
Find a unifier between this constant symbol and another given term. Since this term is a constant symbol, this boils down to whether or not the other given term is equal to this one.

Specified by:
findUnifier in class Term
Parameters:
t - DOCUMENT ME!
binding - DOCUMENT ME!
Returns:
DOCUMENT ME!

getConstant

public static TermConstant getConstant(int index)
To return the correponding existing constant symbol.

Parameters:
index - the index of the constant symbol to be returned.
Returns:
the corresponding existing constant symbol.

getIndex

public int getIndex()
To get the index for this constant symbol.

Returns:
the integer associated with this constant symobl.

initialize

public static void initialize(int size)
To initialize an array of constant symbols that we already know exist, so that there will be no duplicate copies of those symbols. In other words, all constant symbols that represent the same thing in different places point to the corresponding element in this array at run time.

Parameters:
size - the number of existing constant symbols.

isGround

public boolean isGround()
This function always returns true because a constant symbol is always ground by definition.

Specified by:
isGround in class Term
Returns:
DOCUMENT ME!

toCode

public java.lang.String toCode()
This function produces Java code to create this constant symbol as a term.

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

toString

public java.lang.String toString()
Constant symbols are mapped at compile time to integers, this function, for printing purposes, maps them back to the strings they were before.

Specified by:
toString in class Term
Returns:
DOCUMENT ME!