This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
1 package Analysis.TaskStateAnalysis;
2 import IR.*;
3 import Analysis.TaskStateAnalysis.*;
4 import IR.Tree.*;
5 import IR.Flat.*;
6 import java.util.*;
7 import Util.Edge;
8
9 /* Edge *****************/
10
11 public class FEdge extends Edge {
12
13     private String label;
14     private TaskDescriptor td;
15     private int parameterindex;
16     
17     // jzhou
18     private int executeTime;
19     private Hashtable<ClassDescriptor, NewObjInfo> newObjInfos;
20     
21     public class NewObjInfo {
22         int newRate;
23         int probability;
24         
25         public NewObjInfo() {
26             newRate = 0;
27             probability = 0;
28         }
29         
30         public NewObjInfo(int newRate, int probability) {
31             this.newRate = newRate;
32             this.probability = probability;
33         }
34         
35         public int getNewRate() {
36             return this.newRate;
37         }
38         
39         public void setNewRate(int newRate) {
40             this.newRate = newRate;
41         }
42         
43         public int getProbability() {
44             return this.probability;
45         }
46         
47         public void setProbability(int probability) {
48             this.probability = probability;
49         }
50         
51         public boolean equals(Object o) {
52             if (o instanceof NewObjInfo) {
53                 NewObjInfo e=(NewObjInfo)o;
54                 if (e.newRate == this.newRate &&
55                     e.probability == this.probability) {
56                     return true;
57                 }
58             }
59             return false;
60         }
61     }
62     
63     /** Class Constructor
64      * 
65      */
66     public FEdge(FlagState target, String label, TaskDescriptor td, int parameterindex) {
67         super(target);
68         this.label = label;
69         this.td=td;
70         this.parameterindex=parameterindex;
71         this.executeTime = -1;
72         this.newObjInfos = null;
73     }
74     
75     public String getLabel() {
76         return label;
77     }
78     
79     public int hashCode(){
80         int hashcode = label.hashCode()^target.hashCode()^source.hashCode()^td.hashCode()^parameterindex^executeTime;
81         if(newObjInfos != null) {
82             hashcode ^= newObjInfos.hashCode();
83         }
84         return hashcode;
85     }
86
87     public TaskDescriptor getTask() {
88         return td;
89     }
90
91     public int getIndex() {
92         return parameterindex;
93     }
94         
95     public boolean equals(Object o) {
96         if (o instanceof FEdge) {
97             FEdge e=(FEdge)o;
98             if (e.label.equals(label)&&
99                 e.target.equals(target)&&
100                 e.source.equals(source) &&
101                 e.td==td&&
102                 e.parameterindex==parameterindex &&
103                 e.executeTime == executeTime) {
104                 if(this.newObjInfos != null) {
105                     if(e.newObjInfos == null) {
106                         return false;
107                     } else {
108                         return e.newObjInfos.equals(this.newObjInfos);
109                     }
110                 }
111                 return true;
112             }
113         }
114         return false;
115     }
116     
117     public int getExeTime() {
118         return this.executeTime;
119     }
120     
121     public void setExeTime(int eTime) {
122         this.executeTime = eTime;
123     }
124     
125     public Hashtable<ClassDescriptor, NewObjInfo> getNewObjInfoHashtable() {
126         return this.newObjInfos;
127     }
128     
129     public NewObjInfo getNewObjInfo(ClassDescriptor cd) {
130         if(this.newObjInfos == null) {
131             return null;
132         }
133         return this.newObjInfos.get(cd);
134     }
135     
136     public void addNewObjInfo(ClassDescriptor cd, int newRate, int probability) {
137         if(this.newObjInfos == null) {
138             this.newObjInfos = new Hashtable<ClassDescriptor, NewObjInfo>();
139         }
140         this.newObjInfos.put(cd, new NewObjInfo(newRate, probability));
141     }
142 }