Skip to content
Snippets Groups Projects
Commit 5f62d80c authored by Sebastian Krings's avatar Sebastian Krings
Browse files

get assertion checking counter example transition from prolog and update animator

parent 31486be4
No related branches found
No related tags found
No related merge requests found
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
*/ */
package de.prob.core.command; package de.prob.core.command;
import de.prob.core.domainobjects.Operation;
import de.prob.parser.ISimplifiedROMap; import de.prob.parser.ISimplifiedROMap;
import de.prob.prolog.output.IPrologTermOutput; import de.prob.prolog.output.IPrologTermOutput;
import de.prob.prolog.term.ListPrologTerm; import de.prob.prolog.term.CompoundPrologTerm;
import de.prob.prolog.term.PrologTerm; import de.prob.prolog.term.PrologTerm;
/** /**
...@@ -34,8 +35,12 @@ public class ConstraintBasedAssertionCheckCommand implements IComposableCommand ...@@ -34,8 +35,12 @@ public class ConstraintBasedAssertionCheckCommand implements IComposableCommand
return result; return result;
} }
public ListPrologTerm getCounterExampleState() { public Operation getCounterExampleOperation() {
return counterExampleState; return counterExampleOperation;
}
public String getCounterExampleStateID() {
return counterExampleStateID;
} }
@Override @Override
...@@ -55,9 +60,13 @@ public class ConstraintBasedAssertionCheckCommand implements IComposableCommand ...@@ -55,9 +60,13 @@ public class ConstraintBasedAssertionCheckCommand implements IComposableCommand
result = ResultType.INTERRUPTED; result = ResultType.INTERRUPTED;
} else if (resultTerm.hasFunctor("no_counterexample_found", 0)) { } else if (resultTerm.hasFunctor("no_counterexample_found", 0)) {
result = ResultType.NO_COUNTER_EXAMPLE; result = ResultType.NO_COUNTER_EXAMPLE;
} else if (resultTerm.hasFunctor("counterexample_found", 1)) { } else if (resultTerm.hasFunctor("counterexample_found", 2)) {
counterExampleState = (ListPrologTerm) resultTerm.getArgument(1);
result = ResultType.COUNTER_EXAMPLE; result = ResultType.COUNTER_EXAMPLE;
CompoundPrologTerm counterExampleTerm = (CompoundPrologTerm) resultTerm;
counterExampleOperation = Operation
.fromPrologTerm(counterExampleTerm.getArgument(1));
counterExampleStateID = counterExampleTerm.getArgument(2)
.toString();
} else } else
throw new CommandException( throw new CommandException(
"unexpected result from deadlock check: " + resultTerm); "unexpected result from deadlock check: " + resultTerm);
......
...@@ -11,9 +11,11 @@ import de.prob.core.Animator; ...@@ -11,9 +11,11 @@ import de.prob.core.Animator;
import de.prob.core.ProBJobFinishedListener; import de.prob.core.ProBJobFinishedListener;
import de.prob.core.command.ConstraintBasedAssertionCheckCommand; import de.prob.core.command.ConstraintBasedAssertionCheckCommand;
import de.prob.core.command.ConstraintBasedAssertionCheckCommand.ResultType; import de.prob.core.command.ConstraintBasedAssertionCheckCommand.ResultType;
import de.prob.core.command.ExecuteOperationCommand;
import de.prob.core.command.IComposableCommand; import de.prob.core.command.IComposableCommand;
import de.prob.core.domainobjects.Operation;
import de.prob.exceptions.ProBException;
import de.prob.logging.Logger; import de.prob.logging.Logger;
import de.prob.prolog.term.ListPrologTerm;
/** /**
* This JobChangeAdapter presents the user the results of a deadlock freedom * This JobChangeAdapter presents the user the results of a deadlock freedom
...@@ -84,13 +86,14 @@ public class AssertionCheckFinishedListener extends ProBJobFinishedListener { ...@@ -84,13 +86,14 @@ public class AssertionCheckFinishedListener extends ProBJobFinishedListener {
private void displayCounterExample( private void displayCounterExample(
final ConstraintBasedAssertionCheckCommand command, final ConstraintBasedAssertionCheckCommand command,
final Animator animator) { final Animator animator) {
final ListPrologTerm errorState = command.getCounterExampleState(); final Operation operation = command.getCounterExampleOperation();
// try { try {
// animator.getHistory().reset(); // we do not reset the history because we want to keep the root
// state, we just start a new path from root
// ExecuteOperationCommand.executeOperation(animator, operation); animator.getHistory().gotoPos(0);
// } catch (ProBException e) { ExecuteOperationCommand.executeOperation(animator, operation);
// e.notifyUserOnce(); } catch (ProBException e) {
// } e.notifyUserOnce();
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment