use of org.jpl7.Atom in project packages-jpl by SWI-Prolog.
the class Zahed method main.
public static void main(java.lang.String[] argv) {
System.out.println("starting...");
Compound goal1 = new Compound("consult", new Term[] { new Atom("zahed.pl") });
Query q1 = new Query(goal1);
if (!q1.hasSolution()) {
System.out.println("consult('zahed.pl') failed");
return;
}
Term t2 = new Compound("t", new Term[] { new Atom("v"), new Atom("[]"), new Atom("a") });
Compound list2 = new Compound(".", new Term[] { t2, new Atom("[]") });
Compound t1 = new Compound("t", new Term[] { new Atom("c"), new Atom("q"), new Atom("[]") });
Compound list1 = new Compound(".", new Term[] { t1, list2 });
Variable answer = new Variable("A");
Compound goal2 = new Compound("gen", new Term[] { list1, answer });
Query q2 = new Query(goal2);
Map<String, Term> solution = q2.oneSolution();
if (solution == null) {
System.out.println("failed");
} else {
System.out.println(solution.get("A").toString());
}
System.out.println("finished");
}
use of org.jpl7.Atom in project packages-jpl by SWI-Prolog.
the class Family method main.
public static void main(String[] argv) {
Query q1 = new Query("consult", new Term[] { new Atom("jpl/test/family.pl") });
System.err.println("consult " + (q1.hasSolution() ? "succeeded" : "failed"));
for (int i = 0; i < 20; i++) {
System.out.println("spawning client[" + i + "]");
new Family(i).start();
}
}
use of org.jpl7.Atom in project packages-jpl by SWI-Prolog.
the class TestJUnit method testAtomEquality1.
public void testAtomEquality1() {
String name = "fred";
Atom a1 = new Atom(name);
Atom a2 = new Atom(name);
assertEquals("two Atoms created with the same name are equal", a1, a2);
}
use of org.jpl7.Atom in project packages-jpl by SWI-Prolog.
the class TestJUnit method testAtomToString2.
public void testAtomToString2() {
String name = "ha ha";
String toString = "'ha ha'";
Atom a = new Atom(name);
assertEquals("an Atom's .toString() value is quoted iff appropriate", a.toString(), toString);
}
use of org.jpl7.Atom in project packages-jpl by SWI-Prolog.
the class TestJUnit method testAtomArity.
public void testAtomArity() {
Atom a = new Atom("willy");
assertEquals("an Atom has arity zero", a.arity(), 0);
}
Aggregations