|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--CiaoJava.PLGoal
This class Represents a Prolog goal to be evaluated on a given PLConnection. This class connects to the Prolog side of the interface to manage the evaluation of the goals launched from the Java side. Instances of this class should be generated with the launchGoal method of the PLConnection class.
Constructor Summary | |
PLGoal(PLConnection where,
PLTerm term)
Goal constructor. |
|
PLGoal(PLConnection where,
java.lang.String term)
Goal constructor. |
|
PLGoal(PLTerm term)
Goal constructor. |
|
PLGoal(java.lang.String term)
Goal constructor. |
Method Summary | |
boolean |
execute()
Sends to Prolog process a request for the execution of this goal, and returns immediately. |
protected void |
finalize()
Destructor. |
PLConnection |
getConnection()
Gets connection that this goal uses to communicate to Prolog. |
boolean |
isStillRunning()
Checks if Prolog is still running this query, or there are solutions that have not been requested. |
PLTerm |
nextSolution()
Sends to Prolog process a request for the next query solution. |
void |
query()
Goal query. |
void |
terminate()
Terminates this Prolog goal execution. |
java.lang.String |
toString()
String representation of a Prolog goal. |
void |
useModule(PLTerm module)
This method loads a module in the Prolog process. |
void |
useModule(java.lang.String module)
This method loads a module in the Prolog process. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PLGoal(PLTerm term) throws PLException
term
.term
- Prolog term that represents the goal that
will be evaluated.PLException
- if there is no
connection to Prolog.public PLGoal(PLConnection where, PLTerm term)
where
Prolog
process, using the Prolog term represented with term
.where
- Prolog process on which the goal must
be evaluated.term
- Prolog term that represents the goal that
will be evaluated.public PLGoal(java.lang.String term) throws java.io.IOException, PLException
term
.term
- String containing the representation of a
well formed Prolog term that represents
the goal that will be evaluated.PLException
- if there is no
connection to Prolog.public PLGoal(PLConnection where, java.lang.String term) throws java.io.IOException, PLException
where
Prolog
process, using the Prolog term represented with termString
string. This string must be a well formed Prolog term; otherwise a
PLException
will be thrown. This method connects to
Prolog to parse the string containing the goal.
- Parameters:
where
- Prolog process on which the goal must
be evaluated.term
- String containing the representation of a
well formed Prolog term that represents
the goal that will be evaluated.
Method Detail |
public void query() throws java.io.IOException, PLException
PLConnection
associated object the
goal represented by this object. To obtain the solutions of this
goal, the nextSolution()
method must be called, once for
each solution.IOException
,
- PLException
if there is any problem
communicating with the Prolog process, or in the
Prolog side (e.g., the predicate to be launched
does not exist, or the goal has been launched yet).public PLTerm nextSolution() throws java.io.IOException, PLException
null
is returned, and
isStillRunning() method must be used to distinguish between
a goal that fails, and a goal that is still running, but no
solutions are available currently.IOException
- if there are any error on
the sockets.PLException
- if there are any error on
the Prolog process. If the Prolog goal raises an
exception, it is propagated through the interface,
and a PLException
is raised in the
user Java program.public boolean execute() throws java.io.IOException, PLException
true
if the goal was launched successfullyIOException
- if there are any error on
the sockets.PLException
- if there are any error on
the Prolog process. If the Prolog goal raises an
exception, it is propagated through the interface,
and a PLException
is raised in the
user Java program.public boolean isStillRunning() throws PLException, java.io.IOException
null
to
ensure that there are no more solutions to request to
this goal.IOException
- if there are any error on
the sockets.PLException
- if there are any error on
the Prolog process. If the Prolog goal raises an
exception, it is propagated through the interface,
and a PLException
is raised in the
user Java program.public void terminate() throws java.io.IOException, PLException
java.io.IOException
- if there are any error on the socket
communicationPLException
- if there are any error on the Prolog
processpublic void useModule(PLTerm module) throws java.io.IOException, PLException
module
- Prolog term that represents the name of the module
to be loaded. Can be used the library(module) format.java.io.IOException
- if there are any I/O error with the socketsPLException
- if there are any error in the Prolog processpublic void useModule(java.lang.String module) throws java.io.IOException, PLException
module
- String that contains a Prolog term with the name of
the module to be loaded. Can be used the
library(module) format. The path must be accesible
to the Prolog server.java.io.IOException
- if there are any I/O error with the socketsPLException
- if there are any error in the Prolog processprotected void finalize() throws java.io.IOException, PLException, java.lang.Throwable
finalize
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
String
object representing
this Prolog goal.public PLConnection getConnection()
PLConnection
object representing
current connection to Prolog side.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |