-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEdge.h
87 lines (75 loc) · 1.64 KB
/
Edge.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
* @file Edge.h
* @brief Edge class header file
*/
#ifndef DA_PROJECT2_EDGE_H
#define DA_PROJECT2_EDGE_H
#include <iostream>
/**
* @brief Class that represents an edge
*/
class Edge {
private:
int node1;/**< First node */
int node2;/**< Second node */
double distance;/**< Distance between the two nodes */
bool selected;/**< True if the edge is selected, false otherwise */
public:
/**
* @brief Constructor of the class
*
* Time complexity: O(1)
*
* @param node1 First node
* @param node2 Second node
* @param distance Distance between the two nodes
*/
Edge(int node1, int node2, double distance);
/**
* @brief Gets the first node
*
* Time complexity: O(1)
*
* @return First node
*/
int getNode1() const;
/**
* @brief Gets the second node
*
* Time complexity: O(1)
*
* @return Second node
*/
int getNode2() const;
/**
* @brief Gets the distance between the two nodes
*
* Time complexity: O(1)
*
* @return Distance between the two nodes
*/
double getDistance() const;
/**
* @brief Gets if the edge is selected
*
* Time complexity: O(1)
*
* @return True if the edge is selected, false otherwise
*/
bool isSelected() const;
/**
* @brief Sets if the edge is selected
*
* Time complexity: O(1)
*
* @param s True if the edge is selected, false otherwise
*/
void setSelected(bool s);
/**
* @brief Prints the edge
*
* Time complexity: O(1)
*/
void print();
};
#endif //DA_PROJECT2_EDGE_H