1 package Analysis.Scheduling;
3 import java.util.Hashtable;
4 import java.util.LinkedList;
5 import java.util.Queue;
6 import java.util.Vector;
8 import Analysis.TaskStateAnalysis.FlagState;
9 import IR.TaskDescriptor;
11 /** This class holds flag transition diagram(s) can be put on one core.
13 public class Schedule {
15 private Vector<TaskDescriptor> tasks;
16 private Hashtable<FlagState, Queue<Integer>> targetCores;
17 private Hashtable<FlagState, FlagState> targetFState;
19 public Schedule(int coreNum) {
21 this.coreNum = coreNum;
23 this.targetCores = null;
24 this.targetFState = null;
27 public int getCoreNum() {
31 public Hashtable<FlagState, Queue<Integer>> getTargetCoreTable() {
35 public Queue<Integer> getTargetCores(FlagState fstate) {
36 if(targetCores == null) {
39 return targetCores.get(fstate);
42 public Hashtable<FlagState, FlagState> getTargetFStateTable() {
46 public FlagState getTargetFState(FlagState fstate) {
47 if(targetFState == null) {
50 return targetFState.get(fstate);
53 public void addTargetCore(FlagState fstate, Integer targetCore/*, Integer num*/) {
54 if(this.targetCores == null) {
55 this.targetCores = new Hashtable<FlagState, Queue<Integer>>();
57 if(!this.targetCores.containsKey(fstate)) {
58 this.targetCores.put(fstate, new LinkedList<Integer>());
60 this.targetCores.get(fstate).add(targetCore);
63 public void addTargetCore(FlagState fstate, Integer targetCore, FlagState tfstate) {
64 if(this.targetCores == null) {
65 this.targetCores = new Hashtable<FlagState, Queue<Integer>>();
67 if(!this.targetCores.containsKey(fstate)) {
68 this.targetCores.put(fstate, new LinkedList<Integer>());
70 this.targetCores.get(fstate).add(targetCore);
71 if(this.targetFState == null) {
72 this.targetFState = new Hashtable<FlagState, FlagState>();
74 this.targetFState.put(fstate, tfstate);
77 public Vector<TaskDescriptor> getTasks() {
81 public void addTask(TaskDescriptor task) {
82 if(this.tasks == null) {
83 this.tasks = new Vector<TaskDescriptor>();
85 if(!this.tasks.contains(task)) {