private int gid;
private int coreNum;
private Vector<TaskDescriptor> tasks;
+ private Hashtable<TaskDescriptor, Integer> td2num;
private Hashtable<FlagState, Queue<Integer>> targetCores;
private Hashtable<FlagState, FlagState> targetFState; // only affected by transimit edges
private Hashtable<FlagState, Vector<Integer>> allyCores;
private Hashtable<TaskDescriptor, Vector<FlagState>> td2fs;
public Schedule(int coreNum,
- int gid) {
+ int gid) {
this.gid = gid;
this.coreNum = coreNum;
this.tasks = null;
+ this.td2num = null;
this.targetCores = null;
this.targetFState = null;
this.allyCores = null;
}
public int getGid() {
- return gid;
+ return gid;
}
public int getCoreNum() {
return this.td2fs.get(td);
}
- public void addTargetCore(FlagState fstate,
- Integer targetCore) {
+ public void addTargetCore(FlagState fstate,
+ Integer targetCore) {
if(this.targetCores == null) {
this.targetCores = new Hashtable<FlagState, Queue<Integer>>();
}
// which reflects probabilities.
}
- public void addTargetCore(FlagState fstate,
- Integer targetCore,
- FlagState tfstate) {
+ public void addTargetCore(FlagState fstate,
+ Integer targetCore,
+ FlagState tfstate) {
if(this.targetCores == null) {
this.targetCores = new Hashtable<FlagState, Queue<Integer>>();
}
this.targetFState.put(fstate, tfstate);
}
- public void addAllyCore(FlagState fstate,
- Integer targetCore) {
+ public void addAllyCore(FlagState fstate,
+ Integer targetCore) {
if(this.allyCores == null) {
this.allyCores = new Hashtable<FlagState, Vector<Integer>>();
}
this.allyCores.put(fstate, new Vector<Integer>());
}
if((this.coreNum != targetCore.intValue()) && (!this.allyCores.get(fstate).contains(targetCore))) {
- this.allyCores.get(fstate).add(targetCore); // there may have some duplicate items,
- // which reflects probabilities.
+ this.allyCores.get(fstate).add(targetCore);
}
}
- public void addFState4TD(TaskDescriptor td,
- FlagState fstate) {
+ public void addFState4TD(TaskDescriptor td,
+ FlagState fstate) {
if(this.td2fs == null) {
this.td2fs = new Hashtable<TaskDescriptor, Vector<FlagState>>();
}
this.td2fs.put(td, new Vector<FlagState>());
}
if(!this.td2fs.get(td).contains(fstate)) {
- this.td2fs.get(td).add(fstate);
+ this.td2fs.get(td).addElement(fstate);
}
}
public void addTask(TaskDescriptor task) {
if(this.tasks == null) {
this.tasks = new Vector<TaskDescriptor>();
+ this.td2num = new Hashtable<TaskDescriptor, Integer>();
}
if(!this.tasks.contains(task)) {
this.tasks.add(task);
+ this.td2num.put(task, 1);
+ } else {
+ this.td2num.put(task, this.td2num.get(task).intValue()+1);
}
}
-}
\ No newline at end of file
+
+ public int getTaskNum(TaskDescriptor task) {
+ return this.td2num.get(task);
+ }
+}