This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
1 package Util;
2
3 /* Edge *****************/
4
5 public class Edge {
6     protected GraphNode target;
7     protected GraphNode source;
8
9     protected String dotnodeparams = new String();
10     
11     public Edge(GraphNode target) {
12         this.target = target;
13     }
14     
15     public String getLabel() {
16         return "";
17     }
18     
19     public void setSource(GraphNode s) {
20         this.source=s;
21     }
22     
23     public GraphNode getSource() {
24         return source;
25     }
26     
27     public GraphNode getTarget() {
28         return target;
29     }
30
31     public void setDotNodeParameters(String param) {
32         if (param == null) {
33             throw new NullPointerException();
34         }
35         if (dotnodeparams.length() > 0) {
36             dotnodeparams += "," + param;
37         } else { 
38             dotnodeparams = param;
39         }
40     }
41     
42     public static final EdgeStatus UNVISITED = new EdgeStatus("UNVISITED");
43     public static final EdgeStatus PROCESSING = new EdgeStatus("PROCESSING");
44     public static final EdgeStatus FINISHED = new EdgeStatus("FINISHED");
45     
46     public static class EdgeStatus {
47         private static String name;
48         private EdgeStatus(String name) { this.name = name; }
49         public String toString() { return name; }
50     }
51     
52     int discoverytime = -1;
53     int finishingtime = -1; /* used for searches */
54     EdgeStatus status = UNVISITED;
55     
56     void reset() {
57             discoverytime = -1;
58             finishingtime = -1;
59             status = UNVISITED;
60     }
61     
62     void discover(int time) {
63         discoverytime = time;
64         status = PROCESSING;
65     }
66
67     void finish(int time) {
68         assert status == PROCESSING;
69         finishingtime = time;
70         status = FINISHED;
71     }
72 }