Tell Prolog engine to fetch the next solution for the current active query (like hitting ;) If there are no more solutions, then just close the query @return whether a new solutions was found or there are no more solutions @throws PrologException with the term of the error from Prolog (e.g., syntax
()
| 426 | * @throws PrologException with the term of the error from Prolog (e.g., syntax error in query or non existence of predicates) |
| 427 | */ |
| 428 | private boolean fetchNextSolution() { // try to get the next solution; if none, |
| 429 | // close the query; |
| 430 | if (Prolog.next_solution(qid)) { |
| 431 | return true; |
| 432 | } else { // if failure was due to throw/1, build exception term and |
| 433 | // throw it |
| 434 | term_t exception_term_t = Prolog.exception(qid); |
| 435 | if (exception_term_t.value != 0L) { |
| 436 | Term exception_term = Term.getTerm(new HashMap<term_t, Variable>(), exception_term_t); |
| 437 | close(); |
| 438 | throw new PrologException(exception_term); |
| 439 | } else { // no more solution, close the query |
| 440 | close(); |
| 441 | return false; |
| 442 | } |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | /** |
| 447 | * Returns the next solution of the query |
no test coverage detected