Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
reindent the java sources
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 5 Apr 2015 16:53:03 +0000 (18:53 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 5 Apr 2015 16:53:03 +0000 (18:53 +0200)
14 files changed:
src/bindings/java/org/simgrid/msg/As.java
src/bindings/java/org/simgrid/msg/Comm.java
src/bindings/java/org/simgrid/msg/File.java
src/bindings/java/org/simgrid/msg/Host.java
src/bindings/java/org/simgrid/msg/Msg.java
src/bindings/java/org/simgrid/msg/MsgException.java
src/bindings/java/org/simgrid/msg/Mutex.java
src/bindings/java/org/simgrid/msg/Process.java
src/bindings/java/org/simgrid/msg/RngStream.java
src/bindings/java/org/simgrid/msg/Semaphore.java
src/bindings/java/org/simgrid/msg/Storage.java
src/bindings/java/org/simgrid/msg/Task.java
src/bindings/java/org/simgrid/msg/VM.java
src/bindings/java/org/simgrid/trace/Trace.java

index e8a7a98..35248f8 100644 (file)
@@ -8,29 +8,29 @@ package org.simgrid.msg;
 
 public class As {
 
-    private long bind;
-    
-    protected As() {
+       private long bind;
+
+       protected As() {
        };
 
-    public String toString (){
-       return this.getName(); 
-    }
-    public native String getName();
+       public String toString (){
+               return this.getName(); 
+       }
+       public native String getName();
 
-    public native As[] getSons();
+       public native As[] getSons();
 
-    public native String getProperty(String name);
+       public native String getProperty(String name);
 
-    public native String getModel();
+       public native String getModel();
 
-    public native Host[] getHosts();
+       public native Host[] getHosts();
 
-    /**
-      * Class initializer, to initialize various JNI stuff
-      */
-    public static native void nativeInit();
-    static {
-       nativeInit();
-    }
+       /**
+        * Class initializer, to initialize various JNI stuff
+        */
+       public static native void nativeInit();
+       static {
+               nativeInit();
+       }
 }
index 672e702..ebe63fc 100644 (file)
@@ -68,7 +68,7 @@ public class Comm {
         * @param timeout Time before giving up
         */
        public native void waitCompletion(double timeout) throws TransferFailureException, HostFailureException, TimeoutException;
-               
+
        /**
         * Returns the task associated with the communication.
         * if the communication isn't finished yet, will return null.
index f0c78eb..bd19252 100644 (file)
@@ -44,7 +44,7 @@ public class File {
         * Close the file.      
         */
        public native void close();
-       
+
        /**
         * Class initializer, to initialize various JNI stuff
         */
index 07dace8..bfa1997 100644 (file)
@@ -58,17 +58,17 @@ public class Host {
         * User data.
         */ 
        private Object data;
-    /**
-     *
-     */
-    protected Host() {
+       /**
+        *
+        */
+       protected Host() {
                this.bind = 0;
                this.data = null;
        };
-       
+
        public String toString (){
                return this.name; 
-               
+
        }
 
        /**
@@ -78,11 +78,11 @@ public class Host {
         * @param name          The name of the host to get.
         *
         * @return              The host object with the given name.
-     * @exception              HostNotFoundException if the name of the host is not valid.
+        * @exception           HostNotFoundException if the name of the host is not valid.
         *                                      NativeException if the native version of this method failed.
         */ 
        public native static Host getByName(String name) 
-       throws HostNotFoundException, NullPointerException;
+                       throws HostNotFoundException, NullPointerException;
        /**
         * This static method returns the count of the installed hosts.
         *
@@ -105,18 +105,18 @@ public class Host {
         */ 
        public native static Host[] all();
 
-    /** 
-     * This static method sets a mailbox to receive in asynchronous mode.
-     * 
-     * All messages sent to this mailbox will be transferred to 
-     * the receiver without waiting for the receive call. 
-     * The receive call will still be necessary to use the received data.
-     * If there is a need to receive some messages asynchronously, and some not, 
-     * two different mailboxes should be used.
-     *
-     * @param mailboxName The name of the mailbox
-     */
-    public static native void setAsyncMailbox(String mailboxName);
+       /** 
+        * This static method sets a mailbox to receive in asynchronous mode.
+        
+        * All messages sent to this mailbox will be transferred to 
+        * the receiver without waiting for the receive call. 
+        * The receive call will still be necessary to use the received data.
+        * If there is a need to receive some messages asynchronously, and some not, 
+        * two different mailboxes should be used.
+        *
+        * @param mailboxName The name of the mailbox
+        */
+       public static native void setAsyncMailbox(String mailboxName);
 
 
        /**
@@ -130,25 +130,25 @@ public class Host {
 
        /**
         * Sets the data of the host.
-     * @param data
-     */
+        * @param data
+        */
        public void setData(Object data) {
                this.data = data;
        } 
        /**
         * Gets the data of the host.
-     *
-     * @return The data object associated with the host.
-     */
+        *
+        * @return The data object associated with the host.
+        */
        public Object getData() {
                return this.data;
        }
 
        /**
         * Checks whether a host has data.
-     *
-     * @return True if the host has an associated data object.
-     */
+        *
+        * @return True if the host has an associated data object.
+        */
        public boolean hasData() {
                return null != this.data;
        }
@@ -193,28 +193,28 @@ public class Host {
         * Returns the value of a given host property. 
         */
        public native String getProperty(String name);
-       
+
        /**
         * Change the value of a given host property. 
         */
        public native void setProperty(String name, String value);
-    
+
        /** This method tests if a host is up and running.
         * @return True if the host is available.
         */
        public native boolean isOn();
 
        /** This methods returns the list of mount point names on an host
-     * @return An array containing all mounted storages on the host
-     */
+        * @return An array containing all mounted storages on the host
+        */
        public native Storage[] getMountedStorage();
 
        /** This methods returns the list of storages attached to an host
-     * @return An array containing all storages (name) attached to the host
-     */
+        * @return An array containing all storages (name) attached to the host
+        */
        public native String[] getAttachedStorage();
-       
-       
+
+
        /**
         * Class initializer, to initialize various JNI stuff
         */
index 6cdc894..8153a42 100644 (file)
@@ -9,11 +9,6 @@
 package org.simgrid.msg;
 import org.simgrid.NativeLib;
 
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.File;
-
 
 public final class Msg {
        /* Statically load the library which contains all native functions used in here */
index 166d5e3..bebfe32 100644 (file)
@@ -19,21 +19,21 @@ package org.simgrid.msg;
  *  -->
  */
 public abstract class MsgException extends Exception {
-  private static final long serialVersionUID = 1L;
+       private static final long serialVersionUID = 1L;
 
-  /**
-   * Constructs an <code>MsgException</code> without a 
-   * detail message. 
-   */
-  public MsgException() {
-    super();
-  }
-  /**
-   * Constructs an <code>MsgException</code> with a detail message. 
-   *
-   * @param   s   the detail message.
-   */ 
-  public MsgException(String s) {
-    super(s);
-  }
+       /**
+        * Constructs an <code>MsgException</code> without a 
+        * detail message. 
+        */
+       public MsgException() {
+               super();
+       }
+       /**
+        * Constructs an <code>MsgException</code> with a detail message. 
+        *
+        * @param   s   the detail message.
+        */ 
+       public MsgException(String s) {
+               super(s);
+       }
 }
index 96dca06..fbcb634 100644 (file)
@@ -12,7 +12,7 @@ package org.simgrid.msg;
  */
 public class Mutex {
        private long bind; // The C object -- don't touch it
-       
+
        public Mutex() {
                init();
        }
@@ -23,7 +23,7 @@ public class Mutex {
        private native void init();
        public native void acquire();
        public native void release();
-       
+
        /**
         * Class initializer, to initialize various JNI stuff
         */
index d5678d7..abfcef9 100644 (file)
@@ -5,7 +5,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 package org.simgrid.msg;
+
 import java.util.Arrays;
 import java.util.Vector;
 
@@ -56,14 +56,14 @@ public abstract class Process implements Runnable {
         * It is used to compute the id of an MSG process.
         */
        public static long nextProcessId = 0;
-       
+
        /**
         * Even if this attribute is public you must never access to it.
         * It is compute automatically during the creation of the object. 
         * The native functions use this identifier to synchronize the process.
         */
        public long id;
-       
+
        /**
         * Start time of the process
         */
@@ -72,14 +72,14 @@ public abstract class Process implements Runnable {
         * Kill time of the process
         */
        public double killTime = -1;
-       
+
        /**
         * The name of the process.                                                     
         */
        protected String name;
        /**
-         * The PID of the process
-         */
+        * The PID of the process
+        */
        protected int pid = -1;
        /**
         * The PPID of the process 
@@ -93,7 +93,7 @@ public abstract class Process implements Runnable {
        /** The arguments of the method function of the process. */     
        public Vector<String> args;
 
-       
+
        /**
         * Default constructor
         */
@@ -128,8 +128,8 @@ public abstract class Process implements Runnable {
         * @param args                  The arguments of the main function of the process.
         *
         * @exception                   HostNotFoundException  if no host with this name exists.
-     *                      NativeException
-     * @throws NativeException
+        *                      NativeException
+        * @throws NativeException
         *
         */ 
        public Process(String hostname, String name, String args[]) throws HostNotFoundException, NativeException {
@@ -186,7 +186,7 @@ public abstract class Process implements Runnable {
                this.args = new Vector<String>();
                if (null != args)
                        this.args.addAll(Arrays.asList(args));
-                               
+
                this.startTime = startTime;
                this.killTime = killTime;               
        }
@@ -291,13 +291,13 @@ public abstract class Process implements Runnable {
         * Returns the value of a given process property. 
         */
        public native String getProperty(String name);
-       
+
        /**
         * Set the kill time of the process
         * @param killTime the time when the process is killed
         */
        public native void setKillTime(double killTime);
-       
+
        /**
         * This static method returns the currently running process.
         *
@@ -336,27 +336,27 @@ public abstract class Process implements Runnable {
         */ 
        public native void waitFor(double seconds) throws HostFailureException;    
        /**
-     *
-     */
-    public void showArgs() {
+        *
+        */
+       public void showArgs() {
                Msg.info("[" + this.name + "/" + this.getHost().getName() + "] argc=" +
                                this.args.size());
                for (int i = 0; i < this.args.size(); i++)
                        Msg.info("[" + this.msgName() + "/" + this.getHost().getName() +
                                        "] args[" + i + "]=" + this.args.get(i));
        }
-    /**
-     * This method actually creates and run the process.
-     * It is a noop if the process is already launched.
-     * @throws HostNotFoundException
-     */
-    public final void start() throws HostNotFoundException {
-       if (!started) {
-               started = true;
-               create(host.getName());
-       }
-    }
-    
+       /**
+        * This method actually creates and run the process.
+        * It is a noop if the process is already launched.
+        * @throws HostNotFoundException
+        */
+       public final void start() throws HostNotFoundException {
+               if (!started) {
+                       started = true;
+                       create(host.getName());
+               }
+       }
+
        /**
         * This method runs the process. Il calls the method function that you must overwrite.
         */
@@ -377,17 +377,17 @@ public abstract class Process implements Runnable {
                        Msg.info("Unexpected behavior. Stopping now");
                        System.exit(1);
                }
-                catch(ProcessKilledError pk) {
+               catch(ProcessKilledError pk) {
                }       
                exit();
        }
 
        /**
         * The main function of the process (to implement).
-     *
-     * @param args
-     * @throws MsgException
-     */
+        *
+        * @param args
+        * @throws MsgException
+        */
        public abstract void main(String[]args) throws MsgException;
 
        public native void exit();    
index 6d5638c..c7d3a5d 100644 (file)
@@ -51,7 +51,7 @@ public class RngStream {
         * Release the C RngStream object
         */
        private native void destroy();
-       
+
        /**
         * Sets the initial seed of the package RngStreams to the six integers in the vector seed. This will
         * be the seed (initial state) of the first stream. If this procedure is not called, the default initial
@@ -79,21 +79,21 @@ public class RngStream {
         */
        public native void setAntithetic(boolean a);
        /**
-         * Sets the initial seed Ig of stream g to the vector seed. This vector must satisfy the same
-         * conditions as in setPackageSeed. The stream is then reset to this initial seed. The
-         * states and seeds of the other streams are not modified. As a result, after calling this procedure,
-         * the initial seeds of the streams are no longer spaced Z values apart. We discourage the use of
-         * this procedure. Returns false for invalid seeds, and true otherwise.
+        * Sets the initial seed Ig of stream g to the vector seed. This vector must satisfy the same
+        * conditions as in setPackageSeed. The stream is then reset to this initial seed. The
+        * states and seeds of the other streams are not modified. As a result, after calling this procedure,
+        * the initial seeds of the streams are no longer spaced Z values apart. We discourage the use of
+        * this procedure. Returns false for invalid seeds, and true otherwise.
         */
        public native boolean setSeed(int seed[]);
        /**
-         * Advances the state of the stream by k values, without modifying the states of other streams (as
-         * in RngStream_SetSeed), nor the values of Bg and Ig associated with this stream. If e > 0, then
-         * k = 2e + c; if e < 0, then k = -2-e + c; and if e = 0, then k = c. Note: c is allowed to take
-         * negative values. We discourage the use of this procedure.    
-         */
+        * Advances the state of the stream by k values, without modifying the states of other streams (as
+        * in RngStream_SetSeed), nor the values of Bg and Ig associated with this stream. If e > 0, then
+        * k = 2e + c; if e < 0, then k = -2-e + c; and if e = 0, then k = c. Note: c is allowed to take
+        * negative values. We discourage the use of this procedure.     
+        */
        public native void advanceState(int e, int g);
-       
+
        /**
         * Returns a (pseudo)random number from the uniform distribution over the interval (0, 1), after advancing the state by one step. The returned number has 32 bits of precision
         * in the sense that it is always a multiple of 1/(232 - 208), unless RngStream_IncreasedPrecis
@@ -105,7 +105,7 @@ public class RngStream {
         * {i, i + 1, . . . , j}
         */
        public native int randInt(int i, int j);
-       
+
        /**
         * Class initializer, to initialize various JNI stuff
         */
index f8e4e14..d74a8bc 100644 (file)
@@ -12,73 +12,73 @@ package org.simgrid.msg;
  */
 
 public class Semaphore {
-    private long bind; // The C object -- don't touch it
-    /**
-     * Semaphore capacity, defined when the semaphore is created. At most capacity 
-     * process can acquire this semaphore at the same time.
-     */
-    protected final int capacity;
-    /**
-     * Creates a new semaphore with the given capacity. At most capacity 
-     * process can acquire this semaphore at the same time.
-     */
-    public Semaphore(int capacity) {
-       init(capacity);
-       this.capacity = capacity;
-    }
-    /** The native implementation of semaphore initialization
-     */
-    private native void init(int capacity);
+       private long bind; // The C object -- don't touch it
+       /**
+        * Semaphore capacity, defined when the semaphore is created. At most capacity 
+        * process can acquire this semaphore at the same time.
+        */
+       protected final int capacity;
+       /**
+        * Creates a new semaphore with the given capacity. At most capacity 
+        * process can acquire this semaphore at the same time.
+        */
+       public Semaphore(int capacity) {
+               init(capacity);
+               this.capacity = capacity;
+       }
+       /** The native implementation of semaphore initialization
+        */
+       private native void init(int capacity);
 
 
-    /** Locks on the semaphore object until the provided timeout expires
-     * @exception TimeoutException if the timeout expired before 
-     *            the semaphore could be acquired.
-     */
-    public native void acquire(double timeout) throws TimeoutException;
-    /** Locks on the semaphore object with no timeout
-     */
-    public void acquire() {
-       try {
-           acquire(-1);
-       } catch (TimeoutException e) {
-           // This should not happen.
-           assert(false);
+       /** Locks on the semaphore object until the provided timeout expires
+        * @exception TimeoutException if the timeout expired before 
+        *            the semaphore could be acquired.
+        */
+       public native void acquire(double timeout) throws TimeoutException;
+       /** Locks on the semaphore object with no timeout
+        */
+       public void acquire() {
+               try {
+                       acquire(-1);
+               } catch (TimeoutException e) {
+                       // This should not happen.
+                       assert(false);
+               }
        }
-    }
-    /** Releases the semaphore object
-     */
-    public native void release();
-    /** returns a boolean indicating it this semaphore would block at this very specific time
-     *
-     * Note that the returned value may be wrong right after the
-     * function call, when you try to use it...  But that's a
-     * classical semaphore issue, and SimGrid's semaphores are not
-     * different to usual ones here.
-     */
-    public native boolean wouldBlock();
+       /** Releases the semaphore object
+        */
+       public native void release();
+       /** returns a boolean indicating it this semaphore would block at this very specific time
+        *
+        * Note that the returned value may be wrong right after the
+        * function call, when you try to use it...  But that's a
+        * classical semaphore issue, and SimGrid's semaphores are not
+        * different to usual ones here.
+        */
+       public native boolean wouldBlock();
 
-    /** Returns the semaphore capacity
-     */
-    public int getCapacity(){
-       return this.capacity;
-    }
+       /** Returns the semaphore capacity
+        */
+       public int getCapacity(){
+               return this.capacity;
+       }
 
 
-    /** Deletes this semaphore 
-     */
-    protected void finalize() {
-       destroy();
-    }
-    /** The native implementation for destroying a semaphore
-     */
-    private native void destroy();
-    /**
-     * Class initializer, to initialize various JNI stuff
-     */
-    public static native void nativeInit();
-    static {
-       Msg.nativeInit();
-       nativeInit();
-    }
+       /** Deletes this semaphore 
+        */
+       protected void finalize() {
+               destroy();
+       }
+       /** The native implementation for destroying a semaphore
+        */
+       private native void destroy();
+       /**
+        * Class initializer, to initialize various JNI stuff
+        */
+       public static native void nativeInit();
+       static {
+               Msg.nativeInit();
+               nativeInit();
+       }
 }
\ No newline at end of file
index 9f5a45a..1b79501 100644 (file)
@@ -16,7 +16,7 @@ public class Storage {
         * access to it.
         */ 
        private long bind;
-       
+
        /**
         * Storage name
         */
@@ -26,19 +26,19 @@ public class Storage {
         * User data.
         */ 
        private Object data;
-    /**
-     *
-     */
-    protected Storage() {
+       /**
+        *
+        */
+       protected Storage() {
                this.bind = 0;
                this.data = null;
        };
-       
+
        public String toString (){
                return this.name; 
-               
+
        }
-       
+
        /**
         * This static method gets a storage instance associated with a native
         * storage of your platform. This is the best way to get a java storage object.
@@ -46,11 +46,11 @@ public class Storage {
         * @param name          The name of the storage to get.
         *
         * @return              The storage object with the given name.
-     * @exception              StorageNotFoundException if the name of the storage is not valid.
+        * @exception           StorageNotFoundException if the name of the storage is not valid.
         *                                      NativeException if the native version of this method failed.
         */ 
        public native static Storage getByName(String name) 
-       throws HostNotFoundException, NullPointerException;
+                       throws HostNotFoundException, NullPointerException;
 
        /**
         * This method returns the name of a storage.
@@ -60,7 +60,7 @@ public class Storage {
        public String getName() {
                return name;
        }
-       
+
        /**
         * This method returns the size (in bytes) of a storage element.
         *
@@ -76,7 +76,7 @@ public class Storage {
         *
         */ 
        public native long getFreeSize();
-       
+
        /**
         * This method returns the used size (in bytes) of a storage element.
         *
@@ -84,18 +84,18 @@ public class Storage {
         *
         */ 
        public native long getUsedSize();
-       
+
        /**
         * Returns the value of a given storage property. 
         */
        public native String getProperty(String name);
-       
+
        /**
         * Change the value of a given storage property. 
         */
        public native void setProperty(String name, String value);
-       
-       
+
+
        /** 
         *
         * Returns the host name the storage is attached to
@@ -103,7 +103,7 @@ public class Storage {
         * @return      the host name the storage is attached to
         */
        public native String getHost();
-       
+
        /**
         * This static method returns all of the storages of the installed platform.
         *
@@ -111,7 +111,7 @@ public class Storage {
         *
         */ 
        public native static Storage[] all();
-       
+
        /**
         * Class initializer, to initialize various JNI stuff
         */
@@ -119,5 +119,5 @@ public class Storage {
        static {
                nativeInit();
        }               
-       
+
 }
\ No newline at end of file
index c76e911..d3e2894 100644 (file)
@@ -72,7 +72,7 @@ public class Task {
        public Task(String name, Host[]hosts, double[]flopsAmount, double[]bytesAmount) {
                parallelCreate(name, hosts, flopsAmount, bytesAmount);
        }
-       
+
        /**
         * The natively implemented method to create a MSG task.
         *
@@ -89,7 +89,7 @@ public class Task {
        private final native void create(String name,
                        double flopsAmount,
                        double bytesAmount)
-       throws IllegalArgumentException;                
+                                       throws IllegalArgumentException;                
        /**
         * The natively implemented method to create a MSG parallel task.
         *
@@ -104,21 +104,21 @@ public class Task {
                        Host[]hosts,
                        double[]flopsAmount,
                        double[]bytesAmount)
-       throws NullPointerException, IllegalArgumentException;
+                                       throws NullPointerException, IllegalArgumentException;
        /* *                   * *
         * * Getters / Setters * *
         * *                   * */
-    /** Gets the name of a task */
+       /** Gets the name of a task */
        public String getName() {
                return name;
        }
-       
+
        /** Gets the sender of the task (or null if not sent yet) */
        public native Process getSender();
-       
+
        /** Gets the source of the task (or null if not sent yet). */
        public native Host getSource();   
-       
+
        /** Gets the remaining amount of flops to execute in this task
         * 
         * If it's ongoing, you get the exact amount at the present time. If it's already done, it's 0.
@@ -138,7 +138,7 @@ public class Task {
         * @param priority      The new priority of the task.
         */ 
        public native void setPriority(double priority);
-       
+
        /** Set the computation amount needed to process the task
         * 
         * Warning if the execution is already started and ongoing, this call does nothing.
@@ -157,12 +157,12 @@ public class Task {
         * *                     * */
        /**
         * Executes a task on the location on which the current process is running.
-     *
-     * @throws HostFailureException
-     * @throws TaskCancelledException
-     */
+        *
+        * @throws HostFailureException
+        * @throws TaskCancelledException
+        */
        public native void execute() throws HostFailureException,TaskCancelledException;
-       
+
        /** Bound a computation to a certain load */
        public native void setBound(double load); 
 
@@ -184,24 +184,24 @@ public class Task {
         * * Communication-related * *
         * *                       * */
 
-       /** Send the task asynchronously on the mailbox identified by the specified name
+       /** Send the task asynchronously on the specified mailbox
         *  with no way to retrieve whether the communication succeeded or not
         * 
         */
        public native void dsendBounded(String mailbox, double maxrate);
 
 
-       /** Send the task asynchronously on the mailbox identified by the specified name
+       /** Send the task asynchronously on the specified mailbox
         *  with no way to retrieve whether the communication succeeded or not
         * 
         */
        public native void dsend(String mailbox);
-       
+
        /**
-        * Sends the task on the mailbox identified by the specified name 
+        * Sends the task on the specified mailbox 
         *
-     * @param mailbox
-     * @throws TimeoutException
+        * @param mailbox where to send the message
+        * @throws TimeoutException
         * @throws HostFailureException 
         * @throws TransferFailureException 
         */
@@ -210,41 +210,40 @@ public class Task {
        } 
 
        /**
-        * Sends the task on the mailbox identified by the specified name (wait at most \a timeout seconds)
+        * Sends the task on the specified mailbox (wait at most \a timeout seconds)
         *
-     * @param mailbox
-     * @param timeout
-     * @exception  NativeException if the retrieval fails.
+        * @param mailbox where to send the message
+        * @param timeout
+        * @exception  NativeException if the retrieval fails.
         * @throws TimeoutException 
         * @throws HostFailureException 
         * @throws TransferFailureException 
         */
        public native void send(String mailbox, double timeout) throws TransferFailureException, HostFailureException, TimeoutException;
-       /**
-        * Sends the task on the mailbox identified by the specified alias  (capping the sending rate to \a maxrate) 
+
+       /** Sends the task on the specified mailbox (capping the sending rate to \a maxrate) 
         *
-     * @param alias
-     * @param maxrate 
-     * @throws TransferFailureException
-     * @throws HostFailureException
-     * @throws TimeoutException
+        * @param mailbox where to send the message
+        * @param maxrate 
+        * @throws TransferFailureException
+        * @throws HostFailureException
+        * @throws TimeoutException
         */
-       public void sendBounded(String alias, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException {
-              sendBounded(alias,-1,maxrate);
-        }
+       public void sendBounded(String mailbox, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException {
+               sendBounded(mailbox,-1,maxrate);
+       }
 
 
-/**
-        * Sends the task on the mailbox identified by the specified alias  (capping the sending rate to \a maxrate) with a timeout
+       /** Sends the task on the specified mailbox (capping the sending rate to \a maxrate) with a timeout
         *
-     * @param alias
-     * @param timeout
-     * @param maxrate 
-     * @throws TransferFailureException
-     * @throws HostFailureException
-     * @throws TimeoutException
+        * @param mailbox where to send the message
+        * @param timeout
+        * @param maxrate 
+        * @throws TransferFailureException
+        * @throws HostFailureException
+        * @throws TimeoutException
         */
-       public native void sendBounded(String alias, double timeout, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException;
+       public native void sendBounded(String mailbox, double timeout, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException;
 
 
        /**
@@ -256,7 +255,7 @@ public class Task {
         * Sends the task on the mailbox asynchronously (capping the sending rate to \a maxrate)
         */
        public native Comm isendBounded(String mailbox, double maxrate);
-       
+
 
        /**
         * Starts listening for receiving a task from an asynchronous communication
@@ -266,7 +265,7 @@ public class Task {
        /**
         * Retrieves next task from the mailbox identified by the specified name
         *
-     * @param mailbox
+        * @param mailbox
         */
 
        public static Task receive(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException {
@@ -276,8 +275,8 @@ public class Task {
        /**
         * Retrieves next task on the mailbox identified by the specified name (wait at most \a timeout seconds)
         *
-     * @param mailbox
-     * @param timeout
+        * @param mailbox
+        * @param timeout
         */
        public static Task receive(String mailbox, double timeout) throws  TransferFailureException, HostFailureException, TimeoutException {
                return receive(mailbox, timeout, null);
@@ -286,8 +285,8 @@ public class Task {
        /**
         * Retrieves next task sent by a given host on the mailbox identified by the specified alias 
         *
-     * @param mailbox
-     * @param host
+        * @param mailbox
+        * @param host
         */
 
        public static Task receive(String mailbox, Host host) throws TransferFailureException, HostFailureException, TimeoutException {
@@ -297,9 +296,9 @@ public class Task {
        /**
         * Retrieves next task sent by a given host on the mailbox identified by the specified alias (wait at most \a timeout seconds)
         *
-     * @param mailbox
-     * @param timeout 
-     * @param host
+        * @param mailbox
+        * @param timeout 
+        * @param host
         */
        public native static Task receive(String mailbox, double timeout, Host host) throws TransferFailureException, HostFailureException, TimeoutException;
 
@@ -311,7 +310,7 @@ public class Task {
        /**
         * Retrieves next task from the mailbox identified by the specified name with a capped rate
         *
-     * @param mailbox
+        * @param mailbox
         */
 
        public static Task receiveBounded(String mailbox, double rate) throws TransferFailureException, HostFailureException, TimeoutException {
@@ -321,8 +320,8 @@ public class Task {
        /**
         * Retrieves next task on the mailbox identified by the specified name (wait at most \a timeout seconds) with a capped rate
         *
-     * @param mailbox
-     * @param timeout
+        * @param mailbox
+        * @param timeout
         */
        public static Task receiveBounded(String mailbox, double timeout, double rate) throws  TransferFailureException, HostFailureException, TimeoutException {
                return receiveBounded(mailbox, timeout, null, rate);
@@ -331,8 +330,8 @@ public class Task {
        /**
         * Retrieves next task sent by a given host on the mailbox identified by the specified alias with a capped rate
         *
-     * @param mailbox
-     * @param host
+        * @param mailbox
+        * @param host
         */
 
        public static Task receiveBounded(String mailbox, Host host, double rate) throws TransferFailureException, HostFailureException, TimeoutException {
@@ -343,28 +342,28 @@ public class Task {
         * Retrieves next task sent by a given host on the mailbox identified by the specified alias (wait at most \a timeout seconds)
         * with a capped rate
         *
-     * @param mailbox
-     * @param timeout 
-     * @param host
+        * @param mailbox
+        * @param timeout 
+        * @param host
         */
        public native static Task receiveBounded(String mailbox, double timeout, Host host, double rate) throws TransferFailureException, HostFailureException, TimeoutException;
 
-       
-       
+
+
        /**
         * Tests whether there is a pending communication on the mailbox identified by the specified alias, and who sent it
-     */
+        */
        public native static int listenFrom(String mailbox);
        /**
         * Listen whether there is a waiting task on the mailbox identified by the specified alias
-     */
+        */
        public native static boolean listen(String mailbox);
 
        /**
         * Counts the number of tasks waiting to be received on the \a mailbox identified by the specified alia and sended by the specified \a host.
-     */
+        */
        public native static int listenFromHost(String alias, Host host);
-       
+
        /**
         * Class initializer, to initialize various JNI stuff
         */
index b858c49..5efe9f2 100644 (file)
@@ -8,22 +8,20 @@
 
 package org.simgrid.msg;
 
-import org.simgrid.msg.Host;
-import org.simgrid.msg.Process;
 
 public class VM extends Host{
        // Please note that we are not declaring a new bind variable 
        //(the bind variable has been inherited from the super class Host)
-       
+
        /* Static functions */ 
        // GetByName is inherited from the super class Host
-       
 
-        private static VM[] vms=null;    
-    private Host currentHost; 
+
+       private static VM[] vms=null;     
+       private Host currentHost; 
 
        /* Constructors / destructors */
-    /**
+       /**
         * Create a `basic' VM (i.e. 1 core, 1GB of RAM, other values are not taken into account).
         */
        public VM(Host host, String name) {
@@ -53,41 +51,41 @@ public class VM extends Host{
 
        private static void addVM(VM vm){
                VM[] vmsN=null; 
-               int i=0;
+               int i=0;
                if(VM.vms == null)
                        vmsN = new VM[1]; 
                else
                        vmsN = new VM[vms.length+1]; 
-               
+
                for (i=0; i<vmsN.length-1 ; i ++){
                        vmsN[i]=vms[i]; 
                } 
                vmsN[i]=vm;
                vms=vmsN;
        }
-   public static VM[] all(){
+       public static VM[] all(){
                return vms;
        }
        public static VM getVMByName(String name){
                for (int i=0 ; i < vms.length ; i++){
-                         if (vms[i].getName().equals(name))
-                                       return vms[i];          
+                       if (vms[i].getName().equals(name))
+                               return vms[i];          
                }
                return null; 
        }
        protected void finalize() {
                destroy();
        }
-       
+
 
        /* JNI / Native code */
 
        /* get/set property methods are inherited from the Host class. */
-       
+
        /** Returns whether the given VM is currently suspended
         */     
        public native int isCreated();
-       
+
        /** Returns whether the given VM is currently running
         */
        public native int isRunning();
@@ -95,15 +93,15 @@ public class VM extends Host{
        /** Returns whether the given VM is currently running
         */
        public native int isMigrating();
-       
+
        /** Returns whether the given VM is currently suspended
         */     
        public native int isSuspended();
-               
+
        /** Returns whether the given VM is currently saving
         */
        public native int isSaving();
-       
+
        /** Returns whether the given VM is currently saved
         */
        public native int isSaved();
@@ -111,7 +109,7 @@ public class VM extends Host{
        /** Returns whether the given VM is currently restoring its state
         */
        public native boolean isRestoring();
-       
+
        /**
         * Natively implemented method create the VM.
         * @param nCore number of core
@@ -123,7 +121,7 @@ public class VM extends Host{
         * @param dpIntensity (dirty page intensity, a percentage of migNetSpeed [0-100],  if you don't know put zero ;))
         */
        private native void create(Host host, String name, int nCore, int ramSize, 
-                        int netCap, String diskPath, int diskSize, int migNetSpeed, int dpIntensity);
+                       int netCap, String diskPath, int diskSize, int migNetSpeed, int dpIntensity);
 
 
        /**
@@ -137,20 +135,20 @@ public class VM extends Host{
         */
        public native void start();
 
-       
+
        /**
         * Immediately kills all processes within the given VM. Any memory that they allocated will be leaked.
         * No extra delay occurs. If you want to simulate this too, you want to use a MSG_process_sleep() or something
         */
        public native void shutdown();
-       
+
        /**  
         * Invoke native migration routine
-       */
+        */
        public native void internalmig(Host destination) throws Exception; // TODO add throws DoubleMigrationException (i.e. when you call migrate on a VM that is already migrating);
 
 
-       
+
        /** Change the host on which all processes are running
         * (pre-copy is implemented)
         */     
@@ -158,13 +156,13 @@ public class VM extends Host{
                try {
                        this.internalmig(destination);
                } catch (Exception e){
-                 Msg.info("an exception occurs during the migration of VM "+this.getName());
-                 throw new HostFailureException();
+                       Msg.info("an exception occurs during the migration of VM "+this.getName());
+                       throw new HostFailureException();
                }
                // If the migration correcly returned, then we should change the currentHost value. 
                this.currentHost = destination; 
        }
-       
+
        /** Immediately suspend the execution of all processes within the given VM
         *
         * No suspension cost occurs. If you want to simulate this too, you want to
@@ -172,7 +170,7 @@ public class VM extends Host{
         * of VM suspend to you.
         */     
        public native void suspend();
-       
+
        /** Immediately resumes the execution of all processes within the given VM
         *
         * No resume cost occurs. If you want to simulate this too, you want to
@@ -180,7 +178,7 @@ public class VM extends Host{
         * of VM resume to you.
         */
        public native void resume();
-       
+
        /** Immediately suspend the execution of all processes within the given VM 
         *  and save its state on the persistent HDD
         *  Not yet implemented (for the moment it behaves like suspend)
@@ -189,7 +187,7 @@ public class VM extends Host{
         *  of VM suspend to you.
         */     
        public native void save();
-       
+
        /** Immediately resumes the execution of all processes previously saved 
         * within the given VM
         *  Not yet implemented (for the moment it behaves like resume)
@@ -199,14 +197,14 @@ public class VM extends Host{
         * of VM resume to you.
         */
        public native void restore();
-       
+
 
        /**
         * Destroy the VM
         */
        public native void destroy();
 
-       
+
 
        /**
         * Class initializer, to initialize various JNI stuff
index 425f708..4892ac3 100644 (file)
@@ -17,7 +17,7 @@ public final class Trace {
        }
 
        // TODO complete the binding of the tracing API 
-       
+
 
        /**
         * Declare a new user variable associated to hosts with a color. 
@@ -26,8 +26,8 @@ public final class Trace {
         * @param color
         */
        public final static native      void hostVariableDeclareWithColor (String variable, String color);
-       
-       
+
+
        /**
         *  Add a value to a variable of a host. 
         *  
@@ -47,8 +47,8 @@ public final class Trace {
        public final static native      void hostVariableSub (String host, String variable, double value);
 
        /**
-        * Set the value of a variable of a host at a given timestamp. 
-        * 
+        * Set the value of a variable of a host at a given timestamp. 
+        * 
         * @param time
         * @param host
         * @param variable
@@ -64,178 +64,178 @@ public final class Trace {
         * @param variable
         * @param value
         */
-       public final static native      void hostVariableAddWithTime (double time, String host, String variable, double value);
-       /**
-        * Subtract a value from a variable of a host at a given timestamp.  
-        * 
-        * @param time
-        * @param host
-        * @param variable
-        * @param value
-        */
-       public final static native      void hostVariableSubWithTime (double time, String host, String variable, double value);
-
-       /**
-        *  Get declared user host variables. 
-        * 
-        */
-       public final static native String[]  getHostVariablesName ();
-
-       /**
-        *  Declare a new user variable associated to links. 
-        *  
-        * @param variable
-        */
-       public final static native      void linkVariableDeclare (String variable);
-
-       /**
-        * Declare a new user variable associated to links with a color. 
-        * @param variable
-        * @param color
-        */
-       public final static native      void linkVariableDeclareWithColor (String variable, String color);
-
-       /**
-        *  Set the value of a variable of a link. 
-        *   
-        * @param link
-        * @param variable
-        * @param value
-        */
-       public final static native      void linkVariableSet (String link, String variable, double value);
-
-       /**
-        * Add a value to a variable of a link. 
-        * 
-        * @param link
-        * @param variable
-        * @param value
-        */
-       public final static native      void linkVariableAdd (String link, String variable, double value);
-       /**
-        * Subtract a value from a variable of a link. 
-        * 
-        * @param link
-        * @param variable
-        * @param value
-        */
-       public final static native      void linkVariableSub (String link, String variable, double value);
-
-       /**
-        *  Set the value of a variable of a link at a given timestamp. 
-        *  
-        * @param time
-        * @param link
-        * @param variable
-        * @param value
-        */
-       public final static native      void linkVariableSetWithTime (double time, String link, String variable, double value);
-
-       /**
-        * Add a value to a variable of a link at a given timestamp.
-        * 
+       public final static native      void hostVariableAddWithTime (double time, String host, String variable, double value);
+
+       /**
+        * Subtract a value from a variable of a host at a given timestamp.  
+        * 
         * @param time
-        * @param link
-        * @param variable
-        * @param value
-        */
-       public final static native      void linkVariableAddWithTime (double time, String link, String variable, double value);
-
-       /**
-        * Subtract a value from a variable of a link at a given timestamp. 
-        *   
-        * @param time
-        * @param link
-        * @param variable
-        * @param value
-        */
-       public final static native      void linkVariableSubWithTime (double time, String link, String variable, double value);
-
-       /**
-        * Set the value of the variable present in the links connecting source and destination. 
-        * 
-        * @param src
-        * @param dst
-        * @param variable
-        * @param value
-        */
-       public final static native      void linkSrcDstVariableSet (String src, String dst, String variable, double value);
-       /**
-        * Add a value to the variable present in the links connecting source and destination. 
-        *  
-        * @param src
-        * @param dst
-        * @param variable
-        * @param value
-        */
-       public final static native      void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
-
-       /**
-        * Subtract a value from the variable present in the links connecting source and destination. 
-        *   
-        * @param src
-        * @param dst
-        * @param variable
-        * @param value
-        */
-       public final static native      void linkSrcDstVariableSub (String src, String dst, String variable, double value);
-
-       /**
-        *  Set the value of the variable present in the links connecting source and destination at a given timestamp. 
-        *   
-        * @param time
-        * @param src
-        * @param dst
-        * @param variable
-        * @param value
-        */
-       public final static native      void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
-
-       /**
-        * Add a value to the variable present in the links connecting source and destination at a given timestamp. 
-        * 
-        * @param time
-        * @param src
-        * @param dst
-        * @param variable
-        * @param value
-        */
-       public final static native      void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
-       /**
-        * Subtract a value from the variable present in the links connecting source and destination at a given timestamp. 
-        *  
-        * @param time
-        * @param src
-        * @param dst
-        * @param variable
-        * @param value
-        */
-       public final static native      void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
-
-       /**
-        *  Get declared user link variables.  
-        */
+        * @param host
+        * @param variable
+        * @param value
+        */
+       public final static native      void hostVariableSubWithTime (double time, String host, String variable, double value);
+
+       /**
+        *  Get declared user host variables. 
+        * 
+        */
+       public final static native String[]  getHostVariablesName ();
+
+       /**
+        *  Declare a new user variable associated to links. 
+        *  
+        * @param variable
+        */
+       public final static native      void linkVariableDeclare (String variable);
+
+       /**
+        * Declare a new user variable associated to links with a color. 
+        * @param variable
+        * @param color
+        */
+       public final static native      void linkVariableDeclareWithColor (String variable, String color);
+
+       /**
+        *  Set the value of a variable of a link. 
+        *   
+        * @param link
+        * @param variable
+        * @param value
+        */
+       public final static native      void linkVariableSet (String link, String variable, double value);
+
+       /**
+        * Add a value to a variable of a link. 
+        * 
+        * @param link
+        * @param variable
+        * @param value
+        */
+       public final static native      void linkVariableAdd (String link, String variable, double value);
+
+       /**
+        * Subtract a value from a variable of a link. 
+        * 
+        * @param link
+        * @param variable
+        * @param value
+        */
+       public final static native      void linkVariableSub (String link, String variable, double value);
+
+       /**
+        *  Set the value of a variable of a link at a given timestamp. 
+        *  
+        * @param time
+        * @param link
+        * @param variable
+        * @param value
+        */
+       public final static native      void linkVariableSetWithTime (double time, String link, String variable, double value);
+
+       /**
+        * Add a value to a variable of a link at a given timestamp.
+        * 
+        * @param time
+        * @param link
+        * @param variable
+        * @param value
+        */
+       public final static native      void linkVariableAddWithTime (double time, String link, String variable, double value);
+
+
+       /**
+        * Subtract a value from a variable of a link at a given timestamp. 
+        *   
+        * @param time
+        * @param link
+        * @param variable
+        * @param value
+        */
+       public final static native      void linkVariableSubWithTime (double time, String link, String variable, double value);
+
+       /**
+        * Set the value of the variable present in the links connecting source and destination. 
+        * 
+        * @param src
+        * @param dst
+        * @param variable
+        * @param value
+        */
+       public final static native      void linkSrcDstVariableSet (String src, String dst, String variable, double value);
+
+       /**
+        * Add a value to the variable present in the links connecting source and destination. 
+        *  
+        * @param src
+        * @param dst
+        * @param variable
+        * @param value
+        */
+       public final static native      void linkSrcDstVariableAdd (String src, String dst, String variable, double value);
+
+       /**
+        * Subtract a value from the variable present in the links connecting source and destination. 
+        *   
+        * @param src
+        * @param dst
+        * @param variable
+        * @param value
+        */
+       public final static native      void linkSrcDstVariableSub (String src, String dst, String variable, double value);
+
+       /**
+        *  Set the value of the variable present in the links connecting source and destination at a given timestamp. 
+        *   
+        * @param time
+        * @param src
+        * @param dst
+        * @param variable
+        * @param value
+        */
+       public final static native      void linkSrcDstVariableSetWithTime (double time, String src, String dst, String variable, double value);
+
+       /**
+        * Add a value to the variable present in the links connecting source and destination at a given timestamp. 
+        * 
+        * @param time
+        * @param src
+        * @param dst
+        * @param variable
+        * @param value
+        */
+       public final static native      void linkSrcdstVariableAddWithTime (double time, String src, String dst, String variable, double value);
+
+       /**
+        * Subtract a value from the variable present in the links connecting source and destination at a given timestamp. 
+        *  
+        * @param time
+        * @param src
+        * @param dst
+        * @param variable
+        * @param value
+        */
+       public final static native      void linkSrcDstVariableSubWithTime (double time, String src, String dst, String variable, double value);
+
+       /**
+        *  Get declared user link variables.  
+        */
        public final static native String[] getLinkVariablesName ();
 
-       
-                       /* **** ******** WARNINGS ************** ***** */       
-                       /* Only the following routines have been       */
-                       /* JNI implemented - Adrien May, 22nd          */
-                       /* **** ******************************** ***** */       
-               
-    /**
-     * Declare a user state that will be associated to hosts. 
-     * A user host state can be used to trace application states.
-     * 
-     * @param name The name of the new state to be declared.
-     */
+
+       /* **** ******** WARNINGS ************** ***** */       
+       /* Only the following routines have been       */
+       /* JNI implemented - Adrien May, 22nd          */
+       /* **** ******************************** ***** */       
+
+       /**
+        * Declare a user state that will be associated to hosts. 
+        * A user host state can be used to trace application states.
+        
+        * @param name The name of the new state to be declared.
+        */
        public final static native void hostStateDeclare(String name);
-       
+
        /**
         * Declare a new value for a user state associated to hosts.
         * The color needs to be a string with three numbers separated by spaces in the range [0,1]. 
@@ -255,24 +255,24 @@ public final class Trace {
         * @param state The name of the state previously declared.
         * @param value The new value of the state.
         */
-       public final static native void hostSetState (String host, String state, String value);
-       /**
-        * Push a new value for a state of a given host. 
-        * 
-        * @param host The name of the host to be considered.
-        * @param state The name of the state previously declared.
-        * @param value The value to be pushed.
-        */
-       public final static native void hostPushState (String host, String state, String value);
-       
-       /**
-        *  Pop the last value of a state of a given host. 
-        *   
-        * @param host The name of the host to be considered.
-        * @param state The name of the state to be popped.
-        */
-       public final static native void hostPopState (String host, String state);
+       public final static native void hostSetState (String host, String state, String value);
+
+       /**
+        * Push a new value for a state of a given host. 
+        * 
+        * @param host The name of the host to be considered.
+        * @param state The name of the state previously declared.
+        * @param value The value to be pushed.
+        */
+       public final static native void hostPushState (String host, String state, String value);
+
+       /**
+        *  Pop the last value of a state of a given host. 
+        *   
+        * @param host The name of the host to be considered.
+        * @param state The name of the state to be popped.
+        */
+       public final static native void hostPopState (String host, String state);
 
        /**
         * Declare a new user variable associated to hosts. 
@@ -280,7 +280,7 @@ public final class Trace {
         * @param variable
         */
        public final static native      void hostVariableDeclare (String variable);
+
 
        /**
         * Set the value of a variable of a host. 
@@ -297,7 +297,7 @@ public final class Trace {
         * @param variable
         */
        public final static native      void vmVariableDeclare (String variable);
+
 
        /**
         * Set the value of a variable of a VM.