change
[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 GraphNode {
10   private boolean source=false;
11   private FlagState fs;
12   private FlagState postfs;
13   private TaskDescriptor td;
14   private int index;
15   private String name;
16   private int uid;
17   private static int nodeid;
18
19   public EGTaskNode(String name, TaskDescriptor td, FlagState postfs) {
20     this(name, null, td, -1, postfs);
21   }
22
23   public EGTaskNode(String name, FlagState fs, TaskDescriptor td, int index, FlagState postfs) {
24     this.name=name;
25     this.uid=nodeid++;
26     this.fs = fs;
27     this.td = td;
28     this.index=index;
29     this.postfs=postfs;
30   }
31
32   public String getTextLabel() {
33     return "Task "+getName()+"["+fs+"]->["+postfs+"]";
34   }
35
36   public String getName() {
37     return name;
38   }
39
40   public String getLabel() {
41     return "N"+uid;
42   }
43
44   public int getIndex() {
45     return index;
46   }
47
48   public String toString() {
49     return getTextLabel();
50   }
51
52   public FlagState getPostFS() {
53     return postfs;
54   }
55
56   public boolean isRuntime() {
57     return td==null&&getName().equals("Runtime");
58   }
59
60
61   public boolean isOptional() {
62     return (!isSource()&&td!=null&&td.isOptional(td.getParameter(index)));
63   }
64
65
66   public TaskDescriptor getTD() {
67     return td;
68   }
69
70   public void setSource() {
71     source = true;
72   }
73
74   public boolean isSource() {
75     return source;
76   }
77
78   public int getuid() {
79     return uid;
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 }