fix javadoc generation
[sbp.git] / src / edu / berkeley / sbp / ResultNode.java
index 579a868..655b85a 100644 (file)
@@ -9,19 +9,22 @@ import java.util.*;
 final class ResultNode
     extends Node<StateNode> {
 
-    private Forest.Many f = new Forest.Many();
     private Pos reduction;
+    private Forest.Many f = new Forest.Many();
 
     public void merge(Forest newf) { this.f.merge(newf); }
     public Pos reduction() { return reduction; }
     public boolean isDoomedState() { /* this is irrelevant */ return false; }
     public Forest getForest() { return f; }
     public String toString() { return super.toString()+"->"+phase(); }
+    public boolean hasPathToRoot() {
+        if (predecessorPhase()==null) return true;
+        return super.hasPathToRoot();
+    }
 
     public void check() {
         if (destroyed) return;
-        if (successors.size()==0) destroy();
-        else if (predecessors.size()==0) destroy();
+        if (!hasSuccessors() || !hasPredecessors()) destroy();
     }
     protected void destroy() {
         if (destroyed) return;
@@ -29,10 +32,10 @@ final class ResultNode
         super.destroy();
     }
 
-    public void addPred(StateNode pred) {
+    protected void addPred(StateNode pred) {
         super.addPred(pred);
-        // results have only one predecessor
-        if (predecessors.size() > 1) throw new Error();
+        // results should have at most one predecessor
+        //if (predecessors.size() > 1) throw new Error();
     }
         
     public ResultNode() { this(null, null, null); }