package simizer.processor.tasks;

import simizer.VM;

/**
 * This class is used for simulating a Task on a given node. It takes the
 * quantity of instructions to process. Pass it to the processor to begin
 * execution.
 *
 * @author Sylvain Lefebvre
 */
public abstract class Task {

  private TaskStatus status = TaskStatus.RUNNING;

  private TaskSession ts;

  public Task(TaskSession ts) {
    this.ts = ts;
  }

  public TaskSession getTaskSession() {
    return ts;
  }

  public void setTaskSession(TaskSession ts) {
    this.ts = ts;
  }

  public abstract void startTask(VM vm, long timestamp);

  public void finishTask() {
    this.status = TaskStatus.FINISHED;
  }

  public TaskStatus getStatus() {
    return this.status;
  }
}

@@ -58,165 +58,367 @@
 %0A * 
-This class is used for simulating a Task on a given node. It
+Simulates a task on a VM.%0A * %3Cp%3E%0A * The concrete subclasses of this class will handle the various
  ta
+s
 k
-e
 s th
-e%0A * quantity of instructions to process. Pass it to the processor to begin%0A * execution
+at need%0A * to happen to fulfill a request.  Examples of subclasses include %7B@link%0A * DiskTask%7D for reading from a file system, %7B@link SendTask%7D for sending a%0A * message across a network, and %7B@link ProcTask%7D to represent some%0A * processor-intensive task
 .%0A *
@@ -480,16 +480,57 @@
 Task %7B%0A%0A
+  /** The current status of the task. */%0A
   privat
@@ -578,348 +578,1637 @@
 %0A%0A  
-private TaskSession ts;%0A%0A  public Task(TaskSession ts) %7B%0A    this.ts = ts;%0A  %7D%0A%0A  public TaskSession getTaskSession() %7B%0A    return ts;%0A  %7D%0A%0A  public void setTaskSession(TaskSession ts) %7B%0A    this.ts = ts;%0A  %7D%0A%0A  public abstract void startTask(VM vm, long timestamp);%0A%0A  public void finishTask() %7B%0A    this.status = TaskStatus.FINISHED;%0A  %7D%0A
+/** The %7B@code TaskSession%7D containing this task. */%0A  private TaskSession ts;%0A%0A  /**%0A   * Initializes a new Task.%0A   *%0A   * @param ts the corresponding %7B@link TaskSession%7D%0A   */%0A  public Task(TaskSession ts) %7B%0A    this.ts = ts;%0A  %7D%0A%0A  /**%0A   * Returns the %7B@code TaskSession%7D associated with this %7B@code Task%7D.%0A   *%0A   * @return the %7B@code TaskSession%7D associated with this %7B@code Task%7D%0A   */%0A  public TaskSession getTaskSession() %7B%0A    return ts;%0A  %7D%0A%0A  /**%0A   * Changes the %7B@code TaskSession%7D associated with this task.%0A   *%0A   * @param ts the new %7B@code TaskSession%7D%0A   */%0A  public void setTaskSession(TaskSession ts) %7B%0A    this.ts = ts;%0A  %7D%0A%0A  /**%0A   * Starts the %7B@code Task%7D on the specified %7B@code VM%7D.%0A   * %3Cp%3E%0A   * The specified behavior is depends on the subclass.  Tasks are given access%0A   * to the %7B@link VM%7D and all of its subsystems (processor, memory, networking,%0A   * etc.) to be able to complete their task.%0A   *%0A   * @param vm the %7B@code VM%7D on which to execute this %7B@code Task%7D%0A   * @param timestamp the time when the execution starts (to schedule events)%0A   */%0A  public abstract void startTask(VM vm, long timestamp);%0A%0A  /**%0A   * Finishes the current %7B@code Task%7D, starting the next %7B@code Task%7D.%0A   * %3Cp%3E%0A   * This method will schedule the execution of the next %7B@code Task%7D, as%0A   * appropriate.  Therefore, it is %3Cb%3Eessential%3C/b%3E that this method is called%0A   * to ensure the proper execution of the subsequent tasks.%0A   */%0A  public void finishTask() %7B%0A    this.status = TaskStatus.FINISHED;%0A  %7D%0A%0A  /**%0A   * Returns the status of the %7B@code Task%7D.%0A   *%0A   * @return the status of the %7B@code Task%7D%0A   */
 %0A  p

Add comments describing the Task class.