-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.h
54 lines (44 loc) · 1.24 KB
/
node.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* @file node.h
* @brief Node class definition
*
* Defines the Node class and implements a few inline methods
*/
#ifndef NODE_H
#define NODE_H
/**
* @class Node
* Represents each element in the clustering process
* It holds a unique identifier for the node and the cluster to which it
* belongs
*/
class Node
{
private:
int id_; // ID of the element
int clusterId_; // ID of the Cluster to which it belongs
public:
/**
* Constructor
* @param id Unique identifier for the element
* @param cluster Cluster identifier. Before the clustering process it
* is equal to the element identifier
*/
Node (int id, int clusterId): id_(id),clusterId_(clusterId){};
/**
* Returns the cluster identifier
* @return clusterId
*/
int getCluster() const {return clusterId_;};
/**
* Returns the Node identifier
* @return identifier
*/
int getID() const {return id_;};
/**
* Assigns the element to a new cluster by changing its cluster_ value
* @param cluster Identifier of the new cluster
*/
void setCluster(int clusterId){clusterId_=clusterId;};
};
#endif