Search in sources :

Example 1 with DotNode

use of de.prob.animator.domainobjects.DotNode in project prob2 by bendisposto.

the class AbstractDotDiagramCmd method extractStates.

protected void extractStates(final ListPrologTerm s) {
    for (PrologTerm prologTerm : s) {
        if (prologTerm instanceof CompoundPrologTerm) {
            CompoundPrologTerm cpt = (CompoundPrologTerm) prologTerm;
            String id = Transition.getIdFromPrologTerm(cpt.getArgument(1));
            List<String> labels = new ArrayList<>();
            ListPrologTerm ls = BindingGenerator.getList(cpt.getArgument(4));
            for (PrologTerm pt : ls) {
                labels.add(pt.getFunctor());
            }
            int count = BindingGenerator.getInteger(cpt.getArgument(2)).getValue().intValue();
            String color = cpt.getArgument(3).getFunctor();
            DotNode n = new DotNode(id, labels, count, color);
            nodes.put(id, n);
        }
    }
}
Also used : ListPrologTerm(de.prob.prolog.term.ListPrologTerm) DotNode(de.prob.animator.domainobjects.DotNode) ArrayList(java.util.ArrayList) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) PrologTerm(de.prob.prolog.term.PrologTerm) ListPrologTerm(de.prob.prolog.term.ListPrologTerm)

Aggregations

DotNode (de.prob.animator.domainobjects.DotNode)1 CompoundPrologTerm (de.prob.prolog.term.CompoundPrologTerm)1 ListPrologTerm (de.prob.prolog.term.ListPrologTerm)1 PrologTerm (de.prob.prolog.term.PrologTerm)1 ArrayList (java.util.ArrayList)1