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;
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); }