eccb83d1c893a3c142f8bd3f094ac86422c542f3
[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 tomention=true;
13     private FlagState fs;
14     private FlagState postfs;
15     private TaskDescriptor td;
16     private int index;
17
18     public EGTaskNode(String name, TaskDescriptor td, FlagState postfs){
19         this(name, null, td, -1, postfs);
20     }
21
22     public EGTaskNode(String name, FlagState fs, TaskDescriptor td, int index, FlagState postfs){
23         super(name);
24         this.fs = fs;
25         this.td = td;
26         this.index=index;
27         this.postfs=postfs;
28     }
29     
30     public int getIndex() {
31         return index;
32     }
33
34     public FlagState getPostFS() {
35         return postfs;
36     }
37     
38     public boolean isRuntime() {
39         return td==null&&getName().equals("Runtime");
40     }
41
42
43     public boolean isOptional() {
44         return (!isSource()&&td!=null&&td.isOptional(td.getParameter(index)));
45     }
46
47
48     public TaskDescriptor getTD(){
49         return td;
50     }
51         
52     public void setSource(){
53         source = true;
54     }
55
56     public boolean isSource(){
57         return source;
58     }
59
60     public int getuid(){
61         return uid;
62     }
63
64     public void doSelfLoopMarking(){
65         loopmarker=1;
66     }
67
68     public void doLoopMarking(){
69         loopmarker=2;
70     }
71             
72     public boolean isSelfLoop(){
73         if (loopmarker==1) return true;
74         else return false;
75     }
76
77     public boolean isLoop(){
78         if (loopmarker==2) return true;
79         else return false;
80     }
81
82     public boolean isMultipleParams(){
83         return getTD()!=null&&getTD().numParameters()>1;
84     }
85     
86     public String getFSName(){
87         if(fs == null) 
88             return "no flag";
89         else 
90             return fs.getTextLabel();
91     }
92     
93     public FlagState getFS(){
94         return fs;
95     }
96
97     public void dontMention(){
98         tomention = false;
99     }
100
101     public boolean toMention(){
102         return tomention;
103     }
104 }