rename Node.results to Node.predecessors, add type parameter to Node
[sbp.git] / src / edu / berkeley / sbp / Node.java
index 872e377..532a4a8 100644 (file)
@@ -10,8 +10,9 @@ import java.io.*;
 import java.util.*;
 import java.lang.reflect.*;
 
-class Node
-    implements GraphViz.ToGraphViz {
+class Node<OtherNode extends Node>
+    implements IntegerMappable,
+               GraphViz.ToGraphViz {
 
     // GraphViz //////////////////////////////////////////////////////////////////////////////
 
@@ -36,4 +37,11 @@ class Node
     }
     public boolean isTransparent() { return false; }
     public boolean isHidden() { return false; }
+
+    // IntegerMappable ////////////////////////////////////////////////////////////
+
+    private static int node_idx = 0;
+    private final int idx = node_idx++;
+    public int toInt() { return idx; }
+
 }
\ No newline at end of file