1 package Analysis.TaskStateAnalysis;
3 import Analysis.TaskStateAnalysis.*;
9 /* Edge *****************/
11 public class FEdge extends Edge {
14 private TaskDescriptor td;
15 private int parameterindex;
18 private int executeTime;
19 private Hashtable<ClassDescriptor, NewObjInfo> newObjInfos;
20 private int probability;
21 private int invokeNum;
22 private int expInvokeNum;
24 public class NewObjInfo {
37 public NewObjInfo(int newRate, int probability) {
38 this.newRate = newRate;
39 this.probability = probability;
42 public int getNewRate() {
46 public void setNewRate(int newRate) {
47 this.newRate = newRate;
50 public int getProbability() {
51 return this.probability;
54 public void setProbability(int probability) {
55 this.probability = probability;
58 public FlagState getRoot() {
62 public void setRoot(FlagState root) {
66 public int getInvokeNum() {
70 public void incInvokeNum() {
74 public boolean equals(Object o) {
75 if (o instanceof NewObjInfo) {
76 NewObjInfo e=(NewObjInfo)o;
77 if (e.newRate == this.newRate &&
78 e.probability == this.probability &&
79 e.invokeNum == this.invokeNum &&
80 e.root.equals(this.root)) {
91 public FEdge(FlagState target, String label, TaskDescriptor td, int parameterindex) {
95 this.parameterindex=parameterindex;
96 this.executeTime = -1;
97 this.newObjInfos = null;
98 this.probability = -1;
100 this.expInvokeNum = 0;
103 public int getProbability() {
107 public void setProbability(int probability) {
108 this.probability = probability;
111 public String getLabel() {
115 public int hashCode(){
116 int hashcode = label.hashCode()^target.hashCode()^source.hashCode()^td.hashCode()^parameterindex^executeTime;
117 if(newObjInfos != null) {
118 hashcode ^= newObjInfos.hashCode();
123 public TaskDescriptor getTask() {
127 public int getIndex() {
128 return parameterindex;
131 public boolean equals(Object o) {
132 if (o instanceof FEdge) {
134 if (e.label.equals(label)&&
135 e.target.equals(target)&&
136 e.source.equals(source) &&
138 e.parameterindex==parameterindex &&
139 e.executeTime == executeTime) {
140 if(this.newObjInfos != null) {
141 if(e.newObjInfos == null) {
144 return e.newObjInfos.equals(this.newObjInfos);
153 public int getExeTime() {
154 return this.executeTime;
157 public void setExeTime(int eTime) {
158 this.executeTime = eTime;
161 public Hashtable<ClassDescriptor, NewObjInfo> getNewObjInfoHashtable() {
162 return this.newObjInfos;
165 public NewObjInfo getNewObjInfo(ClassDescriptor cd) {
166 if(this.newObjInfos == null) {
169 return this.newObjInfos.get(cd);
172 public void addNewObjInfo(ClassDescriptor cd, int newRate, int probability) {
173 if(this.newObjInfos == null) {
174 this.newObjInfos = new Hashtable<ClassDescriptor, NewObjInfo>();
176 this.newObjInfos.put(cd, new NewObjInfo(newRate, probability));
179 public void process() {
183 public int getInvokeNum() {
187 public int getInvokeNumGap() {
188 return expInvokeNum - invokeNum;
191 public void setExpInvokeNum(int expInvokeNum) {
192 this.expInvokeNum = expInvokeNum;