Commit 393fdf26 authored by Sarah Grebing's avatar Sarah Grebing

Added handling of null branching labels

parent 0a983eb3
Pipeline #15143 passed with stages
in 6 minutes and 12 seconds
...@@ -20,6 +20,8 @@ import lombok.AllArgsConstructor; ...@@ -20,6 +20,8 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.val; import lombok.val;
import java.util.Iterator;
/** /**
* KeY Proof Tree * KeY Proof Tree
...@@ -155,7 +157,9 @@ public class ProofTree extends BorderPane { ...@@ -155,7 +157,9 @@ public class ProofTree extends BorderPane {
} }
private TreeItem<TreeNode> populate(String label, Node n) { private TreeItem<TreeNode> populate(String label, Node n) {
val treeNode = new TreeNode(label, n); val treeNode = new TreeNode(label, n);
TreeItem<TreeNode> ti = new TreeItem<>(treeNode); TreeItem<TreeNode> ti = new TreeItem<>(treeNode);
if (n.childrenCount() == 0) { if (n.childrenCount() == 0) {
ti.getChildren().add(new TreeItem<>(new TreeNode( ti.getChildren().add(new TreeItem<>(new TreeNode(
...@@ -175,8 +179,25 @@ public class ProofTree extends BorderPane { ...@@ -175,8 +179,25 @@ public class ProofTree extends BorderPane {
if (node.childrenCount() == 0) { if (node.childrenCount() == 0) {
} else { // children count > 1 } else { // children count > 1
node.children().forEach(child -> Iterator<Node> nodeIterator = node.childrenIterator();
ti.getChildren().add(populate(child.getNodeInfo().getBranchLabel(), child)));
Node childNode;
int branchCounter = 1;
while (nodeIterator.hasNext()) {
childNode = nodeIterator.next();
if (childNode.getNodeInfo().getBranchLabel() != null) {
ti.getChildren().add(populate(childNode.getNodeInfo().getBranchLabel(), childNode));
} else {
ti.getChildren().add(populate("BRANCH " + branchCounter, childNode));
branchCounter++;
}
}
/* node.childrenIterator().forEachRemaining(child -> ti.getChildren().add(
populate(child.getNodeInfo().getBranchLabel(), child)));
*/
//node.children().forEach(child ->
// ti.getChildren().add(populate(child.getNodeInfo().getBranchLabel(), child)));
} }
return ti; return ti;
......
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