コード例 #1
0
 public boolean isDefined() {
   for (int i = 0; i < taskQueue.size(); i++) {
     IMonitorableTask task = (IMonitorableTask) taskQueue.get(i);
     if (!task.isDefined()) return false;
   }
   return true;
 }
コード例 #2
0
 public void run() throws Exception {
   System.out.println("lanzando procesos encolados...");
   Iterator taskIterator = taskQueue.iterator();
   while (taskIterator.hasNext() && (!canceled)) {
     currentTask = (IMonitorableTask) taskIterator.next();
     System.out.println("proceso " + currentTask.toString());
     currentTask.run();
   }
   System.out.println("Se finalizo la cola de procesos");
 }
コード例 #3
0
 public int getFinishStep() {
   int lastStep = 0;
   if (isDefined()) {
     for (int i = 0; i < taskQueue.size(); i++) {
       IMonitorableTask task = (IMonitorableTask) taskQueue.get(i);
       lastStep += task.getFinishStep();
     }
   } else {
     lastStep += taskQueue.size();
   }
   return lastStep;
 }
コード例 #4
0
 public String getNote() {
   if (currentTask != null) {
     return currentTask.getNote();
   } else {
     return "";
   }
 }
コード例 #5
0
 public String getStatusMessage() {
   if (currentTask != null) {
     return currentTask.getStatusMessage();
   } else {
     return "Waiting for new tasks...";
   }
 }
コード例 #6
0
  public int getCurrentStep() {
    int currentStep = 0;

    for (int i = 0; i < taskQueue.size(); i++) {
      IMonitorableTask task = (IMonitorableTask) taskQueue.get(i);

      if (task == currentTask) {
        if (isDefined()) {
          currentStep += currentTask.getCurrentStep();

        } else {
          currentStep = i;
        }
        break;
      } else {
        if (isDefined()) currentStep += currentTask.getFinishStep();
      }
    }
    return currentStep++;
  }
コード例 #7
0
 public boolean isFinished() {
   if (currentTask != null) {
     return currentTask.isFinished();
   }
   return false;
 }
コード例 #8
0
 public void cancel() {
   if (currentTask != null) {
     currentTask.cancel();
   }
   canceled = true;
 }