com.ugos.JIProlog.engine
Class JIPQuery

java.lang.Object
  |
  +--com.ugos.JIProlog.engine.JIPQuery
All Implemented Interfaces:
java.io.Serializable

public class JIPQuery
extends java.lang.Object
implements java.io.Serializable

JIPQuery wraps a single synchronous query.
By asyncronous call it is intended a call to prolog interpreter that runs in a separate thread and notify for solutions all event listeners
. By syncronous call it is intended a call to prolog interpreter that runs in the same thread and exit when a solution is found
. An asyncronous, more powerful, management of the prolog interpreter see JIPEngine.
For more information see the section "How to make a synchronous call to prolog interpreter"

Since:
2.0 Home Page: http://www.ugosweb.com/jiprolog
Version:
2.0
Author:
Ugo Chirico 2002
See Also:
JIPEngine, Serialized Form

Method Summary
 void close()
          Closes the query
 boolean hasMoreChoicePoints()
          Returns true if the query has more choice points on backtracking.
 boolean isClosed()
          Returns true if the query is closed.
 JIPTerm nextSolution()
          Searches for another solution.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

nextSolution

public final JIPTerm nextSolution()
                           throws JIPQueryClosedException
Searches for another solution. When a solution is found it returns the corresponding JIPTerm object. If there are no more solutions it returns null.
Raises a JIPQueryClosedException if called again after it has returned null.

Returns:
next solution found or null if there are no more solution.
Throws:
JIPQueryClosedException
See Also:
JIPTerm

hasMoreChoicePoints

public final boolean hasMoreChoicePoints()
Returns true if the query has more choice points on backtracking.

Returns:
true if the query has more choice points or if nextSolution has not been colled yet, false otherwise.

isClosed

public final boolean isClosed()
Returns true if the query is closed.

Returns:
true if the query is closed, false otherwise.

close

public final void close()
Closes the query