Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add isend in Task
[simgrid.git] / org / simgrid / msg / ApplicationHandler.java
index ac5a699..ae57e0f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * These are the upcalls used by the FleXML parser for application files
  *
- * Copyright 2006,2007,2010 The SimGrid team.           
+ * Copyright 2006,2007,2010,2011 The SimGrid team.           
  * All right reserved. 
  *
  * This program is free software; you can redistribute 
@@ -9,7 +9,7 @@
  * (GNU LGPL) which comes with this package.
  */
 
-package simgrid.msg;
+package org.simgrid.msg;
 
 import java.util.Hashtable;
 import java.util.Vector;
@@ -23,7 +23,10 @@ public final class ApplicationHandler {
                 */
                public  static Vector<String> args;
 
-               public  static Hashtable<String,String> properties;
+        /**
+         *
+         */
+        public  static Hashtable<String,String> properties;
 
                /**
                 * The name of the host of the process.
@@ -41,7 +44,9 @@ public final class ApplicationHandler {
                 * and clear the vector containing the arguments of the 
                 * previouse process function if needed.
                 *
-                * @host                                The host of the process to create.
+         * @param hostName_
+         * @param function_
+         * @host                               The host of the process to create.
                 * @function                    The function of the process to create.
                 *
                 */
@@ -60,33 +65,45 @@ public final class ApplicationHandler {
                 * It stores the argument of the function of the next
                 * process to create in the vector of arguments.
                 *
-                * @arg                                 The argument to add.
+         * @param arg
+         * @arg                                        The argument to add.
                 *
                 */ public  static void registerProcessArg(String arg) {
                         args.add(arg);
                 }
 
-                public  static void setProperty(String id, String value)
+         /**
+          *
+          * @param id
+          * @param value
+          */
+         public  static void setProperty(String id, String value)
                 {
                         properties.put(id,value);      
                 }
 
-                public  static String getHostName()
+         /**
+          *
+          * @return
+          */
+         public  static String getHostName()
                 {
                         return hostName;
                 }
 
-                @SuppressWarnings("unchecked")
+         /**
+          *
+          */
+         @SuppressWarnings("unchecked")
                 public  static void createProcess() {
                         try {
-                                Class<simgrid.msg.Process> cls = (Class<Process>) Class.forName(function);
+                                Class<Process> cls = (Class<Process>) Class.forName(function);
 
-                                simgrid.msg.Process process = cls.newInstance();
+                                Process process = cls.newInstance();
                                 process.name = function;
-                                process.id = simgrid.msg.Process.nextProcessId++;
-                                Host host = Host.getByName(hostName);
+                                process.id = org.simgrid.msg.Process.nextProcessId++;
 
-                                MsgNative.processCreate(process, host);
+                                MsgNative.processCreate(process, hostName);
                                 Vector<String> args_ = args;
                                 int size = args_.size();
 
@@ -94,7 +111,7 @@ public final class ApplicationHandler {
                                         process.args.add(args_.get(index));
 
                                 process.properties = properties;
-                                properties = new Hashtable();
+                                properties = new Hashtable<String,String>();
 
                         } catch(HostNotFoundException e) {
                                 System.out.println(e.toString());
@@ -116,29 +133,52 @@ public final class ApplicationHandler {
                 }
        
 
-       public  static void onStartDocument() {
+         /**
+          *
+          */
+         public  static void onStartDocument() {
                        args = new Vector<String>();
                        properties = new Hashtable<String,String>();
                        hostName = null;
                        function = null;
        }
 
-       public  static void onBeginProcess(String hostName, String function) {
+         /**
+          *
+          * @param hostName
+          * @param function
+          */
+         public  static void onBeginProcess(String hostName, String function) {
                setProcessIdentity(hostName, function);
                
        }
-       public  static void onProperty(String id, String value) {
+    /**
+     *
+     * @param id
+     * @param value
+     */
+    public  static void onProperty(String id, String value) {
                setProperty(id, value);
        }
 
-       public  static void onProcessArg(String arg) {
+    /**
+     *
+     * @param arg
+     */
+    public  static void onProcessArg(String arg) {
                registerProcessArg(arg);
        }
 
-       public  static void onEndProcess() {
+    /**
+     *
+     */
+    public  static void onEndProcess() {
                createProcess();
        }        
 
-       public static void onEndDocument() {
+    /**
+     *
+     */
+    public static void onEndDocument() {
        }  
 }