X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FReduction.java;h=a6d599f6a7337db4322d1d0e2fd52b0affa11450;hp=e845764ec192ff483268f4cc2756d87b25b3385f;hb=a16fa9866b4bd4fabd4082f1a81f31a352a8f4c2;hpb=e84029a8b861075d6d0ed5040f919b2e4da4c98f diff --git a/src/edu/berkeley/sbp/Reduction.java b/src/edu/berkeley/sbp/Reduction.java index e845764..a6d599f 100644 --- a/src/edu/berkeley/sbp/Reduction.java +++ b/src/edu/berkeley/sbp/Reduction.java @@ -22,6 +22,7 @@ final class Reduction implements Comparable { this.result = result; this.phase = target; this.node = node; + target.reductionQueue.add(this); } public void perform() { @@ -30,8 +31,6 @@ final class Reduction implements Comparable { node.finish(position, result, phase); } - public String toString() { return position+""; } - public int compareTo(Reduction r) { int ret = compareTo0(r); if (ret == 0) { @@ -45,13 +44,13 @@ final class Reduction implements Comparable { return -1 * ret; } - private boolean isRightNullable(Walk.Cache c, Position p) { + private static boolean isRightNullable(Walk.Cache c, Position p) { if (p.isLast()) return true; if (!c.possiblyEpsilon(p.element())) return false; return isRightNullable(c, p.next()); } - public boolean canKill(Walk.Cache cache, Position mep, Position himp) { + public static boolean canKill(Walk.Cache cache, Position mep, Position himp) { if (!isRightNullable(cache, mep)) return false; if (!isRightNullable(cache, himp)) return false; Sequence me = mep.owner(); @@ -78,7 +77,7 @@ final class Reduction implements Comparable { public int pos() { return targetPhase()==null ? 0 : targetPhase().pos; } public GSS.Phase targetPhase() { return node.phase(); } - public boolean canNeed(Walk.Cache cache, Position mep, Position himp) { + public static boolean canNeed(Walk.Cache cache, Position mep, Position himp) { if (!isRightNullable(cache, mep)) return false; if (!isRightNullable(cache, himp)) return false; Sequence me = mep.owner();