1 package Analysis.Scheduling;
3 import java.util.Vector;
5 import IR.TaskDescriptor;
8 public class SimExecutionEdge extends Edge {
11 private static int nodeID=0;
14 private TaskDescriptor td;
15 private Vector<Integer> taskparams;
18 private long bestStartPoint;
19 private SimExecutionNode lastpredicatenode;
20 private SimExecutionEdge lastpredicateedge;
21 private Vector<SimExecutionEdge> predicates;
22 private boolean isFixedTime;
24 public SimExecutionEdge(SimExecutionNode target,
28 Vector<Integer> taskparams) {
30 this.eid = SimExecutionEdge.nodeID++;
31 this.coreNum = corenum;
33 this.taskparams = taskparams;
35 this.bestStartPoint = -1;
36 this.lastpredicatenode = null;
37 this.lastpredicateedge = null;
38 this.predicates = null;
39 this.isFixedTime = true;
42 public long getBestStartPoint() {
43 if(this.bestStartPoint == -1) {
44 if((this.predicates != null) && (this.predicates.size() > 0)) {
47 // check the latest finish time of all the predicates
48 for(int j = 0; j < this.predicates.size(); j++) {
49 SimExecutionEdge predicate = this.predicates.elementAt(j);
50 long tmptime = predicate.getBestStartPoint() + predicate.getWeight();
51 if(tmptime > starttime) {
53 this.lastpredicateedge = predicate;
54 if(predicate.getTd() != null) {
55 this.lastpredicatenode = (SimExecutionNode)predicate.getTarget();
58 this.lastpredicatenode = (SimExecutionNode)predicate.getSource();
62 this.bestStartPoint = starttime;
65 this.bestStartPoint = 0;
68 return bestStartPoint;
71 public void setBestStartPoint(long bestStartPoint) {
72 this.bestStartPoint = bestStartPoint;
75 public Vector<SimExecutionEdge> getPredicates() {
79 public void addPredicate(SimExecutionEdge predicate) {
80 if(this.predicates == null) {
81 this.predicates = new Vector<SimExecutionEdge>();
83 if(!this.predicates.contains(predicate)) {
84 this.predicates.add(predicate);
88 public Vector<Integer> getTaskparams() {
92 public TaskDescriptor getTd() {
96 public long getWeight() {
100 public void setWeight(int weight) {
101 this.weight = weight;
104 public int getCoreNum() {
108 public SimExecutionNode getLastpredicateNode() {
109 return lastpredicatenode;
112 public void setLastpredicateNode(SimExecutionNode lastpredicatenode) {
113 this.lastpredicatenode = lastpredicatenode;
116 public SimExecutionEdge getLastpredicateEdge() {
117 return lastpredicateedge;
120 public void setLastpredicateEdge(SimExecutionEdge lastpredicateedge) {
121 this.lastpredicateedge = lastpredicateedge;
124 public boolean isFixedTime() {
128 public void setFixedTime(boolean isFixedTime) {
129 this.isFixedTime = isFixedTime;
132 public String getLabel() {
133 String completeLabel = (this.td != null? this.td.getSymbol():"")
134 + "(" + this.weight + " | " + this.bestStartPoint + ")";
135 return completeLabel;
138 public void destroy() {
140 if(this.taskparams != null) {
141 this.taskparams.clear();
142 this.taskparams = null;
144 this.lastpredicatenode = null;
145 this.lastpredicateedge = null;
146 if(this.predicates != null) {
147 this.predicates.clear();
148 this.predicates = null;
150 this.source.getEdgeVector().clear();
151 this.source.getInedgeVector().clear();
153 this.target.getEdgeVector().clear();
154 this.target.getInedgeVector().clear();