Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New version of MAHEVE plus corrections.
[mapping.git] / src / and / Mapping / GNode.java
index 3e79f03..dab3ac0 100644 (file)
@@ -21,9 +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 ;
        
        
        /**
@@ -32,8 +33,8 @@ public class GNode implements Serializable
        public GNode()
        {
                name = "" ;
-               cluster = "" ;
-               site = "" ;
+               clusterName = "" ;
+               siteName = "" ;
                nb_cores = 0 ;
                frequency = 0 ;
                mflops = 0 ;
@@ -42,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 ;
        }
        
        
@@ -49,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 ;
        }
        
        
@@ -59,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 ;
        }
        
        
@@ -69,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 ;
        }
        
        
@@ -79,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 ;
        }
 
        
@@ -313,6 +326,31 @@ public class GNode implements Serializable
                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 !! **/