Line data Source code
1 : #include "node.hpp"
2 :
3 10 : Node::Node(void) {
4 10 : this->id = -1;
5 10 : this->label = "";
6 10 : }
7 :
8 379 : Node::Node(int id) {
9 379 : this->id = id;
10 379 : this->label = "";
11 379 : }
12 :
13 2 : Node::Node(int id, std::string label) {
14 2 : this->id = id;
15 :
16 2 : this->label = label;
17 2 : }
18 :
19 2 : Node::Node(const Node &node) {
20 2 : this->id = node.id;
21 2 : this->label = node.label;
22 2 : }
23 :
24 6 : void Node::setId(int id) {
25 6 : if (this->id != -1)
26 : throw std::runtime_error(
27 2 : "Cannot set Id to a Node with Id different than -1.");
28 4 : this->id = id;
29 4 : }
30 :
31 399 : int Node::getId(void) const { return this->id; }
32 :
33 2 : void Node::setLabel(std::string label) { this->label = label; }
34 :
35 2 : std::string Node::getLabel(void) const { return this->label; }
|