-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathNode.cpp
More file actions
36 lines (27 loc) · 743 Bytes
/
Node.cpp
File metadata and controls
36 lines (27 loc) · 743 Bytes
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
#include "Node.h"
/// Do not use. This is just here so Nodes can be stored in Maps. // TODO: find a way to make it work w/o this useless constructor.
Node::Node(){
}
/// Constructs a Node with the specified x and y values.
Node::Node( int x, int y): x_(x), y_(y){
}
/// Returns the x value of the Node.
int Node::x() const{
return x_;
}
/// Returns the y value of the Node.
int Node::y() const{
return y_;
}
/// Sets the x value of the Node.
void Node::setX( int x){
x_ = x;
}
/// Sets the y value of the Node.
void Node::setY( int y){
y_ = y;
}
/// Returns true if both Nodes have the same x and y values.
bool operator==(const Node &lhs, const Node &rhs){
return (lhs.x() == rhs.x()) && (lhs.y() == rhs.y());
}