Beispiel #1
0
 private Object getValue(final PrologTerm v) {
   if (v.getFunctor().equals("p")) {
     CompoundPrologTerm cpt = BindingGenerator.getCompoundTerm(v, 1);
     if (cpt.getArgument(1).getFunctor().equals("true")) {
       return Boolean.TRUE;
     } else {
       return Boolean.FALSE;
     }
   } else if (v.getFunctor().equals("v")) {
     CompoundPrologTerm cpt = BindingGenerator.getCompoundTerm(v, 1);
     return cpt.getArgument(1).getFunctor();
   }
   v.getFunctor();
   return null;
 }
Beispiel #2
0
  public void init(final CompoundPrologTerm cpt) {
    name = cpt.getArgument(1).getFunctor();
    // Value
    PrologTerm v = cpt.getArgument(2);
    value = getValue(v);
    // Children
    fId = cpt.getArgument(3).getFunctor();

    ListPrologTerm list = BindingGenerator.getList(cpt.getArgument(4));
    if (!list.isEmpty()) {
      children = new ArrayList<ExpandedFormula>();
      for (PrologTerm prologTerm : list) {
        children.add(new ExpandedFormula(BindingGenerator.getCompoundTerm(prologTerm, 4)));
      }
    }
  }