Node child = res.parent();
holder[pos] = res.getForest();
if (pos>0) child.reduce(r, pos-1, target, null);
- else {
- Reduction reduction =
- new Reduction(child, r, r.rewrite(child.phase().getLocation().createRegion(target.getLocation())), target);
- target.reductionQueue.add(reduction);
- }
+ else new Reduction(child, r, r.rewrite(child.phase().getLocation().createRegion(target.getLocation())), target);
}
-
holder[pos] = old;
}
phase.hash.put(state, result.phase(), this);
for(Object s : state.also)
- phase.newNode(result, (State)s, fromEmptyReduction);
+ phase.newNode(new Result(null, this, null), (State)s, fromEmptyReduction);
state.invokeReductions(phase().token, this, true, null);
if (!fromEmptyReduction)
// GraphViz //////////////////////////////////////////////////////////////////////////////
public GraphViz.Node toGraphViz(GraphViz gv) {
+ if (results.size()==0) return null;
if (gv.hasNode(this)) return gv.createNode(this);
GraphViz.Node n = gv.createNode(this);
n.label = ""+state.toStringx();
n.shape = "rectangle";
boolean hasparents = false;
- //for(Node parent : parents()) { hasparents = true; n.edge(parent, ""); }
- //for(Forest result : resultMap) n.edge(result, "");
- n.color = !hasparents ? "blue" : /*state.evil ? "red" :*/ "green";
+ for(Result r : results) n.edge(r, "");
+ n.color = state.doomed ? "red" : "green";
((GraphViz.Group)phase().toGraphViz(gv)).add(n);
return n;
}