changes.
[IRC.git] / Robust / src / Analysis / Scheduling / TransTaskSimulator.java
1 package Analysis.Scheduling;
2
3 import java.util.Queue;
4
5 public class TransTaskSimulator extends TaskSimulator {
6   private int targetCoreNum;
7   private Queue<ObjectInfo> newObjs;
8
9   public TransTaskSimulator(CoreSimulator cs,
10                             int targetCoreNum,
11                             Queue<ObjectInfo> nobjs) {
12     super(null, cs);
13     this.targetCoreNum = targetCoreNum;
14     this.newObjs = nobjs;
15   }
16
17   public void process() {
18     if(this.currentRun == null) {
19       this.currentRun = new ExeResult();
20     }
21
22     this.currentRun.finishTime = 1 * sizeof(this.newObjs.peek().obj.getCd());
23   }
24
25   public ObjectInfo refreshTask() {
26     return this.newObjs.poll();
27   }
28
29   private int sizeof(Object obj) {
30     return 1;
31   }
32
33   public boolean isFinished() {
34     return this.newObjs.isEmpty();
35   }
36
37   public int getTargetCoreNum() {
38     return targetCoreNum;
39   }
40
41   public Queue<ObjectInfo> getNewObjs() {
42     return newObjs;
43   }
44
45 }