Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge tag 'v3_9_90' into hypervisor
[simgrid.git] / src / bindings / java / org / simgrid / msg / Host.java
index 4683f5d..c629598 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Bindings to the MSG hosts
  *
- * Copyright 2006-2012 The SimGrid Team           
+ * Copyright (c) 2006-2013. The SimGrid Team.
  * All right reserved. 
  *
  * This program is free software; you can redistribute 
@@ -16,7 +16,7 @@ package org.simgrid.msg;
  * Thus it is represented as a physical resource with computing capabilities, some 
  * mailboxes to enable running process to communicate with remote ones, and some private 
  * data that can be only accessed by local process. An instance of this class is always 
- * binded with the corresponding native host. All the native hosts are automatically created 
+ * bound with the corresponding native host. All the native hosts are automatically created
  * during the call of the method Msg.createEnvironment(). This method take as parameter a
  * platform file which describes all elements of the platform (host, link, root..).
  * You cannot create a host yourself.
@@ -53,7 +53,7 @@ public class Host {
        /**
         * Host name
         */
-       private String name;
+       protected String name;
 
        /**
         * User data.
@@ -66,6 +66,11 @@ public class Host {
                this.bind = 0;
                this.data = null;
        };
+       
+       public String toString (){
+               return this.name; 
+               
+       }
 
        /**
         * This static method gets an host instance associated with a native
@@ -73,7 +78,7 @@ public class Host {
         *
         * @param name          The name of the host to get.
         *
-     * @return
+        * @return              The host object with the given name.
      * @exception              HostNotFoundException if the name of the host is not valid.
         *                                      NativeException if the native version of this method failed.
         */ 
@@ -101,6 +106,20 @@ 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 method returns the name of a host.
         * @return                      The name of the host.
@@ -109,6 +128,7 @@ public class Host {
        public String getName() {
                return name;
        }
+
        /**
         * Sets the data of the host.
      * @param data
@@ -117,9 +137,9 @@ public class Host {
                this.data = data;
        } 
        /**
-        * Gets the d   ata of the host.
+        * Gets the data of the host.
      *
-     * @return
+     * @return The data object associated with the host.
      */
        public Object getData() {
                return this.data;
@@ -128,12 +148,23 @@ public class Host {
        /**
         * Checks whether a host has data.
      *
-     * @return
+     * @return True if the host has an associated data object.
      */
        public boolean hasData() {
                return null != this.data;
        }
 
+       /**
+        * This method start the host if it is off
+        */ 
+       public native void on();
+
+       /**
+        * This method stop the host if it is on
+        */ 
+       public native void off();
+
+
        /**
         * This method returns the number of tasks currently running on a host.
         * The external load is not taken in account.
@@ -150,16 +181,27 @@ public class Host {
         *
         */ 
        public native double getSpeed();
+
        /**
-        * @brief Returns the value of a given host property. 
+        * This method returns the number of core of a host.
+        *
+        * @return                      The speed of the processor of the host in flops.
+        *
+        */ 
+       public native double getCoreNumber();
+
+       /**
+        * Returns the value of a given host property. 
         */
        public native String getProperty(String name);
+       
        /**
-        * @brief Change the value of a given host property. 
+        * Change the value of a given host property. 
         */
        public native void setProperty(String name, String value);
-    /** This method tests if a host is avail.
-     * @return
+    
+       /** This method tests if a host is available.
+     * @return True if the host is available.
      */
        public native boolean isAvail();