-
Notifications
You must be signed in to change notification settings - Fork 0
/
itemnode.cpp
78 lines (63 loc) · 1.35 KB
/
itemnode.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// itemnode.cpp
// Michael Bottini
// Created for CS260
// June 25, 2015
// Implementation file for linked list node.
#include "itemnode.h"
itemNode::itemNode() {
_count = 0;
_next = NULL;
return;
}
itemNode::itemNode(item newItem) {
_item = newItem;
_count = 0;
_next = NULL;
return;
}
itemNode::itemNode(const itemNode& originalNode) {
*this = originalNode;
return;
}
itemNode& itemNode::operator =(const itemNode& originalNode) {
_item = originalNode.getItem();
_count = originalNode.getCount();
_next = NULL; // We cannot pass the pointer to the new node because
// it will link it to the original linked list.
return *this;
}
char* itemNode::getName() const {
return _item.getName();
}
double itemNode::getWeight() const {
return _item.getWeight();
}
const item& itemNode::getItem() const {
return this->_item;
}
int itemNode::getCount() const {
return _count;
}
itemNode* itemNode::getNext() const {
return _next;
}
void itemNode::setItem(const item& newItem) {
_item = newItem;
return;
}
void itemNode::setCount(int newCount) {
_count = newCount;
return;
}
void itemNode::setNext(itemNode* newPtr) {
_next = newPtr;
return;
}
void itemNode::incrementCount() {
_count++;
return;
}
void itemNode::decrementCount() {
_count--;
return;
}