Commit 704840d3 authored by Sarah Grebing's avatar Sarah Grebing

minor bugfix for wrapper

parent 9dca4cfc
Pipeline #14975 failed with stage
in 2 minutes and 4 seconds
...@@ -79,7 +79,7 @@ public class ControlFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -79,7 +79,7 @@ public class ControlFlowVisitor extends DefaultASTVisitor<Void> {
if (assocNode != null) { if (assocNode != null) {
graph.edges().forEach(edge -> { graph.edges().forEach(edge -> {
if (edge.target().equals(assocNode)) { if (edge.target().equals(assocNode)) {
allPreds.add(new Pair(edge.source(), edge)); allPreds.add(new Pair(edge.source(), graph.edgeValue(edge.source(), edge.target())));
} }
...@@ -111,7 +111,7 @@ public class ControlFlowVisitor extends DefaultASTVisitor<Void> { ...@@ -111,7 +111,7 @@ public class ControlFlowVisitor extends DefaultASTVisitor<Void> {
graph.edges().forEach(edge -> { graph.edges().forEach(edge -> {
if (edge.source().equals(assocNode)) { if (edge.source().equals(assocNode)) {
allPreds.add(new Pair(edge.target(), edge)); allPreds.add(new Pair(edge.target(), graph.edgeValue(edge.source(), edge.target())));
} }
......
...@@ -345,14 +345,14 @@ public class StateGraphWrapper<T> { ...@@ -345,14 +345,14 @@ public class StateGraphWrapper<T> {
private void fireNodeAdded(NodeAddedEvent nodeAddedEvent) { private void fireNodeAdded(NodeAddedEvent nodeAddedEvent) {
changeListeners.forEach(list -> Platform.runLater(() -> { changeListeners.forEach(list -> Platform.runLater(() -> {
list.graphChanged(nodeAddedEvent); list.graphChanged(nodeAddedEvent);
LOGGER.info("New StateGraphChange \n" + this.asdot() + "\n"); // LOGGER.info("New StateGraphChange \n" + this.asdot() + "\n");
})); }));
} }
private void fireStateAdded(StateAddedEvent stateAddedEvent) { private void fireStateAdded(StateAddedEvent stateAddedEvent) {
changeListeners.forEach(list -> Platform.runLater(() -> { changeListeners.forEach(list -> Platform.runLater(() -> {
list.graphChanged(stateAddedEvent); list.graphChanged(stateAddedEvent);
LOGGER.debug("New StateGraphChange " + this.asdot()); //LOGGER.debug("New StateGraphChange " + this.asdot());
})); }));
} }
......
...@@ -122,24 +122,28 @@ public class ProofTreeController { ...@@ -122,24 +122,28 @@ public class ProofTreeController {
private GraphChangedListener graphChangedListener = new GraphChangedListener() { private GraphChangedListener graphChangedListener = new GraphChangedListener() {
@Override @Override
public void graphChanged(NodeAddedEvent nodeAddedEvent) { public void graphChanged(NodeAddedEvent nodeAddedEvent) {
PTreeNode added = nodeAddedEvent.getAddedNode(); if (nodeAddedEvent != null) {
if (added.getExtendedState() != null) { PTreeNode added = nodeAddedEvent.getAddedNode();
LOGGER.info("Graph changed with the following PTreeNode: {} and the statepointer points to {}", nodeAddedEvent.getAddedNode(), statePointer); if (added.getExtendedState() != null) {
nextComputedNode.setValue(nodeAddedEvent.getAddedNode()); LOGGER.info("Graph changed with the following PTreeNode: {} and the statepointer points to {}", nodeAddedEvent.getAddedNode(), statePointer);
// Events.fire(new Events.NewNodeExecuted(nodeAddedEvent.getAddedNode().getScriptstmt())); nextComputedNode.setValue(nodeAddedEvent.getAddedNode());
// Events.fire(new Events.NewNodeExecuted(nodeAddedEvent.getAddedNode().getScriptstmt()));
}
} }
} }
@Override @Override
public void graphChanged(StateAddedEvent stateAddedEvent) { public void graphChanged(StateAddedEvent stateAddedEvent) {
PTreeNode changedNode = stateAddedEvent.getChangedNode(); if (stateAddedEvent != null) {
LOGGER.info("Graph changed by adding a state to PTreeNode: {} and the statepointer points to {}", stateAddedEvent, statePointer); PTreeNode changedNode = stateAddedEvent.getChangedNode();
nextComputedNode.set(changedNode); LOGGER.info("Graph changed by adding a state to PTreeNode: {} and the statepointer points to {}", stateAddedEvent, statePointer);
//Events.fire(new Events.NewNodeExecuted(changedNode.getScriptstmt())); nextComputedNode.set(changedNode);
//Events.fire(new Events.NewNodeExecuted(changedNode.getScriptstmt()));
}
} }
}; };
public ProofScript getMainScript() { public ProofScript getMainScript() {
...@@ -176,7 +180,7 @@ public class ProofTreeController { ...@@ -176,7 +180,7 @@ public class ProofTreeController {
this.statePointer = newValue; this.statePointer = newValue;
//setNewState(blocker.currentStateProperty().get()); //setNewState(blocker.currentStateProperty().get());
setNewState(newValue.getExtendedState().getStateAfterStmt()); setNewState(newValue.getExtendedState().getStateBeforeStmt());
} }
}); });
...@@ -193,9 +197,10 @@ public class ProofTreeController { ...@@ -193,9 +197,10 @@ public class ProofTreeController {
*/ */
private void setNewState(State<KeyData> state) { private void setNewState(State<KeyData> state) {
LOGGER.info("Setting new State " + state.toString());
//Statepointer null wenn anfangszustand? //Statepointer null wenn anfangszustand?
if (statePointer != null && state != null) { if (statePointer != null && state != null) {
LOGGER.info("Setting new State " + state.toString());
//setCurrentHighlightNode(statePointer.getScriptstmt()); //setCurrentHighlightNode(statePointer.getScriptstmt());
//get all goals that are open //get all goals that are open
Object[] arr = state.getGoals().stream().filter(keyDataGoalNode -> !keyDataGoalNode.isClosed()).toArray(); Object[] arr = state.getGoals().stream().filter(keyDataGoalNode -> !keyDataGoalNode.isClosed()).toArray();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment