Rudiments
avltree.h
1// Copyright (c) 1999-2018 David Muse
2// See the COPYING file for more information.
3
4#ifndef RUDIMENTS_AVLTREE_H
5#define RUDIMENTS_AVLTREE_H
6
7#include <rudiments/private/avltreeincludes.h>
8
10template <class valuetype>
11class avltreenode : public treenode<valuetype> {
12 public:
15 avltreenode(valuetype value);
16
19
21 void setValue(valuetype value);
22
24 valuetype getValue();
25
27 valuetype &getReference();
28
32
36
40
42 uint8_t getLeftHeight();
43
45 uint8_t getRightHeight();
46
51
56
57 #include <rudiments/private/avltreenode.h>
58};
59
66template <class valuetype>
67class avltree : public treecollection<valuetype> {
68 public:
70 avltree();
71
75
79
83
88
93
98
105 ~avltree();
106
109 void insert(valuetype value);
110
113 void insert(treenode<valuetype> *node);
114
118
129 bool remove(valuetype value);
130
141 bool removeAll(valuetype value);
142
154 bool remove(treenode<valuetype> *node);
155
157 uint64_t getCount();
158
161
165
169
174 treenode<valuetype> *node);
175
180 treenode<valuetype> *node);
181
184 treenode<valuetype> *find(valuetype value);
185
190 valuetype value);
191
199 bool clear();
200
201 #include <rudiments/private/avltree.h>
202};
203
204#include <rudiments/private/avltreeinlines.h>
205
206#endif
Definition avltree.h:67
treenode< valuetype > * getTop()
Definition avltreeinlines.h:324
treenode< valuetype > * getLast()
Definition avltreeinlines.h:336
treenode< valuetype > * find(valuetype value)
Definition avltreeinlines.h:356
avltree< valuetype > & operator=(avltree< valuetype > &a)
Definition avltreeinlines.h:40
treenode< valuetype > * getFirst()
Definition avltreeinlines.h:330
bool remove(valuetype value)
Definition avltreeinlines.h:290
void insert(valuetype value)
Definition avltreeinlines.h:173
treenode< valuetype > * getPrevious(treenode< valuetype > *node)
Definition avltreeinlines.h:342
treenode< valuetype > * detach(treenode< valuetype > *node)
Definition avltreeinlines.h:262
bool removeAll(valuetype value)
Definition avltreeinlines.h:297
~avltree()
Definition avltreeinlines.h:167
bool clear()
Definition avltreeinlines.h:387
avltree()
Definition avltreeinlines.h:9
uint64_t getCount()
Definition avltreeinlines.h:318
treenode< valuetype > * getNext(treenode< valuetype > *node)
Definition avltreeinlines.h:349
Definition avltree.h:11
~avltreenode()
Definition avltreeinlines.h:567
treenode< valuetype > * getRightChild()
Definition avltreeinlines.h:602
treenode< valuetype > * getLeftChild()
Definition avltreeinlines.h:596
avltreenode(valuetype value)
Definition avltreeinlines.h:555
treenode< valuetype > * getParent()
Definition avltreeinlines.h:590
treenode< valuetype > * getNext()
Definition avltreeinlines.h:671
treenode< valuetype > * getPrevious()
Definition avltreeinlines.h:620
valuetype & getReference()
Definition avltreeinlines.h:584
uint8_t getLeftHeight()
Definition avltreeinlines.h:608
uint8_t getRightHeight()
Definition avltreeinlines.h:614
valuetype getValue()
Definition avltreeinlines.h:578
void setValue(valuetype value)
Definition avltreeinlines.h:572
Definition nodecollection.h:31
Definition treecollection.h:57
Definition treecollection.h:12