package simizer.processor.tasks;

import simizer.Node;
import simizer.VM;
import simizer.requests.Request;

/**
 * This is default request sending task. It does not wait for an answer. There
 * are three ways of sending requests
 *
 *
 * @author Sylvain Lefebvre
 */
public class SendTask extends IOTask {

  private final Request r;
  private final Node dest;

  public SendTask(Request r, Node dest) {
    super(r.getSize());

    this.r = r;
    this.dest = dest;
  }

  public Request getRequest() {
    return this.r;
  }

  public Node getTgt() {
    return dest;
  }

  @Override
  public void startTask(VM vm, long timestamp) {
    if (r.getArTime() == -1) {
      r.setArtime(timestamp);
    } else {
      r.setFinishTime(timestamp);
    }

    TaskSession ts = super.getTaskSession();
    if (ts.isComplete()) {
      vm.endTaskSession(ts, timestamp);
    }
    vm.send(dest, r, timestamp);
  }
}

@@ -112,124 +112,412 @@
 %0A * 
-This is default request sending task. It does not wait for an answer. There%0A * are three ways of sending requests%0A *
+A task to send a request through a %7B@code VM%7D.%0A * %3Cp%3E%0A * When this %7B@code Task%7D is executed, it schedules its %7B@link Request%7D to be%0A * sent by the %7B@link VM%7D running it.%0A * %3Cp%3E%0A * After scheduling / sending the message (both happen in the same instant), the%0A * next %7B@code Task%7D is started.  This %7B@code Task%7D does not wait for any sort%0A * of a network response before moving on to the next %7B@code Task%7D.
 %0A *%0A
@@ -613,16 +613,22 @@
 equest r
+equest
 ;%0A  priv
@@ -646,18 +646,366 @@
 ode dest
-;%0A
+ination;%0A%0A  /**%0A   * Initializes a new %7B@code Task%7D to send a request.%0A   * %3Cp%3E%0A   * The specified %7B@link Request%7D will be sent from the %7B@link VM%7D executing%0A   * the request to the specified %7B@link Node%7D when the %7B@code Task%7D is%0A   * executed.%0A   *%0A   * @param request the request to send%0A   * @param destination the destination of the request%0A   */
 %0A  publi
@@ -1024,16 +1024,22 @@
 equest r
+equest
 , Node d
@@ -1041,16 +1041,23 @@
 ode dest
+ination
 ) %7B%0A    
@@ -1063,16 +1063,22 @@
  super(r
+equest
 .getSize
@@ -1097,96 +1097,609 @@
 is.r
- = r;%0A    this.dest = dest;%0A  %7D%0A%0A  public Request getRequest() %7B%0A    return this.r;%0A  %7D%0A
+equest = request;%0A    this.destination = destination;%0A  %7D%0A%0A  /**%0A   * Returns the request that will be sent.%0A   *%0A   * @return the request that will be sent%0A   */%0A  public Request getRequest() %7B%0A    return request;%0A  %7D%0A%0A  /**%0A   * Returns the destination where the request will be sent.%0A   *%0A   * @return the destination of the request%0A   */%0A%0A  public Node getDestination() %7B%0A    return destination;%0A  %7D%0A%0A  /**%0A   * Returns the destination where the request will be sent.%0A   *%0A   * @deprecated Use %7B@link #getDestination()%7D instead.%0A   *%0A   * @return the destination of the request%0A   */%0A  @Deprecated
 %0A  p
@@ -1735,23 +1735,430 @@
 urn dest
+ination
 ;%0A  %7D%0A%0A
+  /**%0A   * %7B@inheritDoc%7D%0A   * %3Cp%3E%0A   * In this class, the behavior is to send a %7B@link Request%7D over the network.%0A   * This can be useful, for example, in order to schedule a network operation%0A   * to occur after some processing or disk operation has been completed.%0A   * %0A   * @param vm the virtual machine executing the request%0A   * @param timestamp the time when the %7B@code Task%7D is started%0A   */%0A
   @Overr
@@ -2219,16 +2219,22 @@
    if (r
+equest
 .getArTi
@@ -2250,24 +2250,30 @@
 1) %7B%0A      r
+equest
 .setArtime(t
@@ -2303,16 +2303,22 @@
 %0A      r
+equest
 .setFini
@@ -2481,11 +2481,24 @@
 dest
-, r
+ination, request
 , ti

Add documentation to the SendTask class.