Commit d8ebcb2c authored by Sarah Grebing's avatar Sarah Grebing

Fixed the bug with missing proof tree nodes and fixed the coloring issue of branching nodes

parent 2b49f8aa
...@@ -302,6 +302,7 @@ public class ProofTree extends BorderPane { ...@@ -302,6 +302,7 @@ public class ProofTree extends BorderPane {
return; return;
if (root.get() != null) { if (root.get() != null) {
TreeItem<TreeNode> item = populate("Proof", root.get()); TreeItem<TreeNode> item = populate("Proof", root.get());
treeProof.setRoot(item); treeProof.setRoot(item);
} }
...@@ -317,12 +318,23 @@ public class ProofTree extends BorderPane { ...@@ -317,12 +318,23 @@ public class ProofTree extends BorderPane {
if (sentinels.contains(n)) { if (sentinels.contains(n)) {
return ti; return ti;
} }
if (label.equals("Proof")) { //we are at the root
TreeItem<TreeNode> self1 = new TreeItem<>(new TreeNode(n.serialNr() + ": " + toString(n), n));
ti.getChildren().add(self1);
}
//if we are at a leaf we need to check goal state
if (n.childrenCount() == 0) { if (n.childrenCount() == 0) {
TreeItem<TreeNode> e = new TreeItem<>(new TreeNode( // TreeItem<TreeNode> e = new TreeItem<>(new TreeNode(
n.isClosed() ? "CLOSED GOAL" : "OPEN GOAL", null)); // n.isClosed() ? "CLOSED GOAL" : "OPEN GOAL", null));
/* if(!label.equals("Proof")) {
TreeItem<TreeNode> self = new TreeItem<>(new TreeNode(n.serialNr() + ": " + toString(n), n));
ti.getChildren().add(self);
}*/
// ti.getChildren().add(e);
ti.getChildren().add(e);
return ti; return ti;
} }
...@@ -339,16 +351,22 @@ public class ProofTree extends BorderPane { ...@@ -339,16 +351,22 @@ public class ProofTree extends BorderPane {
} else { // children count > 1 } else { // children count > 1
Iterator<Node> nodeIterator = node.childrenIterator(); Iterator<Node> nodeIterator = node.childrenIterator();
Node childNode; Node childNode;
int branchCounter = 1; int branchCounter = 1;
while (nodeIterator.hasNext()) { while (nodeIterator.hasNext()) {
childNode = nodeIterator.next(); childNode = nodeIterator.next();
if (childNode.getNodeInfo().getBranchLabel() != null) { if (childNode.getNodeInfo().getBranchLabel() != null) {
ti.getChildren().add(populate(childNode.getNodeInfo().getBranchLabel(), childNode));
TreeItem<TreeNode> populate = populate(childNode.getNodeInfo().getBranchLabel(), childNode);
// TreeItem<TreeNode> self = new TreeItem<>(new TreeNode(childNode.serialNr() + ": " + toString(childNode), childNode));
// populate.getChildren().add(0, self);
ti.getChildren().add(populate);
} else { } else {
//ti.getChildren().add(populate(childNode.getAppliedRuleApp().rule().name().toString(), childNode)); TreeItem<TreeNode> populate = populate("BRANCH " + branchCounter, childNode);
ti.getChildren().add(populate("BRANCH " + branchCounter, childNode)); TreeItem<TreeNode> self = new TreeItem<>(new TreeNode(childNode.serialNr() + ": " + toString(childNode), childNode));
populate.getChildren().add(0, self);
ti.getChildren().add(populate);
branchCounter++; branchCounter++;
} }
} }
...@@ -387,9 +405,10 @@ public class ProofTree extends BorderPane { ...@@ -387,9 +405,10 @@ public class ProofTree extends BorderPane {
} }
private void repaint(TextFieldTreeCell<TreeNode> tftc) { private void repaint(TextFieldTreeCell<TreeNode> tftc) {
Node n = tftc.getItem().node; TreeNode item = tftc.getItem();
Node n = item.node;
tftc.setStyle(""); tftc.setStyle("");
if (n != null && n.leaf()) { if (n != null && n.leaf() && !item.label.contains("BRANCH")) {
if (n.isClosed()) { if (n.isClosed()) {
colorOfNodes.putIfAbsent(n, "seagreen"); colorOfNodes.putIfAbsent(n, "seagreen");
//tftc.setStyle("-fx-background-color: greenyellow"); //tftc.setStyle("-fx-background-color: greenyellow");
......
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