Search in sources :

Example 6 with IntegerPrologTerm

use of de.prob.prolog.term.IntegerPrologTerm in project prob2 by bendisposto.

the class ExecuteModelCommand method processResult.

@Override
public void processResult(final ISimplifiedROMap<String, PrologTerm> bindings) {
    PrologTerm prologTerm = bindings.get(TRANSITION_VARIABLE);
    CompoundPrologTerm cpt = BindingGenerator.getCompoundTerm(prologTerm, 4);
    Transition operation = Transition.createTransitionFromCompoundPrologTerm(statespace, cpt);
    resultTrace.add(operation);
    IntegerPrologTerm intPrologTerm = BindingGenerator.getInteger(bindings.get(EXECUTED_STEPS_VARIABLE));
    BigInteger bigInt = intPrologTerm.getValue();
    stepsExecuted = bigInt.intValue();
    switch(bindings.get(RESULT_VARIABLE).getFunctor()) {
        case "maximum_nr_of_steps_reached":
            this.result = ExecuteModelResult.MAXIMUM_NR_OF_STEPS_REACHED;
            break;
        case "deadlock":
            this.result = ExecuteModelResult.DEADLOCK;
            break;
        case "error":
            this.result = ExecuteModelResult.ERROR;
            break;
        case "internal_error":
            this.result = ExecuteModelResult.INTERNAL_ERROR;
            break;
        case "time_out":
            this.result = ExecuteModelResult.TIME_OUT;
            break;
        default:
            throw new AssertionError("Unexpected result of execute command.");
    }
}
Also used : Transition(de.prob.statespace.Transition) BigInteger(java.math.BigInteger) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) IntegerPrologTerm(de.prob.prolog.term.IntegerPrologTerm) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) PrologTerm(de.prob.prolog.term.PrologTerm) IntegerPrologTerm(de.prob.prolog.term.IntegerPrologTerm)

Example 7 with IntegerPrologTerm

use of de.prob.prolog.term.IntegerPrologTerm in project prob2 by bendisposto.

the class EvalstoreCreateByStateCommand method processResult.

@Override
public void processResult(final ISimplifiedROMap<String, PrologTerm> bindings) {
    // TODO[DP, 22.01.2013]: Handle errors?
    final IntegerPrologTerm result = (IntegerPrologTerm) bindings.get(STORE_ID_VAR);
    evalstoreId = result.getValue().longValue();
}
Also used : IntegerPrologTerm(de.prob.prolog.term.IntegerPrologTerm)

Example 8 with IntegerPrologTerm

use of de.prob.prolog.term.IntegerPrologTerm in project prob2 by bendisposto.

the class GetTotalNumberOfErrorsCommand method processResult.

@Override
public void processResult(final ISimplifiedROMap<String, PrologTerm> bindings) {
    IntegerPrologTerm prologTerm = (IntegerPrologTerm) bindings.get(ERRORS_VARIABLE);
    value = prologTerm.getValue();
}
Also used : IntegerPrologTerm(de.prob.prolog.term.IntegerPrologTerm)

Aggregations

IntegerPrologTerm (de.prob.prolog.term.IntegerPrologTerm)8 CompoundPrologTerm (de.prob.prolog.term.CompoundPrologTerm)5 ListPrologTerm (de.prob.prolog.term.ListPrologTerm)4 PrologTerm (de.prob.prolog.term.PrologTerm)4 ISimplifiedROMap (de.prob.parser.ISimplifiedROMap)2 IPrologTermOutput (de.prob.prolog.output.IPrologTermOutput)2 VariablePrologTerm (de.prob.prolog.term.VariablePrologTerm)2 Transition (de.prob.statespace.Transition)2 BigInteger (java.math.BigInteger)2 Collections (java.util.Collections)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 AbstractEvalResult (de.prob.animator.domainobjects.AbstractEvalResult)1 ComputationNotCompletedResult (de.prob.animator.domainobjects.ComputationNotCompletedResult)1 EvalResult (de.prob.animator.domainobjects.EvalResult)1 IEvalElement (de.prob.animator.domainobjects.IEvalElement)1 LTL (de.prob.animator.domainobjects.LTL)1 IModelCheckingResult (de.prob.check.IModelCheckingResult)1 LTLCounterExample (de.prob.check.LTLCounterExample)1 LTLError (de.prob.check.LTLError)1