Feature adds to webinterface:
[IRC.git] / Robust / src / Analysis / TaskStateAnalysis / TaskNode.java
1 package Analysis.TaskStateAnalysis;
2 import Analysis.TaskStateAnalysis.*;
3 import IR.*;
4 import IR.Tree.*;
5 import IR.Flat.*;
6 import java.util.*;
7 import java.io.*;
8 import Util.GraphNode;
9
10 public class TaskNode extends GraphNode {
11         
12     private final String name;
13     private int uid;
14     private static int nodeid=0;
15     
16     /**Class Constructor
17      * Creates a new TaskNode using the TaskDescriptor.
18      * @param tasknode TaskDescriptor
19      */
20     public TaskNode(String name){
21             this.name=name;
22             this.uid=TaskNode.nodeid++;
23     }
24      
25     /**Returns the string representation of the node 
26      * @return string representation of the tasknode (e.g "Task foo")
27      */
28     public String getTextLabel() {
29                 return "Task "+name;
30         }
31         
32         public String getLabel() {
33         return "N"+uid;
34     }
35
36     public String getName(){
37             return name;
38     }
39         
40         /**toString method.
41          * @return  string representation of the tasknode (e.g "Task foo")
42          */
43         public String toString(){
44                 return getTextLabel();
45         }
46         
47         public int hashCode(){
48                 return name.hashCode();
49                 
50         }
51         
52         public boolean equals(Object o) {
53         if (o instanceof TaskNode) {
54            TaskNode tn=(TaskNode)o;
55            return (tn.name.equals(name));
56         }
57         return false;
58     }
59     
60     public boolean edgeExists(TEdge newedge){
61             if(edges.isEmpty())
62                 return false;
63             else
64                 return edges.contains(newedge);
65     }
66             
67     
68 }
69         
70      
71