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

Method subsToString

src/main/java/org/jpl7/Util.java:62–74  ·  view source on GitHub ↗

Converts a substitution, in the form of a Map from variable names to Terms, to a String. @param varnames_to_Terms A Map from variable names to Terms. @return String A String representation of the variable bindings

(Map<String, Term> varnames_to_Terms)

Source from the content-addressed store, hash-verified

60 * @return String A String representation of the variable bindings
61 */
62 public static String subsToString(Map<String, Term> varnames_to_Terms) {
63 if (varnames_to_Terms == null) {
64 return "[no solution]";
65 } else {
66 Iterator<String> varnames = varnames_to_Terms.keySet().iterator();
67 String s = "Bindings: ";
68 while (varnames.hasNext()) {
69 String varname = varnames.next();
70 s += varname + "=" + varnames_to_Terms.get(varname).toString() + "; ";
71 }
72 return s;
73 }
74 }
75
76 /**
77 * Converts a substitution, in the form of a Map from variable names to Terms, to a String.

Callers 2

toStringMethod · 0.95
test_7Method · 0.95

Calls 4

iteratorMethod · 0.80
hasNextMethod · 0.80
nextMethod · 0.80
toStringMethod · 0.45

Tested by 1

test_7Method · 0.76