MCPcopy Create free account
hub / github.com/SWI-Prolog/packages-jpl / nextSolution

Method nextSolution

src/main/java/org/jpl7/Query.java:499–505  ·  view source on GitHub ↗

This method returns a java.util.Map, which represents a binding from the names of query variables to terms within the next solution. For example, if a Query has an occurrence of a jpl.Variable, say, named "X", one can obtain the Term bound to "X" in the solution by looking up "X" in the Map. <p

()

Source from the content-addressed store, hash-verified

497 * @throws NoSuchElementException if there are no more new solutions.
498 */
499 public final Map<String, Term> nextSolution() {
500 if (hasMoreSolutions()) {
501 hasNextSolution = null; // we reset this as we moved the pointer (we now do not know if there is a new one)
502 return getCurrentSolutionBindings();
503 } else
504 throw new NoSuchElementException("Query has already yielded all solutions");
505 }
506
507 private Map<String, Term> getCurrentSolutionBindings() {
508 if (!open) {

Callers 15

testGetSolution1Method · 0.95
testGetSolution1bMethod · 0.95
testGetSolution2Method · 0.95
testOpenGetClose2Method · 0.95
testOpenGetClose1Method · 0.95
testStackedQueries1Method · 0.95
ReportPrologFlagsMethod · 0.95
rational_simpleMethod · 0.95
rational_reducedMethod · 0.95
rational_is_simpleMethod · 0.95
rational_is_simple2Method · 0.95
rational_is_bigMethod · 0.95

Calls 2

hasMoreSolutionsMethod · 0.95

Tested by 15

testGetSolution1Method · 0.76
testGetSolution1bMethod · 0.76
testGetSolution2Method · 0.76
testOpenGetClose2Method · 0.76
testOpenGetClose1Method · 0.76
testStackedQueries1Method · 0.76
ReportPrologFlagsMethod · 0.76
rational_simpleMethod · 0.76
rational_reducedMethod · 0.76
rational_is_simpleMethod · 0.76
rational_is_simple2Method · 0.76
rational_is_bigMethod · 0.76