some new attempts at a better dead-node collection; introduces hasPathToRoot
[sbp.git] / src / edu / berkeley / sbp / GSS.java
index 7666ec2..81e4909 100644 (file)
@@ -24,7 +24,7 @@ class GSS {
     int numReductions = 0;
 
     /** corresponds to a positions <i>between tokens</i> the input stream; same as Tomita's U_i's */
-    class Phase<Tok> implements Invokable<State, StateNode, Forest>, IntegerMappable, GraphViz.ToGraphViz, Iterable<StateNode> {
+    class Phase<Tok> implements Invokable<State, StateNode, Forest>, IntegerMappable, GraphViz.ToGraphViz /*, Iterable<StateNode>*/ {
 
         // FIXME: right now, these are the performance bottleneck
         private HashMapBag<Integer,Integer>       performed       = new HashMapBag<Integer,Integer>();
@@ -128,7 +128,7 @@ class GSS {
                 for(StateNode n : h) n.check();
             }
             numOldNodes = hash.size();
-            for(StateNode n : hash.values()) {
+            for(StateNode n : hash) {
                 if (token == null && n.state().isAccepting()) {
                     if (finalResult==null) finalResult = new Forest.Many();
                     for(ResultNode r : n)
@@ -209,7 +209,7 @@ class GSS {
         public int size() { return hash==null ? 0 : hash.size(); }
         public int pos() { return pos; }
         public Tok getToken() { return token; }
-        public Iterator<StateNode> iterator() { return hash.iterator(); }
+        //public Iterator<StateNode> iterator() { return hash.iterator(); }
         public GSS getGSS() { return GSS.this; }
 
         // GraphViz //////////////////////////////////////////////////////////////////////////////
@@ -229,8 +229,10 @@ class GSS {
             FileOutputStream fos = new FileOutputStream(filename);
             PrintWriter p = new PrintWriter(new OutputStreamWriter(fos));
             GraphViz gv = new GraphViz();
+            /*
             for(Object n : this)
                 ((StateNode)n).toGraphViz(gv);
+            */
             gv.dump(p);
             p.flush();
             p.close();