use of de.prob.prolog.term.CompoundPrologTerm in project probparsers by bendisposto.
the class FastReadTransformer method fastwrite.
private void fastwrite(PrologTerm term) {
if (term instanceof IntegerPrologTerm) {
IntegerPrologTerm intTerm = (IntegerPrologTerm) term;
write(intTerm);
}
if (term instanceof CompoundPrologTerm) {
write(term);
}
if (term instanceof VariablePrologTerm) {
write((VariablePrologTerm) term);
}
if (term instanceof ListPrologTerm) {
ListPrologTerm list = (ListPrologTerm) term;
write(list);
}
}
use of de.prob.prolog.term.CompoundPrologTerm in project prob2 by bendisposto.
the class ConstraintBasedInvariantCheckCommand method extractExamples.
private List<InvariantCheckCounterExample> extractExamples(final ListPrologTerm ceTerm) {
List<InvariantCheckCounterExample> examples = new ArrayList<>();
for (final PrologTerm t : ceTerm) {
final CompoundPrologTerm term = (CompoundPrologTerm) t;
final String eventName = PrologTerm.atomicString(term.getArgument(1));
final Transition step1 = Transition.createTransitionFromCompoundPrologTerm(s, BindingGenerator.getCompoundTerm(term.getArgument(2), 4));
final Transition step2 = Transition.createTransitionFromCompoundPrologTerm(s, BindingGenerator.getCompoundTerm(term.getArgument(3), 4));
final InvariantCheckCounterExample ce = new InvariantCheckCounterExample(eventName, step1, step2);
newTransitions.add(step1);
newTransitions.add(step2);
examples.add(ce);
}
return examples;
}
use of de.prob.prolog.term.CompoundPrologTerm in project prob2 by bendisposto.
the class ConstructTraceCommand method processResult.
@Override
public void processResult(final ISimplifiedROMap<String, PrologTerm> bindings) {
ListPrologTerm trace = BindingGenerator.getList(bindings.get(RESULT_VARIABLE));
for (PrologTerm term : trace) {
CompoundPrologTerm t = BindingGenerator.getCompoundTerm(term, 4);
Transition operation = Transition.createTransitionFromCompoundPrologTerm(stateSpace, t);
resultTrace.add(operation);
}
ListPrologTerm reportedErrors = BindingGenerator.getList(bindings.get(ERRORS_VARIABLE));
for (PrologTerm prologTerm : reportedErrors) {
this.errors.add(prologTerm.getFunctor());
}
}
use of de.prob.prolog.term.CompoundPrologTerm 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);
}
}
}
use of de.prob.prolog.term.CompoundPrologTerm in project prob2 by bendisposto.
the class AbstractDotDiagramCmd method extractTransitions.
protected void extractTransitions(final ListPrologTerm trans) {
for (PrologTerm pt : trans) {
if (pt instanceof CompoundPrologTerm) {
CompoundPrologTerm cpt = (CompoundPrologTerm) pt;
String id = Transition.getIdFromPrologTerm(cpt.getArgument(1));
String src = Transition.getIdFromPrologTerm(cpt.getArgument(2));
String dest = Transition.getIdFromPrologTerm(cpt.getArgument(3));
String label = cpt.getArgument(4).toString();
String style = cpt.getArgument(5).getFunctor();
String color = cpt.getArgument(6).getFunctor();
DotEdge e = new DotEdge(id, src, dest, label, style, color);
edges.put(id, e);
}
}
}
Aggregations