Interface ITerminator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Solver.setTerminator(ITerminator). While the solver executes a query
(e.g., Solver.checkSat()), it periodically calls
terminate() to determine whether the query should be terminated.
If terminate() returns true, the query is terminated as if a
resource limit had been reached. For queries that return a Result,
the result is unknown with explanation
UnknownExplanation.INTERRUPTED.
A termination request only applies to the query during which it was issued:
after terminate() returned true, it is not called again during
that query, and the solver can be used for further queries afterwards.
Function terminate() is called at the beginning of each query, i.e.,
if it keeps returning true, subsequent queries are terminated immediately.
If terminate() throws an exception, the query is terminated and the
exception is rethrown by the method that executed the query.
Function terminate() is called frequently from the thread that
executes the query, and must thus be cheap to evaluate. To terminate a query
from another thread, terminate() can, e.g., check a flag of type
java.util.concurrent.atomic.AtomicBoolean that is set by that
thread.
- Note:
- This interface is experimental and may change in future versions.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine whether the current query of the solver this terminator is connected to should be terminated.
-
Method Details
-
terminate
boolean terminate()Determine whether the current query of the solver this terminator is connected to should be terminated.- Returns:
- True to terminate the current query.
-