/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
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()));
    }
}

@@ -1,104 +1,4 @@
-/*%0A * To change this template, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0A
 pack
@@ -162,17 +162,16 @@
 %0A%0A/**%0A *
- 
  Task fo
@@ -207,16 +207,19 @@
 a disk.%0A
+ *%0A
  * @auth
@@ -269,18 +269,17 @@
 OTask %7B%0A
-  
+%0A
   privat
@@ -301,18 +301,16 @@
 type;%0A  
-  
 private 
@@ -327,23 +327,17 @@
 urce r;%0A
-    %0A  
+%0A
   public
@@ -387,20 +387,16 @@
 ) %7B%0A    
-    
 super(sz
@@ -402,20 +402,9 @@
 z);%0A
-        %0A   
+%0A
     
@@ -421,19 +421,16 @@
 es;%0A    
-   
 this.typ
@@ -445,26 +445,11 @@
 ;%0A  
-    %0A    %7D%0A    %0A  
+%7D%0A%0A
   pu
@@ -468,28 +468,24 @@
 getType() %7B%0A
-    
     return t
@@ -491,22 +491,19 @@
 type;%0A  
-  
 %7D%0A
-  
+%0A
   public
@@ -532,20 +532,16 @@
 ) %7B%0A    
-    
 return r
@@ -548,22 +548,17 @@
 ;%0A  
-  %7D%0A  
+%7D%0A%0A
   /**%0A
-  
    *
@@ -622,23 +622,16 @@
 ne event
-%0A     *
  produce
@@ -640,18 +640,13 @@
 %0A   
-  * 
+*
 %0A   
-  
 * @p
@@ -656,18 +656,16 @@
 m vm%0A   
-  
 * @param
@@ -678,20 +678,15 @@
 tamp
- %0A  
+%0A
    */%0A
-  
   @O
@@ -695,18 +695,16 @@
 rride%0A  
-  
 public v
@@ -746,19 +746,16 @@
 ) %7B%0A    
-   
 long tim
@@ -788,19 +788,9 @@
 s);%0A
-      %0A    
+%0A
     
@@ -806,16 +806,25 @@
 erEvent(
+%0A        
 new IOTa
@@ -844,16 +844,19 @@
 tamp
-+
+ + 
 timing,
+ 
 this
@@ -883,16 +883,14 @@
 it()));%0A
-  
   %7D%0A%7D%0A

Update DiskTask to conform to the GSG.