-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathStackNode.cpp
58 lines (50 loc) · 1.17 KB
/
StackNode.cpp
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
//
// Created by brett on 06/02/18.
//
#include "StackNode.h"
/**
* Custom StackNode Construction function.
* @param data Point being put into this StackNode.
* @param next StackNode the next StackNode pointer.
*/
StackNode::StackNode(Point data, StackNode *next) : _data(data), _next(next) { }
/**
* Default StackNode Destruction function.
*/
StackNode::~StackNode() = default;
/**
* Return this StackNodes Point _data.
* @return _data.
*/
Point StackNode::getPoint() {
return _data;
}
/**
* Set this StackNodes Point _data.
* @param point Point being set.
*/
void StackNode::setPoint(Point point) {
_data = point;
}
/**
* Get this StackNodes StackNode _next.
* @return _next.
*/
StackNode *StackNode::getNext() {
return _next;
}
/**
* Set this StackNodes StackNode _next.
* @param next The StackNode being set as the new _next.
*/
void StackNode::setNext(StackNode *next) {
_next = next;
}
/**
* Check if two points are equal to each other by looking at each ones col and row property.
* @param p Point being compared to.
* @return Boolean if Points are equal.
*/
bool Point::equals(Point p) {
return ((this->col == p.col) && (this->row == p.row));
}