public interface Query
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes a query.
|
void |
cut()
Discards choices made since this query object was created, like the goal
! |
boolean |
nextSolution()
Gets the next solution for the query.
|
void close() throws java.lang.NoSuchMethodException, java.lang.InterruptedException, java.lang.Exception
openPrologQuery
was
called. If the query is not the most recently opened, all still open
queries opened after this query will be closed as well.
A closed
or
cut
query is invalidated and most
operations on it will throw an exception. In particular, you should not
call close
, cut
or nextSolution
on
an invalidated query.
Invalidates all Term objects created since this query was created. If you
need to keep data created by the query (i.e. data referred to by
Term
objects), you need to convert it to Java
datatypes before calling this function.
java.lang.NoSuchMethodException
- Undocumentedjava.lang.InterruptedException
- the thread was interruptedjava.lang.Exception
- something went wrongvoid cut() throws java.lang.NoSuchMethodException, java.lang.InterruptedException, java.lang.Exception
!
.
If the query is not the most recently opened, all still open queries opened after this query will be cut as well.
A closed
or
cut
query is invalidated and most
operations on it will throw an exception. In particular, you should not
call close
, cut
or nextSolution
on
an invalidated query.
Invalidates all Term objects created since this query was created. If you
need to keep data created by the query (i.e. data referred to by
Term
objects), you need to convert it to Java
datatypes before calling this function.
java.lang.NoSuchMethodException
- Undocumentedjava.lang.InterruptedException
- the thread was interruptedjava.lang.Exception
- something went wrongboolean nextSolution() throws java.lang.NoSuchMethodException, java.lang.InterruptedException, java.lang.Exception
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. Invalidates all Term
objects created since this query
was created
Invalidates all SPTerm objects created since this query was created. If
you need to keep data created by the previous call to
nextSolution
to this query (i.e. data referred to by
Term
objects), you need to convert it to Java
datatypes before calling this function.
java.lang.NoSuchMethodException
- Undocumentedjava.lang.InterruptedException
- the thread was interruptedjava.lang.Exception
- something went wrongProlog.openPrologQuery(java.lang.String, java.util.Map)
,
close()
,
cut()