Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New version of MAHEVE plus corrections.
[mapping.git] / src / and / Mapping / GNode.java
index c8bdb0d..dab3ac0 100644 (file)
@@ -21,8 +21,10 @@ public class GNode implements Serializable
        private long id ;
        private boolean mapped ;
        private boolean inCluster ;
-       private String cluster ;
-       private String site ;
+       private String clusterName ;
+       private String siteName ;
+       private String ip ;
+       private Cluster cluster ;
        
        
        /**
@@ -31,8 +33,8 @@ public class GNode implements Serializable
        public GNode()
        {
                name = "" ;
-               cluster = "" ;
-               site = "" ;
+               clusterName = "" ;
+               siteName = "" ;
                nb_cores = 0 ;
                frequency = 0 ;
                mflops = 0 ;
@@ -41,6 +43,18 @@ public class GNode implements Serializable
                id = -1 ;
                mapped = false ;
                inCluster = false ;
+               cluster = null ;
+       }
+       
+       
+       public void setCluster( Cluster _cl )
+       {
+               cluster = _cl ;
+       }
+       
+       public Cluster getCluster()
+       {
+               return cluster ;
        }
        
        
@@ -48,9 +62,9 @@ public class GNode implements Serializable
         * Set the cluster's name in which the computing node is.
         * @param _c The name of the cluster containing the node
         */
-       public void setCluster( String _c )
+       public void setClusterName( String _cn )
        {
-               cluster = _c ;
+               clusterName = _cn ;
        }
        
        
@@ -58,9 +72,9 @@ public class GNode implements Serializable
         * Return the cluster's name in which the node is.
         * @return The cluster's name
         */
-       public String getCluster()
+       public String getClusterName()
        {
-               return cluster ;
+               return clusterName ;
        }
        
        
@@ -68,9 +82,9 @@ public class GNode implements Serializable
         * Set the site's name in which the computing node is.
         * @param _s The site's name
         */
-       public void setSite( String _s )
+       public void setSiteName( String _s )
        {
-               site = _s ;
+               siteName = _s ;
        }
        
        
@@ -78,9 +92,9 @@ public class GNode implements Serializable
         * Return the name of the site in which the computing node is.
         * @return The site's name
         */
-       public String getSite()
+       public String getSiteName()
        {
-               return site ;
+               return siteName ;
        }
 
        
@@ -210,7 +224,7 @@ public class GNode implements Serializable
        
        /**
         * Set the MFlops of each computing core of the computing node.
-        * @param _freq The MFlops of cores
+        * @param _mflops The MFlops of cores
         */
        public void setMFlops( int _mflops ) 
        {
@@ -249,17 +263,16 @@ public class GNode implements Serializable
 
        /**
         * Return the computational power of the computing node. It includes
-        * the multiplication of cores by frequency plus a coefficient for the 
-        * memory.
+        * the multiplication of cores by frequency.
         * @return The computational power of the computing node
         */
        public int getPower()
        {
-               if( frequency != 0 )
+               if( mflops != 0 )
                {
-                       return ( nb_cores * frequency ) ;
-               } else {
                        return ( nb_cores * mflops ) ;
+               } else {
+                       return ( nb_cores * frequency ) ;
                }
        }
        
@@ -283,6 +296,61 @@ public class GNode implements Serializable
                return id ;
        }
        
+       
+       /**
+        * Return the name of the node for the use of the node in a string.
+        * @return The name of the node
+        */
+       public String toString()
+       {
+               return name ;
+       }
+       
+       
+       /**
+        * Return the IP address of the GNode.
+        * @return The IP address
+        */
+       public String getIP()
+       {
+               return ip ;
+       }
+       
+       
+       /**
+        * Set the IP address of the GNode.
+        * @param _ip The IP address
+        */
+       public void setIP( String _ip )
+       {
+               ip = _ip ;
+       }
+       
+       
+       /**
+        * Construct and return a copy of the current GNode.
+        * @return A copy of this node
+        */
+       public GNode clone()
+       {
+               GNode copy = new GNode() ;
+               
+               copy.setName( name ) ;
+               copy.setNb_cores( nb_cores ) ;
+               copy.setFrequency( frequency ) ;
+               copy.setMFlops( mflops ) ;
+               copy.setMemory( memory ) ;
+               copy.setNode( node ) ;
+               copy.setId( id ) ;
+               copy.setMapped( mapped ) ;
+               copy.setInCluster( inCluster ) ;
+               copy.setClusterName( clusterName ) ;
+               copy.setSiteName( siteName ) ;
+               copy.setIP( ip ) ;
+
+               return copy ;
+       }
+       
 }
 
 /** La programmation est un art, respectons ceux qui la pratiquent !! **/