Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New stable version with the add of the Maheve algorithm.
[mapping.git] / src / and / Mapping / GNode.java
1 package and.Mapping ;
2
3 import java.io.Serializable;
4
5
6 /**
7  * Class representing a computing node
8  * @author Sébastien Miquée
9  *
10  */
11 public class GNode implements Serializable
12 {
13         private static final long serialVersionUID = 1L;
14         
15         private String name ;
16         private int nb_cores ;
17         private int frequency ;
18         private int mflops ;
19         private int memory ;
20         private Object node ;
21         private long id ;
22         private boolean mapped ;
23         private boolean inCluster ;
24         private String cluster ;
25         private String site ;
26         private String ip ;
27         
28         
29         /**
30          * Default constructor.
31          */
32         public GNode()
33         {
34                 name = "" ;
35                 cluster = "" ;
36                 site = "" ;
37                 nb_cores = 0 ;
38                 frequency = 0 ;
39                 mflops = 0 ;
40                 memory = 0 ;
41                 node = null ;
42                 id = -1 ;
43                 mapped = false ;
44                 inCluster = false ;
45         }
46         
47         
48         /**
49          * Set the cluster's name in which the computing node is.
50          * @param _c The name of the cluster containing the node
51          */
52         public void setCluster( String _c )
53         {
54                 cluster = _c ;
55         }
56         
57         
58         /**
59          * Return the cluster's name in which the node is.
60          * @return The cluster's name
61          */
62         public String getCluster()
63         {
64                 return cluster ;
65         }
66         
67         
68         /**
69          * Set the site's name in which the computing node is.
70          * @param _s The site's name
71          */
72         public void setSite( String _s )
73         {
74                 site = _s ;
75         }
76         
77         
78         /**
79          * Return the name of the site in which the computing node is.
80          * @return The site's name
81          */
82         public String getSite()
83         {
84                 return site ;
85         }
86
87         
88         /**
89          * Change the status of the node concerning its participation in the computation.
90          * @param _b The status of its participation
91          */
92         public void setMapped( boolean _b )
93         {
94                 mapped = _b ;
95         }
96         
97         
98         /**
99          * Return the status of the participation of the computing node.
100          * @return The status of the node
101          */
102         public boolean getMapped()
103         {
104                 return mapped ;
105         }
106         
107         
108         /**
109          * Set the status of the computing node in order to know if
110          * it is in cluster or not. 
111          * @param _b The status of the node
112          */
113         public void setInCluster( boolean _b ) 
114         {
115                 inCluster = _b ;
116         }
117         
118         
119         /**
120          * Return the status of the computing node concerning its
121          * presence, or not, in a cluster.
122          * @return The status of the node
123          */
124         public boolean getInCluster()
125         {
126                 return inCluster ;
127         }
128
129
130         /**
131          * Set the name of the computing node.
132          * @param _name The node's name
133          */
134         public void setName( String _name ) 
135         {
136                 name = _name ;
137         }
138
139
140         /**
141          * Return the name of the computing node
142          * @return The node's name
143          */
144         public String getName() 
145         {
146                 return name ;
147         }
148
149
150         /**
151          * Set the external representation of the node. This object 
152          * represents the node in application using this library.
153          * @param n The external representation of the node
154          */
155         public void setNode( Object n )
156         {
157                 node = n ;
158         }
159         
160         
161         /**
162          * Return the external representation of the node.
163          * @return The external representation of the node
164          */
165         public Object getNode()
166         {
167                 return node ;
168         }
169         
170
171
172         /**
173          * Set the amount of computing cores of the computing node.
174          * @param _nb_cores The amount of cores
175          */
176         public void setNb_cores( int _nb_cores ) 
177         {
178                 nb_cores = _nb_cores;
179         }
180
181         
182         /**
183          * Return the amount of computing cores of the computing node.
184          * @return The amount of cores
185          */
186         public int getNb_cores() 
187         {
188                 return nb_cores;
189         }
190
191
192         /**
193          * Set the frequency of computing cores of the computing node.
194          * @param _freq The frequency of cores
195          */
196         public void setFrequency( int _freq ) 
197         {
198                 frequency = _freq ;
199         }
200
201
202         /**
203          * Return the frequency of computing cores of the computing node.
204          * @return The frequency of cores
205          */
206         public int getFrequency() 
207         {
208                 return frequency ;
209         }
210
211         
212         /**
213          * Set the MFlops of each computing core of the computing node.
214          * @param _mflops The MFlops of cores
215          */
216         public void setMFlops( int _mflops ) 
217         {
218                 mflops = _mflops ;
219         }
220
221
222         /**
223          * Return the MFlops of each computing core of the computing node.
224          * @return The MFlops of cores
225          */
226         public int getMFlops() 
227         {
228                 return mflops ;
229         }
230
231         /**
232          * Set the amount of available memory of the computing node.
233          * @param _mem Amount of memory
234          */
235         public void setMemory( int _mem ) 
236         {
237                 memory = _mem ;
238         }
239         
240         
241         /**
242          * Return the amount of the available memory of the computing node.
243          * @return The amount  of memory
244          */
245         public int getMemory() 
246         {
247                 return memory ;
248         }
249
250
251         /**
252          * Return the computational power of the computing node. It includes
253          * the multiplication of cores by frequency plus a coefficient for the 
254          * memory.
255          * @return The computational power of the computing node
256          */
257         public int getPower()
258         {
259                 if( frequency != 0 )
260                 {
261                         return ( nb_cores * frequency ) ;
262                 } else {
263                         return ( nb_cores * mflops ) ;
264                 }
265         }
266         
267         
268         /**
269          * Set the uniq identifier of the computing node.
270          * @param _id The identifier of the node
271          */
272         public void setId( long _id ) 
273         {
274                 id = _id ;
275         }
276         
277         
278         /**
279          * Return the uniq identifier of the computing node.
280          * @return The identifier of the node
281          */
282         public long getId() 
283         {
284                 return id ;
285         }
286         
287         
288         /**
289          * Return the name of the node for the use of the node in a string.
290          * @return The name of the node
291          */
292         public String toString()
293         {
294                 return name ;
295         }
296         
297         
298         /**
299          * Return the IP address of the GNode.
300          * @return The IP address
301          */
302         public String getIP()
303         {
304                 return ip ;
305         }
306         
307         
308         /**
309          * Set the IP address of the GNode.
310          * @param _ip The IP address
311          */
312         public void setIP( String _ip )
313         {
314                 ip = _ip ;
315         }
316         
317 }
318
319 /** La programmation est un art, respectons ceux qui la pratiquent !! **/