integermappable
[sbp.git] / src / edu / berkeley / sbp / GSS.java
index 1adb8e4..a8f8053 100644 (file)
@@ -24,7 +24,8 @@ class GSS {
     HashSet<Phase.Waiting> tail = new     HashSet<Phase.Waiting>();
     
     /** corresponds to a positions <i>between tokens</i> the input stream; same as Tomita's U_i's */
-    public class Phase implements Invokable<State, Forest, GSS.Phase.Node> {
+    public class Phase implements Invokable<State, Forest, GSS.Phase.Node>, IntegerMappable {
+        public int toInt() { return pos+1; }
 
         /** the token immediately after this phase */
         public  final Token token;
@@ -304,7 +305,6 @@ class GSS {
             Forest res = null;
             boolean ok = false;
             for(Phase.Node n : hash.values()) {
-                //if (n.holder().empty() && pos>0) continue;
                 if (token == null && n.state.isAccepting()) {
                     if (finalResult==null) finalResult = new Forest.Ref();
                     finalResult.merge(n.holder);
@@ -398,7 +398,6 @@ class GSS {
                 this.fe = fe;
                 this.state = state;
                 this.holder().merge(pending);
-                //if (holder().empty()) throw new Error(holder()+"");
                 Phase start = parent==null ? null : parent.phase();
                 if (parent != null) parents().add(parent, true);
                 if (Phase.this.hash.get(code(state, start)) != null) throw new Error("severe problem!");