2d5eec3504ba5cae177dd5afc306c3eafe55170e
[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         
37         /**toString method.
38          * @return  string representation of the tasknode (e.g "Task foo")
39          */
40         public String toString(){
41                 return getTextLabel();
42         }
43         
44         public int hashCode(){
45                 return name.hashCode();
46                 
47         }
48         
49         public boolean equals(Object o) {
50         if (o instanceof TaskNode) {
51            TaskNode tn=(TaskNode)o;
52            return (tn.name.equals(name));
53         }
54         return false;
55     }
56 }
57         
58      
59