Logo AND Algorithmique Numérique Distribuée

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