Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge commit '4df273f15273f959fc9e6ed69d2bf5e607ec9bf7' into HEAD
[simgrid.git] / org / simgrid / msg / Task.java
index 41f064a..a81e8fc 100644 (file)
@@ -1,12 +1,10 @@
 /*
- * simgrid.msg.Task.java       1.00 07/05/01
- *
- * Copyright 2006,2007 Martin Quinson, Malek Cherier           
+ * Copyright 2006-2012 The SimGrid Team.           
  * All right reserved. 
  *
  * This program is free software; you can redistribute 
  * it and/or modify it under the terms of the license 
- *(GNU LGPL) which comes with this package. 
+ * (GNU LGPL) which comes with this package.
  */
 
 package org.simgrid.msg;
@@ -22,8 +20,11 @@ public class Task {
         * a native task. Even if this attribute is public you must never
         * access to it. It is set automatically during the build of the object.
         */
-       public long bind = 0;
-
+       private long bind = 0;
+       /**
+        * Task name
+        */
+       protected String name;
 
        /** Default constructor (all fields to 0 or null) */
        public Task() {
@@ -98,12 +99,14 @@ public class Task {
        /* *                   * *
         * * Getters / Setters * *
         * *                   * */
-    /** Gets the name of a task
-     * FIXME: Cache it.
-     * @return
+    /** 
+     * Gets the name of a task
      */
-       public native String getName();
-       /** Gets the sender of the task 
+       public String getName() {
+               return name;
+       }
+       /**
+        * Gets the sender of the task 
         * Returns null if the task hasn't been sent yet
         */
        public native Process getSender();
@@ -118,6 +121,11 @@ public class Task {
        /** Gets the remaining computation of the task
      */
        public native double getRemainingDuration();
+       /**
+        * Sets the name of the task
+        * @param name the new task name.c
+        */
+       public native void setName(String name);
        /**
         * This method sets the priority of the computation of the task.
         * The priority doesn't affect the transfer rate. For example a
@@ -127,11 +135,11 @@ public class Task {
         * @param priority      The new priority of the task.
         */ 
        public native void setPriority(double priority);
-       /* *                       * *
-        * * Communication-related * *
-        * *                       * */
-
-
+       /**
+        * Set the computation amount needed to process the task
+        * @param computationAmount the amount of computation needed to process the task
+        */
+       public native void setComputeDuration(double computationAmount);
        /* *                     * *
         * * Computation-related * *
         * *                     * */
@@ -159,6 +167,9 @@ public class Task {
         * The natively implemented method to destroy a MSG task.
         */
        protected native void destroy();
+       /* *                       * *
+        * * Communication-related * *
+        * *                       * */
 
        /** Send the task asynchronously on the mailbox identified by the specified name, 
         *  with no way to retrieve whether the communication succeeded or not
@@ -266,6 +277,7 @@ public class Task {
         */
        public static native void nativeInit();
        static {
+               Msg.nativeInit();
                nativeInit();
        }
 }