Package jpl

Examples of jpl.Query.nextSolution()


    String error = "Unsolvable: \n";   
    Query rem = new Query("countSteps(N, Remaining), member([C, [RefName, Attrib, RefNameType]], Remaining)");
    String nSteps = "0";
    while (rem.hasMoreSolutions()) {
      @SuppressWarnings("unchecked")
      Hashtable<Variable, Term> binding = (Hashtable<Variable, Term>) rem.nextSolution();
      nSteps = binding.get("N").toString(); //FIXME do just once
      error += "  Cannot solve for class '" + binding.get("C") + "': " + binding.get("RefName") + "." + binding.get("Attrib") + "\n";
    }
    error += "Exhausted search after " + nSteps + " inorder traversals.";
    return error;   
View Full Code Here


            new Compound("succ", new Term[] { One, N})}));
           
    int sum = 0;
    while (q.hasMoreSolutions()) {
      @SuppressWarnings("unchecked")
      Hashtable<Variable, Term> binding = (Hashtable<Variable, Term>) q.nextSolution();
      sum += ((jpl.Integer) binding.get("N")).intValue();
    }   
    return sum == (14 + 2);
  }
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.