start of new file
[IRC.git] / Robust / src / Analysis / Scheduling / Schedule.java
index 90c058eb835b718bd77132b5d9ee5abf3722bee0..a04c629b64419f056a9d37394d1256c22e131e47 100644 (file)
@@ -14,7 +14,9 @@ public class Schedule {
     private int coreNum;
     private Vector<TaskDescriptor> tasks;
     private Hashtable<FlagState, Queue<Integer>> targetCores;
-    private Hashtable<FlagState, FlagState> targetFState;
+    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) {
        super();
@@ -22,6 +24,8 @@ public class Schedule {
        this.tasks = null;
        this.targetCores = null;
        this.targetFState = null;
+       this.allyCores = null;
+       this.td2fs = null;
     }
 
     public int getCoreNum() {
@@ -49,15 +53,38 @@ public class Schedule {
        }
        return targetFState.get(fstate);
     }
+    
+    public Hashtable<FlagState, Vector<Integer>> getAllyCoreTable() {
+        return this.allyCores;
+    }
+    
+    public Vector<Integer> getAllyCores(FlagState fstate) {
+       if(this.allyCores == null) {
+           return null;
+       }
+       return this.allyCores.get(fstate);
+    }
+    
+    public Hashtable<TaskDescriptor, Vector<FlagState>> getTd2FsTable() {
+        return this.td2fs;
+    }
+    
+    public Vector<FlagState> getFStates4TD(TaskDescriptor td) {
+       if(this.td2fs == null) {
+           return null;
+       }
+       return this.td2fs.get(td);
+    }
 
-    public void addTargetCore(FlagState fstate, Integer targetCore/*, Integer num*/) {
+    public void addTargetCore(FlagState fstate, Integer targetCore) {
        if(this.targetCores == null) {
            this.targetCores = new Hashtable<FlagState, Queue<Integer>>();
        }
        if(!this.targetCores.containsKey(fstate)) {
            this.targetCores.put(fstate, new LinkedList<Integer>());
        }
-       this.targetCores.get(fstate).add(targetCore);
+       this.targetCores.get(fstate).add(targetCore); // there may have some duplicate items,
+                                                     // which reflects probabilities.
     }
     
     public void addTargetCore(FlagState fstate, Integer targetCore, FlagState tfstate) {
@@ -73,6 +100,31 @@ public class Schedule {
        }
        this.targetFState.put(fstate, tfstate);
     }
+    
+    public void addAllyCore(FlagState fstate, Integer targetCore) {
+       if(this.allyCores == null) {
+           this.allyCores = new Hashtable<FlagState, Vector<Integer>>();
+       }
+       if(!this.allyCores.containsKey(fstate)) {
+           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.
+       }
+    }
+    
+    public void addFState4TD(TaskDescriptor td, FlagState fstate) {
+       if(this.td2fs == null) {
+           this.td2fs = new Hashtable<TaskDescriptor, Vector<FlagState>>();
+       }
+       if(!this.td2fs.containsKey(td)) {
+           this.td2fs.put(td, new Vector<FlagState>());
+       }
+       if(!this.td2fs.get(td).contains(fstate)) {
+           this.td2fs.get(td).add(fstate);
+       }
+    }
 
     public Vector<TaskDescriptor> getTasks() {
         return tasks;
@@ -85,5 +137,5 @@ public class Schedule {
        if(!this.tasks.contains(task)) {
            this.tasks.add(task);
        }
-    } 
+    }    
 }
\ No newline at end of file