package simizer.processor.tasks;

import simizer.VM;
import simizer.processor.events.IOTaskEvent;
import simizer.storage.IOType;
import simizer.storage.Resource;

/**
 * Task for reading or writing data to a disk.
 *
 * @author isep
 */
public class DiskTask extends IOTask {

  private final IOType type;
  private final Resource r;

  public DiskTask(int sz, Resource res, IOType type) {
    super(sz);

    this.r = res;
    this.type = type;
  }

  public IOType getType() {
    return type;
  }

  public Resource getResource() {
    return r;
  }

  /**
   * Registers an IOTaskEvent through the given virtual machine event producer.
   *
   * @param vm
   * @param timestamp
   */
  @Override
  public void startTask(VM vm, long timestamp) {
    long timing = vm.getTaskLength(this);

    vm.registerEvent(
        new IOTaskEvent(timestamp + timing, this, vm.getProcessingUnit()));
  }
}

@@ -46,16 +46,56 @@
 zer.VM;%0A
+import simizer.processor.TaskProcessor;%0A
 import s
@@ -207,17 +207,19 @@
 %0A * 
-T
+A t
 ask for 
 read
@@ -218,160 +218,838 @@
 for 
-reading or writing data to a disk.%0A *%0A * @author isep%0A */%0Apublic class DiskTask extends IOTask %7B%0A%0A  private final IOType type;%0A  private final R
+writing/reading data to/from a disk.%0A * %3Cp%3E%0A * Simulates the latency present in reading/writing files from a disk.  Because%0A * the processor is free to perform other tasks while the %7B@code StorageElement%7D%0A * is retrieving data, this %7B@code Task%7D can run in parallel with%0A * processor-intensive tasks.%0A */%0Apublic class DiskTask extends IOTask %7B%0A%0A  /** The resource to read or write. */%0A  private final Resource resource;%0A%0A  /** The type of action to take with the resource. */%0A  private final IOType type;%0A%0A  /**%0A   * Initializes a new %7B@code DiskTask%7D.%0A   * %3Cp%3E%0A   * When run, this task will simulate performing the specified action on the%0A   * specified resource, and it will send an %7B@link IOTaskEvent%7D upon%0A   * completion.%0A   *%0A   * @param size the size of the resource being modified%0A   * @param resource the actual r
 esource 
 r;%0A%0A
@@ -1044,19 +1044,111 @@
 esource 
-r;%0A
+being modified%0A   * @param type the type of action that should be taken with the resource%0A   */
 %0A  publi
@@ -1163,17 +1163,19 @@
 sk(int s
-z
+ize
 , Resour
@@ -1180,16 +1180,21 @@
 urce res
+ource
 , IOType
@@ -1213,17 +1213,19 @@
  super(s
-z
+ize
 );%0A%0A    
@@ -1234,14 +1234,26 @@
 is.r
+esource
  = res
+ource
 ;%0A  
@@ -1283,55 +1283,383 @@
 %0A%0A  
-public IOType getType() %7B%0A    return type;%0A  %7D%0A
+/**%0A   * Returns the type of operation that will be taken with the %7B@code Task%7D.%0A   *%0A   * @return the type of operation that will be taken with the %7B@code Task%7D%0A   */%0A  public IOType getType() %7B%0A    return type;%0A  %7D%0A%0A  /**%0A   * Returns the resource that will be modified with the %7B@code Task%7D.%0A   *%0A   * @return the resource that will be modified with the %7B@code Task%7D%0A   */
 %0A  p
@@ -1701,16 +1701,23 @@
 return r
+esource
 ;%0A  %7D%0A%0A 
@@ -1730,124 +1730,312 @@
   * 
-Registers an IOTaskEvent through the given virtual machine event producer.%0A   *%0A   * @param vm%0A   * @param timestamp
+%7B@inheritDoc%7D%0A   * %3Cp%3E%0A   * When the task is complete, it triggers an event of type %7B@link%0A   * IOTaskEvent%7D.  (The event is given the %7B@link TaskProcessor%7D for the%0A   * specified %7B@link VM%7D.)%0A   *%0A   * @param vm the %7B@code VM%7D on which the task is run%0A   * @param timestamp the time when the task is run
 %0A   

Add documentation to the DiskTask class.