Search in sources :

Example 11 with Integer

use of org.jpl7.Integer in project packages-jpl by SWI-Prolog.

the class TestJUnit method testLength1.

public void testLength1() {
    Query q5 = new Query(new Compound("length", new Term[] { new Variable("Zs"), new org.jpl7.Integer(2) }));
    Term zs = q5.oneSolution().get("Zs");
    assertTrue("length(Zs,2) binds Zs to a list of two distinct variables " + zs.toString(), zs.isListPair() && zs.arg(1).isVariable() && zs.arg(2).isListPair() && zs.arg(2).arg(1).isVariable() && zs.arg(2).arg(2).isListNil() && !zs.arg(1).name().equals(zs.arg(2).arg(1).name()));
}
Also used : Integer(org.jpl7.Integer) BigInteger(java.math.BigInteger) Variable(org.jpl7.Variable) Query(org.jpl7.Query) Compound(org.jpl7.Compound) Term(org.jpl7.Term)

Example 12 with Integer

use of org.jpl7.Integer in project packages-jpl by SWI-Prolog.

the class TestJUnit method testIntegerFromChar1.

public void testIntegerFromChar1() {
    // 0..65535
    char c = (char) 64;
    // System.out.println("c = " + c);
    Integer i = new Integer(c);
    assertTrue(i.intValue() == c);
}
Also used : Integer(org.jpl7.Integer) BigInteger(java.math.BigInteger)

Example 13 with Integer

use of org.jpl7.Integer in project packages-jpl by SWI-Prolog.

the class TestOLD method main.

public static void main(String[] argv) {
    Prolog.set_default_init_args(new String[] { "libpl.dll", "-f", "none", "-g", "set_prolog_flag(debug_on_error,false)", "-q" });
    System.err.println("tag = " + Prolog.object_to_tag(new Query("hello")));
    test10k();
    test10();
    // test10h();
    // test10i();
    test10j();
    test10k();
    test10l();
    test10m();
    // test10n();
    test10o();
    // test10p();
    test10q();
    // test10r();
    // test10s();
    // test10t();
    // test10u();
    // test10v();
    String s = new String("" + '\0' + '\377');
    System.err.println("s.length = " + s.length());
    for (int i = 0; i < s.length(); i++) {
        System.err.print((new Integer(s.charAt(i))).toString() + " ");
    }
    System.err.println();
    System.err.println(new Query("atom_codes(A,[127,128,255,0])").oneSolution().toString());
}
Also used : Integer(org.jpl7.Integer) Query(org.jpl7.Query)

Aggregations

Integer (org.jpl7.Integer)9 Term (org.jpl7.Term)9 BigInteger (java.math.BigInteger)8 Query (org.jpl7.Query)8 Variable (org.jpl7.Variable)5 Compound (org.jpl7.Compound)4 Map (java.util.Map)3 Atom (org.jpl7.Atom)1 DoubleHolder (org.jpl7.fli.DoubleHolder)1 Int64Holder (org.jpl7.fli.Int64Holder)1 IntHolder (org.jpl7.fli.IntHolder)1 ObjectHolder (org.jpl7.fli.ObjectHolder)1 StringHolder (org.jpl7.fli.StringHolder)1 org.jpl7.fli.term_t (org.jpl7.fli.term_t)1