X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FResult.java;fp=src%2Fedu%2Fberkeley%2Fsbp%2FResult.java;h=97f467f7b6e35eb9d3067184251c5d8efb53b599;hp=efaad4cee2eb04524554d886d3c5b66a45c8863e;hb=8cf79c4b9e5a26ef65bd4af600946b45dbf28a8a;hpb=33d7b8fa4974bad96108c11e5548b354cf10ecb8 diff --git a/src/edu/berkeley/sbp/Result.java b/src/edu/berkeley/sbp/Result.java index efaad4c..97f467f 100644 --- a/src/edu/berkeley/sbp/Result.java +++ b/src/edu/berkeley/sbp/Result.java @@ -13,6 +13,7 @@ final class Result implements GraphViz.ToGraphViz { private HashSet successors = new HashSet(); private boolean destroyed = false; private int usedByNonDoomedNode = 0; + private Pos reduction; public GSS.Phase phase() { return pred==null ? null : pred.phase(); } public Forest getForest() { return f; } @@ -47,16 +48,17 @@ final class Result implements GraphViz.ToGraphViz { } } - public Result(Forest f, Node pred, Pos reduction) { - this(f, pred, reduction, null); + public static void newResult(Forest f, Node pred, Pos reduction, GSS.Phase target) { + Result r = new Result(f, pred, reduction); + if (reduction == null) return; + Parser.Table.State state0 = (Parser.Table.State)pred.state().gotoSetNonTerminals.get(reduction); + target.newNodeFromReduction(r, state0, reduction); } - public Result(Forest f, Node pred, Pos reduction, GSS.Phase target) { + public Result(Forest f, Node pred, Pos reduction) { this.f = f; this.pred = pred; + this.reduction = reduction; if (pred != null) pred.addSucc(this); - if (reduction == null) return; - Parser.Table.State state0 = (Parser.Table.State)pred.state().gotoSetNonTerminals.get(reduction); - target.newNodeFromReduction(this, state0, reduction); } // GraphViz //////////////////////////////////////////////////////////////////////////////