simplify ExecutionGraph code
[IRC.git] / Robust / src / Analysis / TaskStateAnalysis / EGTaskNode.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 Util.GraphNode;
8
9 public class EGTaskNode extends TaskNode {
10     private boolean source=false;
11     private int loopmarker=0;
12     private boolean multipleparams=false;
13     private boolean optional = false;
14     private boolean marked=false;
15     private boolean tomention=true;
16     private int type = 0;
17     private FlagState fs;
18     private TaskDescriptor td;
19     protected HashSet edges = new HashSet();
20     public EGTaskNode(){
21         this("default", null, null);
22     }
23     
24     public EGTaskNode(String name){
25         this(name, null, null);
26     }
27
28     public EGTaskNode(String name, FlagState fs){
29         this(name, fs, null);
30     }
31
32     public EGTaskNode(String name, TaskDescriptor td){
33         this(name, null, td);
34     }
35
36     public EGTaskNode(String name, FlagState fs, TaskDescriptor td){
37         super(name);
38         this.fs = fs;
39         this.td = td;
40     }
41     
42     public int hashCode(){
43         return getLabel().hashCode();
44     }
45     
46     public boolean equals(Object o){
47         if(o instanceof EGTaskNode){
48             EGTaskNode tn=(EGTaskNode) o;
49             return tn.getLabel().equals(getLabel());
50         }
51         return false;
52     }
53
54     public HashSet getEdgeSet(){
55         return edges;
56     }
57
58     public void addEdge(EGEdge newedge) {
59         newedge.setSource(this);
60         edges.add(newedge);
61         EGTaskNode tonode=newedge.getTarget();
62         tonode.inedges.addElement(newedge);
63     }
64
65     public Iterator edges(){
66         return edges.iterator();
67     }
68     
69     public TaskDescriptor getTD(){
70         return td;
71     }
72         
73     public void setSource(){
74         source = true;
75     }
76
77     public boolean isSource(){
78         return source;
79     }
80
81     public int getuid(){
82         return uid;
83     }
84
85     public void doSelfLoopMarking(){
86         loopmarker=1;
87     }
88
89     public void doLoopMarking(){
90         loopmarker=2;
91     }
92             
93     public boolean isSelfLoop(){
94         if (loopmarker==1) return true;
95         else return false;
96     }
97
98     public boolean isLoop(){
99         if (loopmarker==2) return true;
100         else return false;
101     }
102
103     public void setMultipleParams(){
104         multipleparams=true;
105     }
106
107     public boolean isMultipleParams(){
108         return multipleparams;
109     }
110     
111     public void setOptional(){
112         optional = true;
113     }
114
115     public boolean isOptional(){
116         return optional;
117     }
118
119     public void mark(){
120         marked = true;
121     }
122
123     public void unMark(){
124         marked = false;
125     }
126     
127     public boolean isMarked(){
128         return marked;
129     }
130
131     public String getFSName(){
132         if(fs == null) return "no flag";
133         else return fs.getTextLabel();
134     }
135     
136     public FlagState getFS(){
137         return fs;
138     }
139
140     public void dontMention(){
141         tomention = false;
142     }
143
144     public boolean toMention(){
145         return tomention;
146     }
147     
148     public void setAND(){
149         type = 1;
150     }
151     
152     public void setOR(){
153         type = 0;
154     }
155     
156     public int type(){
157         return type;
158     }
159 }