Commit 5be7abf6 authored by Sarah Grebing's avatar Sarah Grebing
Browse files

Merge remote-tracking branch 'origin/grebing_luong_workbranch' into grebing_luong_workbranch

# Conflicts:
#	ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/ScriptTreeGraph.java
parents aa69aa43 ee92cd85
......@@ -292,11 +292,12 @@ public class ScriptTreeGraph {
case 0:
putIntoFront(callnode);
checkIfForeachEnd(callnode);
addPlaceholder(sn, sn.getNode());
break;
case 1:
// putIntoMapping(children.get(0).getData().getNode(), null);
putIntoFront(children.get(0).getData().getNode());
addPlaceholder(sn, children.get(0).getData().getNode(), false);
addPlaceholder(sn, children.get(0).getData().getNode());
break;
default: //multiple open goals/children -> branch labels
int branchcounter = 1;
......@@ -312,7 +313,7 @@ public class ScriptTreeGraph {
Lists.reverse(branchlabel).forEach(k -> System.out.println(k.getNode().serialNr() + " " + k.getLabelName()));
insertBranchLabels(callnode, branchlabel);
addPlaceholder(branchlabel.get(0), gn.getData().getNode(), true);
addPlaceholder(branchlabel.get(0), gn.getData().getNode());
} else {
BranchLabelNode branchNode = new BranchLabelNode(childnode, "Case " + branchcounter);
......@@ -323,7 +324,7 @@ public class ScriptTreeGraph {
if (mapping.get(childnode) != null) putIntoMapping(childnode, branchNode);
addPlaceholder(branchNode, childnode, true);
addPlaceholder(branchNode, childnode);
branchcounter++;
}
......@@ -354,7 +355,7 @@ public class ScriptTreeGraph {
replacePlaceholder(n, match);
putIntoMapping(n, match);
addPlaceholder(match, n, false);
addPlaceholder(match, n);
//front.remove(n);
return null;
}
......@@ -368,7 +369,7 @@ public class ScriptTreeGraph {
Node n = nextintoptn.getStateBeforeStmt().getSelectedGoalNode().getData().getNode();
replacePlaceholder(n, match);
putIntoMapping(n, match);
addPlaceholder(match, n, false);
addPlaceholder(match, n);
//front.remove(n);
return null;
}
......@@ -379,34 +380,31 @@ public class ScriptTreeGraph {
if (goals.size() == 0) return null;
//TODO: sometime goals on different branches
goals.forEach(k -> putIntoMapping(searchParentInMapping(k.getData().getNode()), new ForeachTreeNode(k.getData().getNode(), nextPtreeNode, nextPtreeNode.getStatement().getStartPosition().getLineNumber(),true)));
// add to foreachNodes list
List<GoalNode<KeyData>> goalsAfterForeach = new ArrayList<>();
assert nextPtreeNode.getStateAfterStmt() != null;
goalsAfterForeach.addAll(nextPtreeNode.getStateAfterStmt().getGoals());
/* List<GoalNode<KeyData>> aftergoals =
(nextPtreeNode.getStateAfterStmt() != null)
? nextPtreeNode.getStateAfterStmt().getGoals()
:
(nextPtreeNode.getStepOver() != null && nextPtreeNode.getStepOver().getStateBeforeStmt() != null) ? nextPtreeNode.getStepOver().getStateBeforeStmt().getGoals()
: new ArrayList<>();*/
//aftergoals.forEach(k -> foreachNodes.put(k.getData().getNode(), nextPtreeNode));
if(goalsAfterForeach.size() == 0){
return null;
}
for (GoalNode<KeyData> goalNode : goalsAfterForeach) {
foreachNodes.put(goalNode.getData().getNode(), nextPtreeNode);
}
goals.forEach(k -> {
ForeachTreeNode ftn = new ForeachTreeNode(
k.getData().getNode(),
nextPtreeNode,
nextPtreeNode.getStatement().getStartPosition().getLineNumber(),
true);
replacePlaceholder(
searchParentInMapping(k.getData().getNode()), ftn);
addPlaceholder(ftn, k.getData().getNode());
});
// add to foreachNodes list -> so the end of a foreach can be catched
List<GoalNode<KeyData>> aftergoals = (nextPtreeNode.getStateAfterStmt() != null)? nextPtreeNode.getStateAfterStmt().getGoals()
: (nextPtreeNode.getStepOver() != null && nextPtreeNode.getStepOver().getStateBeforeStmt() != null) ? nextPtreeNode.getStepOver().getStateBeforeStmt().getGoals()
: new ArrayList<>();
aftergoals.forEach(k -> foreachNodes.put(k.getData().getNode(), nextPtreeNode));
//
return null;
}
}
private void addPlaceholder(AbstractTreeNode parent, Node current, boolean isSplit) {
private void addPlaceholder(AbstractTreeNode parent, Node current) {
PlaceholderNode phn = new PlaceholderNode(current);
phn.setParent(parent);
......@@ -492,12 +490,14 @@ public class ScriptTreeGraph {
private void checkIfForeachEnd(Node n) {
if(foreachNodes.containsKey(n)) {
PTreeNode ptn = foreachNodes.get(n);
ForeachTreeNode ftn = new ForeachTreeNode(n, ptn, ptn.getStatement().getStartPosition().getLineNumber(), false);
addToSubChildren(nextPtreeNode.getStateBeforeStmt().getSelectedGoalNode().getData().getNode(), ftn);
if(mapping.get(n) == null) {
putIntoMapping(n,ftn);
}
ForeachTreeNode ftn = new ForeachTreeNode(
n,
ptn,
ptn.getStatement().getStartPosition().getLineNumber(),
false);
replacePlaceholder(nextPtreeNode.getStateBeforeStmt().getSelectedGoalNode().getData().getNode(), ftn);
addPlaceholder(ftn, n);
foreachNodes.remove(n);
......
......@@ -13,16 +13,12 @@ script full0(){
impRight;
impRight;
impLeft;
cases {
case match `!q ==> p`:
notLeft;
case match `q==>!p`:
notLeft;
}
foreach{
notLeft;
}
foreach{
auto;
}
}
script full(){
......
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