3 import java.util.Vector;
5 public class ListeTask implements java.io.Serializable, java.lang.Cloneable
7 private static final long serialVersionUID = 1L ;
10 protected Vector<TaskId> liste = new Vector<TaskId>() ;
11 protected TaskId task ;
16 @SuppressWarnings("unchecked")
17 public synchronized ListeTask clone() {
18 ListeTask l = new ListeTask();
19 l.liste = (Vector<TaskId>) liste.clone();
25 public synchronized void addTask(TaskId tsk) {
26 liste.addElement(tsk);
29 public synchronized TaskId getTaskIdOfHostStub(JaceInterface hostStub) {
31 if (liste.isEmpty()) {
34 is = existHostStub(hostStub);
36 return (TaskId) liste.get(is);
39 .println("There is no task affected to this host stub !");
45 public synchronized TaskId getTaskIdOfRank(int rank) {
47 if (liste.isEmpty()) {
52 return (TaskId) liste.get(is);
54 System.err.println("TaskId of rank=" + rank + " doesn't exist");
61 public synchronized int getSize() {
65 private synchronized int existHostStub(JaceInterface host) {
68 while ((existe == -1) && (index < liste.size())) {
69 if (host.equals(((TaskId) liste.get(index)).getHostStub())) {
77 private synchronized int existRank(int rank) {
80 while ((existe == -1) && (index < liste.size())) {
81 if (((TaskId) liste.get(index)).getRank() == rank) {
89 public synchronized TaskId get(int i) {
90 return (TaskId) liste.get(i);
93 public synchronized void viewAll() {
94 TaskId maTaskId = null;
95 System.out.println("** Tasks **\n");
96 if (liste.size() == 0) {
97 System.out.println("No task");
99 for (int i = 0; i < liste.size(); i++) {
101 System.out.println("\tTaskId " + i + ", rank : "
102 + maTaskId.getRank() + ", hostName : "
103 + maTaskId.getHostName());
107 System.out.println("***** *****\n");