bug fixes
[IRC.git] / Robust / src / Util / Edge.java
index 72d556915d26a7d00bb6a93cb9f57fc77fb2f8d1..8b13b03d3d1fea5bc08c0e8ccb466fcaffcce48b 100644 (file)
@@ -38,4 +38,35 @@ public class Edge {
             dotnodeparams = param;
         }
     }
+    
+    public static final EdgeStatus UNVISITED = new EdgeStatus("UNVISITED");
+    public static final EdgeStatus PROCESSING = new EdgeStatus("PROCESSING");
+    public static final EdgeStatus FINISHED = new EdgeStatus("FINISHED");
+    
+    public static class EdgeStatus {
+        private static String name;
+        private EdgeStatus(String name) { this.name = name; }
+        public String toString() { return name; }
+    }
+    
+    int discoverytime = -1;
+    int finishingtime = -1; /* used for searches */
+    EdgeStatus status = UNVISITED;
+    
+    void reset() {
+           discoverytime = -1;
+           finishingtime = -1;
+           status = UNVISITED;
+    }
+    
+    void discover(int time) {
+       discoverytime = time;
+       status = PROCESSING;
+    }
+
+    void finish(int time) {
+        assert status == PROCESSING;
+       finishingtime = time;
+        status = FINISHED;
+    }
 }