rename Node->StateNode
[sbp.git] / src / edu / berkeley / sbp / StateNode.java
similarity index 90%
rename from src/edu/berkeley/sbp/Node.java
rename to src/edu/berkeley/sbp/StateNode.java
index 8353384..8fb1fd7 100644 (file)
@@ -11,13 +11,13 @@ import java.util.*;
 import java.lang.reflect.*;
 
 /** a node in the GSS */
-final class Node
+final class StateNode
     implements Invokable<Pos, Result, Object>,
                IntegerMappable,
                GraphViz.ToGraphViz,
                Iterable<Result> {
 
-    /** which GSS.Phase this Node belongs to */
+    /** which GSS.Phase this StateNode belongs to */
     public GSS.Phase phase() { return phase; }
     public Iterator<Result> iterator() { return results.iterator(); }
     public Parser.Table.State state() { return state; }
@@ -85,11 +85,11 @@ final class Node
     private void reduce(Pos r, int pos, GSS.Phase target, Result only) {
         for(Result res : results)
             if (only == null || res == only)
-                for(Node pred : res.getPreds())
+                for(StateNode pred : res.getPreds())
                     reduce2(r, pos, target, pred, res.getForest());
     }
 
-    void reduce2(Pos r, int pos, GSS.Phase target, Node pred, Forest f) {
+    void reduce2(Pos r, int pos, GSS.Phase target, StateNode pred, Forest f) {
         Forest[] holder = r.holder;
         Forest old = pos >= holder.length ? null : holder[pos];
         if (pos < holder.length) holder[pos] = f;
@@ -101,10 +101,10 @@ final class Node
         if (pos < holder.length) holder[pos] = old;
     }
 
-    Node(GSS.Phase phase, Forest f, Pos reduction, Node pred, State state, boolean fromEmptyReduction) {
+    StateNode(GSS.Phase phase, Forest f, Pos reduction, StateNode pred, State state, boolean fromEmptyReduction) {
         this(phase, new Result(f, reduction, pred), state, fromEmptyReduction);
     }
-    Node(GSS.Phase phase, Result pred, State state, boolean fromEmptyReduction) {
+    StateNode(GSS.Phase phase, Result pred, State state, boolean fromEmptyReduction) {
         this.phase = phase;
         this.state = state;
         this.fromEmptyReduction = fromEmptyReduction;
@@ -133,7 +133,7 @@ final class Node
     public void addSucc(Result succ)      {
         successors.add(succ);
     }
-    public void addResult(Forest f, Pos reduction, Node pred) {
+    public void addResult(Forest f, Pos reduction, StateNode pred) {
         for(Result r : results)
             if (r.predecessorsContains(pred)) {
                 r.merge(f);
@@ -147,10 +147,10 @@ final class Node
 
     // GraphViz //////////////////////////////////////////////////////////////////////////////
 
-    public GraphViz.Node toGraphViz(GraphViz gv) {
+    public GraphViz.StateNode toGraphViz(GraphViz gv) {
         if (results.size()==0) return null;
         if (gv.hasNode(this)) return gv.createNode(this);
-        GraphViz.Node n = gv.createNode(this);
+        GraphViz.StateNode n = gv.createNode(this);
         n.label = "state["+state.toInt()+"]";
         n.shape = "rectangle";
         boolean haspreds = false;