Commit 969b79ad authored by Sarah Grebing's avatar Sarah Grebing

supporting structures for treegraph interim state

parent 6ceb7b2c
......@@ -13,9 +13,13 @@ import edu.kit.iti.formal.psdbg.interpreter.dbg.PTreeNode;
import edu.kit.iti.formal.psdbg.parser.ast.ASTNode;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
public class ScriptTreeGraph {
private ScriptTreeNode rootNode;
private final MutableGraph<AbstractTreeNode> graph =
......@@ -34,26 +38,24 @@ public class ScriptTreeGraph {
//Am Anfang: rootNode
ScriptTreeNode currentScriptNode = rootNode;
PTreeNode<KeyData> currentNode = rootNode.getScriptState();
while(currentNode.getStateAfterStmt() != null) {
if (currentNode.getStateAfterStmt() != null) {
if (currentNode.getStateAfterStmt().getGoals().size() == 1) {
PTreeNode<KeyData> nextPTreeNode = currentNode.computeNextPtreeNode(currentNode);
ScriptTreeNode newNode = new ScriptTreeNode(nextPTreeNode, currentNode.getStateAfterStmt().getGoals().get(0).getData().getNode());
//set parent and children relation
newNode.setParent(currentScriptNode);
currentScriptNode.setChildren(Collections.singletonList(newNode));
//reset Pointer for next round
currentNode = nextPTreeNode;
currentScriptNode = newNode;
} else {
if (currentNode.getStateAfterStmt().getGoals().size() < 1) {
}
}
while (currentNode.getStateAfterStmt() != null) {
List<GoalNode<KeyData>> goalsAfterStmt = currentNode.getStateAfterStmt().getGoals();
if (goalsAfterStmt.size() == 1) {
PTreeNode<KeyData> nextPTreeNode = currentNode.computeNextPtreeNode(currentNode);
ScriptTreeNode newNode = new ScriptTreeNode(nextPTreeNode, goalsAfterStmt.get(0).getData().getNode());
//set parent and children relation
newNode.setParent(currentScriptNode);
currentScriptNode.setChildren(Collections.singletonList(newNode));
//reset Pointer for next round
currentNode = nextPTreeNode;
currentScriptNode = newNode;
} else if (goalsAfterStmt.size() > 1) {
} else {
break;
}
}
}
......
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