se.sics.jasper
Class SPQuery

java.lang.Object
  |
  +--se.sics.jasper.SPQuery

public class SPQuery
extends java.lang.Object

This class is used for holding a query-reference which is used to find multiple solutions to a query. This class is never instantiated explicitly by the user.

See Also:
SICStus.openQuery(se.sics.jasper.SPPredicate, se.sics.jasper.SPTerm[])

Method Summary
 void close()
          Closes a query.
 void cut()
          Discard choices made since this query object was created, like the goal !.
 boolean nextSolution()
          Gets the next solution for the query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

close

public void close()
           throws IllegalCallerException
Closes a query. All remaining solutions to the query are discarded, and the state of the Prolog engine will be restored to the state it was in when openQuery was called. This means that the query is not the most recently opened, all queries opened after this query will be closed as well.

If you need to keep data created by the query (i.e. data referred to by SPTerm objects), you need to convert it to Java datatypes before calling this function.

Throws:
IllegalCallerException -  

nextSolution

public boolean nextSolution()
                     throws SPException
Gets the next solution for the query. Returns false when there are no more solutions. When no more solutions are needed, the query must be closed using the method close().

Multiple queries can be open at the same time, but the calls to nextSolution must be nested, i.e. refer to the most recently opened query.

Returns:
False if there are no more solutions, True otherwise.
Throws:
SPException - If a Prolog exception was thrown during the query.
IllegalCallerException -  
See Also:
close()

cut

public void cut()
         throws SPException
Discard choices made since this query object was created, like the goal !.
Throws:
SPException - If a Prolog exception was thrown.
IllegalCallerException -