Search in sources :

Example 1 with ModelCheckErrorUncovered

use of de.prob.check.ModelCheckErrorUncovered in project prob2 by bendisposto.

the class ModelCheckingStepCommand method extractResult.

private IModelCheckingResult extractResult(final PrologTerm prologTerm) {
    CompoundPrologTerm cpt = BindingGenerator.getCompoundTerm(prologTerm, prologTerm.getArity());
    String type = cpt.getFunctor();
    switch(type) {
        case "not_yet_finished":
            int maxNodesLeft = BindingGenerator.getInteger(cpt.getArgument(1)).getValue().intValue();
            return new NotYetFinished("Model checking not completed", maxNodesLeft);
        case "ok":
            return new ModelCheckOk("Model Checking complete. No error nodes found.");
        case "full_coverage":
            return new ModelCheckOk("Model Checking complete. All operations were covered.");
        case "ok_not_all_nodes_considered":
            return new ModelCheckOk("Model Checking complete. No error nodes found. Not all nodes were considered.");
        case "deadlock":
            return new ModelCheckErrorUncovered("Deadlock found.", cpt.getArgument(1).getFunctor());
        case "invariant_violation":
            return new ModelCheckErrorUncovered("Invariant violation found.", cpt.getArgument(1).getFunctor());
        case "assertion_violation":
            return new ModelCheckErrorUncovered("Assertion violation found.", cpt.getArgument(1).getFunctor());
        case "state_error":
            return new ModelCheckErrorUncovered("A state error occured.", cpt.getArgument(1).getFunctor());
        case "goal_found":
            return new ModelCheckErrorUncovered("Goal found", cpt.getArgument(1).getFunctor());
        case "well_definedness_error":
            return new ModelCheckErrorUncovered("A well definedness error occured.", cpt.getArgument(1).getFunctor());
        case "general_error":
            if (cpt.getArity() == 2) {
                return new ModelCheckErrorUncovered("An unknown result was uncovered: " + cpt.getArgument(2), cpt.getArgument(1).getFunctor());
            } else {
                return new ModelCheckErrorUncovered("A general error occured in state: ", cpt.getArgument(1).getFunctor());
            }
        default:
            logger.error("Model checking result unknown. This should not happen " + "unless someone changed the prolog kernel. Result was: {} ", cpt);
            throw new IllegalArgumentException("model checking result unknown: " + cpt);
    }
}
Also used : NotYetFinished(de.prob.check.NotYetFinished) ModelCheckOk(de.prob.check.ModelCheckOk) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) ModelCheckErrorUncovered(de.prob.check.ModelCheckErrorUncovered)

Aggregations

ModelCheckErrorUncovered (de.prob.check.ModelCheckErrorUncovered)1 ModelCheckOk (de.prob.check.ModelCheckOk)1 NotYetFinished (de.prob.check.NotYetFinished)1 CompoundPrologTerm (de.prob.prolog.term.CompoundPrologTerm)1