Search in sources :

Example 21 with ListPrologTerm

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);
}
Also used : ListPrologTerm(de.prob.prolog.term.ListPrologTerm) PrologTerm(de.prob.prolog.term.PrologTerm) ListPrologTerm(de.prob.prolog.term.ListPrologTerm)

Example 22 with ListPrologTerm

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);
}
Also used : ListPrologTerm(de.prob.prolog.term.ListPrologTerm) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) ListPrologTerm(de.prob.prolog.term.ListPrologTerm) PrologTerm(de.prob.prolog.term.PrologTerm) Test(org.junit.Test)

Example 23 with ListPrologTerm

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);
}
Also used : ListPrologTerm(de.prob.prolog.term.ListPrologTerm) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) ListPrologTerm(de.prob.prolog.term.ListPrologTerm) PrologTerm(de.prob.prolog.term.PrologTerm) Test(org.junit.Test)

Example 24 with ListPrologTerm

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;
}
Also used : ListPrologTerm(de.prob.prolog.term.ListPrologTerm) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) PrologTerm(de.prob.prolog.term.PrologTerm) ListPrologTerm(de.prob.prolog.term.ListPrologTerm) VariablePrologTerm(de.prob.prolog.term.VariablePrologTerm) IntegerPrologTerm(de.prob.prolog.term.IntegerPrologTerm)

Example 25 with ListPrologTerm

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);
    }
}
Also used : ListPrologTerm(de.prob.prolog.term.ListPrologTerm)

Aggregations

ListPrologTerm (de.prob.prolog.term.ListPrologTerm)38 PrologTerm (de.prob.prolog.term.PrologTerm)33 CompoundPrologTerm (de.prob.prolog.term.CompoundPrologTerm)27 Test (org.junit.Test)11 IntegerPrologTerm (de.prob.prolog.term.IntegerPrologTerm)6 VariablePrologTerm (de.prob.prolog.term.VariablePrologTerm)4 ArrayList (java.util.ArrayList)4 Transition (de.prob.statespace.Transition)3 AbstractEvalResult (de.prob.animator.domainobjects.AbstractEvalResult)2 ComputationNotCompletedResult (de.prob.animator.domainobjects.ComputationNotCompletedResult)2 EvalResult (de.prob.animator.domainobjects.EvalResult)2 IEvalElement (de.prob.animator.domainobjects.IEvalElement)2 StateError (de.prob.animator.domainobjects.StateError)2 HashMap (java.util.HashMap)2 List (java.util.List)2 DotEdge (de.prob.animator.domainobjects.DotEdge)1 DotNode (de.prob.animator.domainobjects.DotNode)1 ProBPreference (de.prob.animator.domainobjects.ProBPreference)1 ASTCategory (de.prob.animator.prologast.ASTCategory)1 ASTFormula (de.prob.animator.prologast.ASTFormula)1