|
|||||||||
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.
Field Summary | |
private PLTerm |
actualGoal
|
private static java.lang.String |
EXCEPTION
|
private static java.lang.String |
FAIL
|
private static int |
FINISHED
|
private static java.lang.String |
LAUNCH_GOAL
|
private static java.lang.String |
LAUNCH_GOAL_ON_THREAD
|
private static java.lang.String |
NEXT_SOLUTION
|
private static java.lang.String |
NEXT_SOLUTION_ON_THREAD
|
private static int |
NOT_LAUNCHED
|
private PLTerm |
originalGoal
|
private PLConnection |
prologSpace
|
private int |
queryId
|
protected static java.lang.String |
SOLUTION
|
private static java.lang.String |
TERMINATE_QUERY
|
private static java.lang.String |
TERMINATE_QUERY_ON_THREAD
|
private static int |
TERMINATED
|
private static java.lang.String |
USE_MODULE
|
Constructor Summary | |
PLGoal(PLConnection where,
PLTerm term)
Goal constructor. |
|
PLGoal(PLConnection where,
java.lang.String term)
Goal constructor. |
Method Summary | |
protected void |
finalize()
Destructor. |
PLTerm |
nextSolution()
Sends to Prolog process a request for the next query solution. |
private PLTerm |
parseTerm(java.lang.String termString)
This method uses the Prolog process to parse a Prolog term received as a string. |
void |
query()
Goal query. |
private void |
terminate_()
This private method implements the common tasks related to goal termination. |
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 |
|
Field Detail |
protected static final java.lang.String SOLUTION
private PLTerm originalGoal
private PLTerm actualGoal
private PLConnection prologSpace
private int queryId
private static final java.lang.String LAUNCH_GOAL
private static final java.lang.String NEXT_SOLUTION
private static final java.lang.String TERMINATE_QUERY
private static final java.lang.String FAIL
private static final java.lang.String EXCEPTION
private static final java.lang.String LAUNCH_GOAL_ON_THREAD
private static final java.lang.String NEXT_SOLUTION_ON_THREAD
private static final java.lang.String TERMINATE_QUERY_ON_THREAD
private static final java.lang.String USE_MODULE
private static final int NOT_LAUNCHED
private static final int TERMINATED
private static final int FINISHED
Constructor Detail |
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(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
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
public 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.public 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.private void terminate_() throws java.io.IOException, PLException
protected void finalize() throws java.io.IOException, PLException, java.lang.Throwable
private PLTerm parseTerm(java.lang.String termString) throws java.io.IOException, PLException
termString
- String
object that represents a well
formed Prolog term.PLTerm
that represents this Prolog term.IOException
- if the socket stream has been
broken.PLException
- if there is a problem parsing
the term on the Prolog side.public java.lang.String toString()
String
object representing
this Prolog goal.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |