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;
17 @SuppressWarnings("unchecked")
18 public synchronized ListeTask clone() {
19 ListeTask l = new ListeTask();
20 l.liste = (Vector<TaskId>) liste.clone();
26 public synchronized void addTask(TaskId tsk) {
27 liste.addElement(tsk);
30 public synchronized TaskId getTaskIdOfHostStub(JaceInterface hostStub) {
32 if (liste.isEmpty()) {
35 is = existHostStub(hostStub);
37 return (TaskId) liste.get(is);
40 .println("There is no task affected to this host stub !");
46 public synchronized TaskId getTaskIdOfRank(int rank) {
48 if (liste.isEmpty()) {
53 return (TaskId) liste.get(is);
55 System.err.println("TaskId of rank=" + rank + " doesn't exist");
62 public synchronized int getSize() {
66 private synchronized int existHostStub(JaceInterface host) {
69 while ((existe == -1) && (index < liste.size())) {
70 if (host.equals(((TaskId) liste.get(index)).getHostStub())) {
78 private synchronized int existRank(int rank) {
81 while ((existe == -1) && (index < liste.size())) {
82 if (((TaskId) liste.get(index)).getRank() == rank) {
90 public synchronized TaskId get(int i) {
91 return (TaskId) liste.get(i);
94 public synchronized void viewAll() {
95 TaskId maTaskId = null;
96 System.out.println("** Tasks **\n");
97 if (liste.size() == 0) {
98 System.out.println("No task");
100 for (int i = 0; i < liste.size(); i++) {
102 System.out.println("\tTaskId " + i + ", rank : "
103 + maTaskId.getRank() + ", hostName : "
104 + maTaskId.getHostName());
108 System.out.println("***** *****\n");