-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.cpp
72 lines (65 loc) · 1.45 KB
/
node.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
//
// node.cpp
// bug-cup-draw
//
// Created by Eduardo Castro on 22/12/21.
//
#ifndef NODE_CPP
#define NODE_CPP
#include <iostream>
using namespace std;
template <class T>
class Node{
private:
int priority;
bool visited;
T *data;
Node<T> *next;
Node<T> *previous;
public:
Node(T *data){
setData(data);
setNext(NULL);
setPrevious(NULL);
setPriority(0);
setVisited(false);
}
Node(T *data,int priority){
setData(data);
setNext(NULL);
setPriority(priority);
setVisited(false);
setPrevious(NULL);
}
void setVisited(bool visited){
this->visited = visited;
}
void setData(T *data){
this->data = data;
}
void setNext(Node<T> *next){
this->next = next;
}
void setPrevious(Node<T> *previous){
this->previous = previous;
}
void setPriority(int priority){
this->priority = priority;
}
Node<T> *getNext(){
return next;
}
T *getData(){
return data;
}
int getPriority(){
return priority;
}
bool getVisited(){
return visited;
}
Node<T> *getPrevious(){
return (this->previous);
}
};
#endif