org.jscience.computing.ai.planning
Class InternalDomain

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

public class InternalDomain
extends java.lang.Object

Each domain at compile time is represented as an instance of this class.


Constructor Summary
InternalDomain(java.io.File fin, java.lang.String[] argsIn)
          To initialize this domain.
 
Method Summary
 void addAxiom(InternalAxiom axiom)
          To add an axiom to the list of axioms read from the file.
 void addCalc(java.lang.String what)
          To add the String name of an external code call to the list of such code calls.
 int addCompoundTask(java.lang.String s)
          To add a String used as a name of a compound task in the domain description to the list of compound task names, in case it has not been added before.
 int addConstant(java.lang.String s)
          To add a String used as a constant symbol in the domain description to the list of constant symbols, in case it has not been added before.
 void addMethod(InternalMethod method)
          To add a method to the list of methods read from the file.
 void addOperator(InternalOperator op)
          To add an operator to the list of operators read from the file.
 int addPrimitiveTask(java.lang.String s)
          To add a String used as a name of a primitive task in the domain description to the list of primitive task names, in case it has not been added before.
 void close(int varsMaxSize)
          This function writes the Java code necessary to produce this domain at run time in the appropriate file.
 void commandInitialize()
          This function performs some necessary initialization when a problem file is being compiled, mainly reading and parsing the text file associated with the domain the planning problem is defined in.
 void commandToCode(java.util.Vector state, TaskList tl)
          This function writes the Java code necessary to produce this planning problem at run time in the appropriate file.
 void dumpStringArray(java.io.BufferedWriter dest, java.util.Vector list)
          This function saves a given Vector of Strings in a given file.
 int getAxiomNo()
          This function returns the number of axioms in this domain.
 java.util.Vector getCompoundTasks()
          This function returns the Vector where the String names of the compound tasks in this domain are stored.
 java.util.Vector getConstants()
          This function returns the Vector where the String names of the constant symbols in this domain are stored.
 int getMethodNo()
          This function returns the number of methods in this domain.
 java.lang.String getName()
          This function returns the String name of this domain.
 java.util.Vector getPrimitiveTasks()
          This function returns the Vector where the String names of the primitive tasks in this domain are stored.
static void main(java.lang.String[] args)
          The main function that is called to do the compilation.
 int readStringArray(java.io.BufferedReader src, java.util.Vector list)
          This function reads a Vector of Strings from a given file.
 void setName(java.lang.String nameIn)
          To set the name of this planning domain.
 void setProbName(java.lang.String probNameIn)
          To set the name of this planning problem.
 java.lang.String vectorToCode(java.util.Vector list, java.lang.String name)
          This function produces the Java code needed to allocate and initialize an array the elements of which are drawn from a given Vector of Strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternalDomain

public InternalDomain(java.io.File fin,
                      java.lang.String[] argsIn)
               throws java.io.IOException
To initialize this domain.

Parameters:
fin - the file from which the domain description is to be read.
argsIn - the argument list passed to this class.
Throws:
java.io.IOException
Method Detail

addAxiom

public void addAxiom(InternalAxiom axiom)
To add an axiom to the list of axioms read from the file.

Parameters:
axiom - the axiom to be added.

addCompoundTask

public int addCompoundTask(java.lang.String s)
To add a String used as a name of a compound task in the domain description to the list of compound task names, in case it has not been added before.

Parameters:
s - the String to be added.
Returns:
the index assigned to this name.

addConstant

public int addConstant(java.lang.String s)
To add a String used as a constant symbol in the domain description to the list of constant symbols, in case it has not been added before.

Parameters:
s - the String to be added.
Returns:
the index assigned to this name.

addCalc

public void addCalc(java.lang.String what)
To add the String name of an external code call to the list of such code calls.

Parameters:
what - the name of the code call being added.

addMethod

public void addMethod(InternalMethod method)
To add a method to the list of methods read from the file.

Parameters:
method - the method to be added.

addOperator

public void addOperator(InternalOperator op)
To add an operator to the list of operators read from the file.

Parameters:
op - the operator to be added.

addPrimitiveTask

public int addPrimitiveTask(java.lang.String s)
To add a String used as a name of a primitive task in the domain description to the list of primitive task names, in case it has not been added before.

Parameters:
s - the String to be added.
Returns:
the index assigned to this name.

close

public void close(int varsMaxSize)
           throws java.io.IOException
This function writes the Java code necessary to produce this domain at run time in the appropriate file.

Parameters:
varsMaxSize - the maximum number of variables seen in any variable scope in this domain.
Throws:
java.io.IOException

commandInitialize

public void commandInitialize()
                       throws java.io.IOException
This function performs some necessary initialization when a problem file is being compiled, mainly reading and parsing the text file associated with the domain the planning problem is defined in.

Throws:
java.io.IOException

commandToCode

public void commandToCode(java.util.Vector state,
                          TaskList tl)
                   throws java.io.IOException
This function writes the Java code necessary to produce this planning problem at run time in the appropriate file.

Parameters:
state - the initial state of the world in the planning problem.
tl - the task list to be achieved.
Throws:
java.io.IOException

dumpStringArray

public void dumpStringArray(java.io.BufferedWriter dest,
                            java.util.Vector list)
                     throws java.io.IOException
This function saves a given Vector of Strings in a given file.

Parameters:
dest - the file where the Vector is to be saved.
list - the Vector to be saved.
Throws:
java.io.IOException

getAxiomNo

public int getAxiomNo()
This function returns the number of axioms in this domain.

Returns:
the number of axioms in this domain.

getCompoundTasks

public java.util.Vector getCompoundTasks()
This function returns the Vector where the String names of the compound tasks in this domain are stored.

Returns:
the Vector where the String names of the compound tasks in this domain are stored.

getConstants

public java.util.Vector getConstants()
This function returns the Vector where the String names of the constant symbols in this domain are stored.

Returns:
the Vector where the String names of the constant symbols in this domain are stored.

getMethodNo

public int getMethodNo()
This function returns the number of methods in this domain.

Returns:
the number of methods in this domain.

getName

public java.lang.String getName()
This function returns the String name of this domain.

Returns:
the String name of this domain.

getPrimitiveTasks

public java.util.Vector getPrimitiveTasks()
This function returns the Vector where the String names of the primitive tasks in this domain are stored.

Returns:
the Vector where the String names of the primitive tasks in this domain are stored.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
The main function that is called to do the compilation.

Parameters:
args - the command line arguments.
Throws:
java.lang.Exception

readStringArray

public int readStringArray(java.io.BufferedReader src,
                           java.util.Vector list)
                    throws java.io.IOException
This function reads a Vector of Strings from a given file.

Parameters:
src - the input file.
list - the Vector to be read.
Returns:
the number of the elements in the Vector.
Throws:
java.io.IOException

setName

public void setName(java.lang.String nameIn)
To set the name of this planning domain.

Parameters:
nameIn - the name of this planning domain.

setProbName

public void setProbName(java.lang.String probNameIn)
To set the name of this planning problem.

Parameters:
probNameIn - the name of this planning problem.

vectorToCode

public java.lang.String vectorToCode(java.util.Vector list,
                                     java.lang.String name)
This function produces the Java code needed to allocate and initialize an array the elements of which are drawn from a given Vector of Strings.

Parameters:
list - the Vector the elements of which are to be stored in the resulting array.
name - the name of the array where the elements of the Vector are to be stored.
Returns:
the produced Java code.