forked from yangxu02/LFUCache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoubleLinkedList.h
50 lines (35 loc) · 927 Bytes
/
DoubleLinkedList.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
#ifndef __LFU_CACHE_DOUBLE_LINKED_LIST_H__
#define __LFU_CACHE_DOUBLE_LINKED_LIST_H__
#include "Node.h"
class DoubleLinkedList {
public:
DoubleLinkedList():head(NULL), tail(NULL), size(0) {}
Node* addNode(Node* node, Node* pre, Node* next);
void removeNode(Node* node);
Node* getHead() {
return this->head;
}
void setHead(Node* head) {
this->head = head;
}
void setTail(Node* tail) {
this->tail = tail;
}
Node* getTail() {
return this->tail;
}
Node* addNode(Node* node) {
return this->addNode(node, NULL, this->head);
}
int count() {
return this->size;
}
int empty() {
return 0 == this->size;
}
private:
Node* head;
Node* tail;
int size;
};
#endif