-
Notifications
You must be signed in to change notification settings - Fork 0
/
basenode_jw.h
executable file
·118 lines (97 loc) · 2.24 KB
/
basenode_jw.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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#ifndef BASENODE_JW
#define BASENODE_JW
#include <cstdlib>
class baseNodeJW
{
public:
baseNodeJW();
virtual ~baseNodeJW();
virtual baseNodeJW& operator=(const baseNodeJW &other);
//this section does not apply
virtual bool operator<(const baseNodeJW &x) const;
virtual bool operator<=(const baseNodeJW &x) const;
virtual bool operator>(const baseNodeJW &x) const;
virtual bool operator>=(const baseNodeJW &x)const;
virtual bool operator==(const baseNodeJW &x) const;
virtual bool operator!=(const baseNodeJW &x) const;
baseNodeJW*& nextNode();
baseNodeJW*& prevNode();
void * getValue() const;
void setValue(void *ptr);
void * getPiority();
void setPriority(void * ptr);
protected:
private:
void *value;
void *priority;
baseNodeJW *next, * prev;
//void copy(const baseNodeJW *other);
};
baseNodeJW::baseNodeJW()
{
value = priority = next = prev = NULL;
}
baseNodeJW::~baseNodeJW()
{
//delete value;
value = priority = next = prev = NULL;
}
//void baseNodeJW::copy(const baseNodeJW* other)
//{
// //this->value = other->getValue();
// this->next = NULL;
//}
baseNodeJW*& baseNodeJW::nextNode()
{
return next;
}
baseNodeJW*& baseNodeJW::prevNode()
{
return prev;
}
void* baseNodeJW::getValue() const
{
return value;
}
void baseNodeJW::setValue(void *ptr)
{
value = ptr;
}
void baseNodeJW::setPriority(void * ptr)
{
priority= ptr;
}
void * baseNodeJW::getPiority(){
return priority;
}
baseNodeJW& baseNodeJW::operator=(const baseNodeJW &other)
{
//if(this!=&other)
// copy(&other);
return *this;
}
bool baseNodeJW::operator<(const baseNodeJW &x) const
{
return value < x.getValue();
}
bool baseNodeJW::operator<=(const baseNodeJW &x) const
{
return value <= x.getValue();
}
bool baseNodeJW::operator>(const baseNodeJW &x) const
{
return value >x.getValue();
}
bool baseNodeJW::operator>=(const baseNodeJW &x)const
{
return value >= x.getValue();
}
bool baseNodeJW::operator==(const baseNodeJW &x) const
{
return value == x.getValue();
}
bool baseNodeJW::operator!=(const baseNodeJW &x) const
{
return value!=x.getValue();
}
#endif // BASENODE_JW