use of de.prob.prolog.term.ListPrologTerm in project prob2 by bendisposto.
the class GetOpFromId method processResult.
@Override
public void processResult(final ISimplifiedROMap<String, PrologTerm> bindings) {
ListPrologTerm plist = BindingGenerator.getList(bindings.get(PARAMETERS_VARIABLE));
params = Collections.emptyList();
if (!plist.isEmpty()) {
params = new ArrayList<>();
}
for (PrologTerm p : plist) {
params.add(p.getFunctor().intern());
}
ListPrologTerm rlist = BindingGenerator.getList(bindings.get(RETURNVALUES_VARIABLE));
returnValues = Collections.emptyList();
if (!rlist.isEmpty()) {
returnValues = new ArrayList<>();
}
for (PrologTerm r : rlist) {
returnValues.add(r.getFunctor().intern());
}
op.setInfo(expansion, params, returnValues);
}
use of de.prob.prolog.term.ListPrologTerm in project probparsers by bendisposto.
the class PrologGeneratorTest method testDET.
@Test
public void testDET() throws Exception {
final PrologTerm transPred1 = new CompoundPrologTerm("bla");
final PrologTerm wrapped1 = new CompoundPrologTerm("dtrans", transPred1);
final PrologTerm transPred2 = new CompoundPrologTerm("argg");
final PrologTerm wrapped2 = new CompoundPrologTerm("dtrans", transPred2);
final PrologTerm args = new ListPrologTerm(wrapped1, wrapped2);
final PrologTerm det = new CompoundPrologTerm("det", args);
final PrologTerm expected = new CompoundPrologTerm("ap", det);
check("deterministic(bla , argg)", expected);
}
use of de.prob.prolog.term.ListPrologTerm in project probparsers by bendisposto.
the class PrologGeneratorTest method testDLK.
@Test
public void testDLK() throws Exception {
final PrologTerm transPred = new CompoundPrologTerm("bla");
final PrologTerm wrapped = new CompoundPrologTerm("dtrans", transPred);
final PrologTerm args = new ListPrologTerm(wrapped);
final PrologTerm dlk = new CompoundPrologTerm("dlk", args);
final PrologTerm expected = new CompoundPrologTerm("ap", dlk);
check("deadlock( bla)", expected);
}
use of de.prob.prolog.term.ListPrologTerm in project probparsers by bendisposto.
the class StructuredPrologOutput method closeList.
public IPrologTermOutput closeList() {
PrologTerm[] elements = getArguments();
popFromStack();
addArgument(new ListPrologTerm(elements));
return this;
}
use of de.prob.prolog.term.ListPrologTerm in project probparsers by bendisposto.
the class FastReadTransformer method write.
private void write(ListPrologTerm lp) {
if (lp.isEmpty())
sb.append(']');
else {
sb.append('[');
fastwrite(lp.head());
ListPrologTerm tail = lp.tail();
write(tail);
}
}
Aggregations