Beispiel #1
0
 protected Term findStaticallyEqual(Collection<Term> theTerms) {
   for (Term term : theTerms) {
     if (term != this && term.staticallyEquals(this)) {
       return term;
     }
   }
   return null;
 }
Beispiel #2
0
 @Test
 public void test_flatTerms() {
   Term term;
   //
   term = new Struct("p", "X", 2);
   logger.info("Flat terms: {}", TERM_API.flatTerms(term));
   //
   term = new Struct("a", new Struct("b"), "c");
   logger.info("Flat terms: {}", TERM_API.flatTerms(term));
   //
   term =
       new Struct(
           Struct.FUNCTOR_CLAUSE,
           new Struct("a", new Struct("p", "X", "Y")),
           new Struct("p", "X", "Y"));
   logger.info("Flat terms: {}", TERM_API.flatTerms(term));
   //
   Term clause =
       new Struct(
           Struct.FUNCTOR_CLAUSE,
           new Struct("a", new Struct("p", "X", "Y")),
           new Struct("p", "X", "Y"));
   logger.info("Flat terms of original {}", TERM_API.flatTerms(clause));
   Term t2 = TERM_API.normalize(clause, null);
   logger.info("Found {} bindings", t2.getIndex());
   assertEquals(2, t2.getIndex());
   logger.info("Flat terms of copy     {}", TERM_API.flatTerms(t2));
   assertEquals(clause.toString(), t2.toString());
 }