Logo AND Algorithmique Numérique Distribuée

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