Rudiments
avltreeinlines.h
1// Copyright (c) 1999-2018 David Muse
2// See the COPYING file for more information
3
4#include <rudiments/stdio.h>
5#include <rudiments/private/nodeinlines.h>
6
7template <class valuetype>
8inline
10 treecollection<valuetype>(),
11 top(NULL),
12 first(NULL),
13 last(NULL),
14 count(0) {
15}
16
17template <class valuetype>
18inline
20 treecollection<valuetype>(a) {
21 clone(&a);
22}
23
24template <class valuetype>
25inline
27 treecollection<valuetype>(a) {
28 clone(&a);
29}
30
31template <class valuetype>
32inline
34 treecollection<valuetype>(a) {
35 clone(&a);
36}
37
38template <class valuetype>
39inline
42 if (this!=&a) {
43 clear();
45 clone(&a);
46 }
47 return *this;
48}
49
50template <class valuetype>
51inline
54 if (this!=&a) {
55 clear();
57 clone(&a);
58 }
59 return *this;
60}
61
62template <class valuetype>
63inline
66 if (this!=&a) {
67 clear();
69 clone(&a);
70 }
71 return *this;
72}
73
74template <class valuetype>
75inline
77 top=NULL;
78 first=NULL;
79 last=NULL;
80 count=tree->getCount();
81
82 if (tree->getTop()) {
83
84 // clone the tree
85 top=cloneNode(tree->getTop());
86
87 // update first
88 for (first=top;
89 first->getLeftChild();
90 first=first->getLeftChild()) {}
91
92 // update last
93 for (last=top;
94 last->getRightChild();
95 last=last->getRightChild()) {}
96 }
97}
98
99template <class valuetype>
100inline
102 top=NULL;
103 first=NULL;
104 last=NULL;
105 count=0;
106
107 if (coll->getFirst()) {
108
109 // clone the collection...
110 bool managevalues=this->getManageValues();
111 bool managearrayvalues=this->getManageArrayValues();
112 for (nodecollectionnode<valuetype> *node=coll->getFirst();
113 node; node=node->getNext()) {
114 insert(node_duplicate_value(
115 &(node->getReference()),
116 managevalues,managearrayvalues));
117 }
118
119 // update first
120 for (first=top;
121 first->getLeftChild();
122 first=first->getLeftChild()) {}
123
124 // update last
125 for (last=top;
126 last->getRightChild();
127 last=last->getRightChild()) {}
128 }
129}
130
131template <class valuetype>
132inline
134 treenode<valuetype> *node) {
135
136 // create a new node
138
139 // copy the value
140 newnode->setValue(node_duplicate_value(&(node->getReference()),
141 this->getManageValues(),
142 this->getManageArrayValues()));
143
144 // clone the left side
145 if (node->getLeftChild()) {
147 cloneNode(node->getLeftChild());
148 newleft->setParent(newnode);
149 newnode->setLeftChild(newleft);
150 }
151 newnode->setLeftHeight(node->getLeftHeight());
152
153 // clone the right side
154 if (node->getRightChild()) {
156 cloneNode(node->getRightChild());
157 newright->setParent(newnode);
158 newnode->setRightChild(newright);
159 }
160 newnode->setRightHeight(node->getRightHeight());
161
162 return newnode;
163}
164
165template <class valuetype>
166inline
168 clear();
169}
170
171template <class valuetype>
172inline
174 insert(new avltreenode<valuetype>(value));
175}
176
177template <class valuetype>
178inline
180
181 // degenerate case
182 if (!node) {
183 return;
184 }
185
186 if (top) {
187
188 // insert the node, optionally replacing the top of the tree
189 insert(top,node,&top);
190
191 // update first
192 for (first=top;
193 first->getLeftChild();
194 first=first->getLeftChild()) {}
195
196 // update last
197 for (last=top;
198 last->getRightChild();
199 last=last->getRightChild()) {}
200 } else {
201
202 // if there was no top node, then this is the
203 // first node inserted into the entire tree
204 top=node;
205 first=node;
206 last=node;
207 }
208
209 // increment count
210 count++;
211}
212
213template <class valuetype>
214inline
218
219 // degenerate case
220 if (!node) {
221 return;
222 }
223
224 // find a location to insert the node (should always be a leaf node)
226 for (;;) {
227
228 if (this->getComparator()->compare(node->getValue(),
229 location->getValue())<=0) {
230
231 if (location->getLeftChild()) {
233 } else {
234 location->setLeftChild(node);
235 break;
236 }
237
238 } else if (this->getComparator()->compare(
239 node->getValue(),
240 location->getValue())>0) {
241
242 if (location->getRightChild()) {
244 } else {
245 location->setRightChild(node);
246 break;
247 }
248 }
249 }
250
251 node->setParent(location);
252
253 // update heights up the tree
254 top->adjustParentHeights(node);
255
256 // balance the tree
257 node->getParent()->balance(treetop);
258}
259
260template <class valuetype>
261inline
263
264 // degenerate case
265 if (!node) {
266 return NULL;
267 }
268
269 // update first
270 if (first==node) {
271 first=node->getNext();
272 }
273
274 // update last
275 if (last==node) {
276 last=node->getPrevious();
277 }
278
279 // detach the node
280 node->detach(&top);
281
282 // decrement count
283 count--;
284
285 return node;
286}
287
288template <class valuetype>
289inline
291 treenode<valuetype> *current=find(value);
292 return (current)?remove(current):false;
293}
294
295template <class valuetype>
296inline
298 bool removed=false;
299 while (remove(value)) {
300 removed=true;
301 }
302 return removed;
303}
304
305template <class valuetype>
306inline
309 node_delete_value(&(detachednode->getReference()),
310 this->getManageValues(),
311 this->getManageArrayValues());
312 delete detachednode;
313 return true;
314}
315
316template <class valuetype>
317inline
319 return count;
320}
321
322template <class valuetype>
323inline
327
328template <class valuetype>
329inline
333
334template <class valuetype>
335inline
339
340template <class valuetype>
341inline
346
347template <class valuetype>
348inline
353
354template <class valuetype>
355inline
357 return find((treenode<valuetype> *)top,value);
358}
359
360template <class valuetype>
361inline
364 valuetype value) {
365
366 // descend the tree until we find the value or run off of the bottom
368 while (current) {
369
370 int32_t result=this->getComparator()->compare(
371 current->getValue(),value);
372
373 if (result<0) {
375 } else if (result==0) {
376 break;
377 } else if (result>0) {
379 }
380 }
381
382 return current;
383}
384
385template <class valuetype>
386inline
388
389 bool managevalues=this->getManageValues();
390 bool managearrayvalues=this->getManageArrayValues();
391
392 // start at the top
394 while (node) {
395
396 // go left as far as possible
397 while (node->getLeftChild()) {
399 }
400
401 // go right as far as possible
402 while (node->getRightChild()) {
404 }
405
406 // remove this node from its parent
408 if (p) {
409 if (p->getLeftChild()==node) {
410 p->setLeftChild(NULL);
411 } else {
412 p->setRightChild(NULL);
413 }
414 }
415
416 // delete the value in the node
417 node_delete_value(&(node->getReference()),
418 managevalues,managearrayvalues);
419
420 // delete the node itself
421 delete node;
422
423 // continue with the parent...
424 node=p;
425 }
426
427 // clear pointers and count
428 top=NULL;
429 first=NULL;
430 last=NULL;
431 count=0;
432
433 return true;
434}
435
436template <class valuetype>
437inline
440 const char *name,
441 uint16_t *indentlevel,
442 bool details,
443 bool indent) {
444
445 // FIXME: pay attention to indent
446
452 uint8_t leftheight=n->getLeftHeight();
453 uint8_t rightheight=n->getRightHeight();
454
455 ssize_t retval=0;
456
457 // print an xml-style representation of the node and its descendents
458 for (uint16_t i=0; i<*indentlevel && retval>-1; i++) {
459 this->incOrErr(&retval,out->write(' '),1);
460 }
461 this->incOrErr(&retval,out->printf("<%s v=\"",name)) &&
462 this->incOrErr(&retval,this->writeValue(out,n->getValue())) &&
463 this->incOrErr(&retval,out->write('"'),1) &&
464 ((details)?this->incOrErr(&retval,out->printf(
465 " lh=\"%d\" rh=\"%d\" bf=\"%d\"",
466 leftheight,rightheight,
467 leftheight-rightheight)):true);
468 if (left || right) {
469 this->incOrErr(&retval,out->write(">\n",2),2);
470 (*indentlevel)++;
471 if (retval>-1 && left) {
472 this->incOrErr(&retval,
473 writeNodeXml(out,left,"l",
474 indentlevel,details,indent));
475 }
476 if (retval>-1 && right) {
477 this->incOrErr(&retval,
478 writeNodeXml(out,right,"r",
479 indentlevel,details,indent));
480 }
481 (*indentlevel)--;
482 for (uint16_t i=0; i<*indentlevel && retval>-1; i++) {
483 this->incOrErr(&retval,out->write(' '));
484 }
485 this->incOrErr(&retval,out->printf("</%s>\n",name));
486 } else {
487 this->incOrErr(&retval,out->write("/>\n",3),3);
488 }
489 return retval;
490}
491
492template <class valuetype>
493inline
496 uint16_t *indentlevel,
497 bool indent) {
498
504
505 ssize_t retval=0;
506
507 if (*indentlevel) {
508 this->incOrErr(&retval,out->write(','),1) &&
509 ((indent)?this->incOrErr(&retval,out->write('\n'),1):true);
510 }
511 if (indent) {
512 for (uint16_t i=0; i<*indentlevel && retval>-1; i++) {
513 this->incOrErr(&retval,out->write(" ",2),2);
514 }
515 }
516 this->incOrErr(&retval,out->write('['),1) &&
517 ((indent)?this->incOrErr(&retval,out->write('\n'),1):true);
518 if (indent) {
519 for (uint16_t i=0; i<*indentlevel+1 && retval>-1; i++) {
520 this->incOrErr(&retval,out->write(" ",2),2);
521 }
522 }
523 this->incOrErr(&retval,this->writeJsonValue(out,n->getValue()));
524
525 if (left || right) {
526 (*indentlevel)++;
527 if (retval>-1 && left) {
528 this->incOrErr(&retval,
529 writeNodeJson(out,left,indentlevel,indent));
530 }
531 if (retval>-1 && right) {
532 this->incOrErr(&retval,
533 writeNodeJson(out,right,indentlevel,indent));
534 }
535 (*indentlevel)--;
536 }
537
538 if (indent) {
539 this->incOrErr(&retval,out->write('\n'),1);
540 for (uint16_t i=0; i<*indentlevel && retval>-1; i++) {
541 this->incOrErr(&retval,out->write(" ",2),2);
542 }
543 }
544 this->incOrErr(&retval,out->write(']'),1);
545 if (indent) {
546 if (!*indentlevel) {
547 this->incOrErr(&retval,out->write('\n'),1);
548 }
549 }
550 return retval;
551}
552
553template <class valuetype>
554inline
557 value(value),
558 parent(NULL),
559 left(NULL),
560 right(NULL),
561 leftheight(0),
562 rightheight(0) {
563}
564
565template <class valuetype>
566inline
569
570template <class valuetype>
571inline
573 this->value=value;
574}
575
576template <class valuetype>
577inline
581
582template <class valuetype>
583inline
587
588template <class valuetype>
589inline
593
594template <class valuetype>
595inline
599
600template <class valuetype>
601inline
605
606template <class valuetype>
607inline
609 return leftheight;
610}
611
612template <class valuetype>
613inline
615 return rightheight;
616}
617
618template <class valuetype>
619inline
621
622 // reverse in-order, depth-first traversal...
623
624 if (left) {
625
626 // if we have a left child then its rightmost descendent
627 // contains the next lowest value...
628
629 // go left
631
632 // go as far right as possible
633 while (node->getRightChild()) {
635 }
636 return node;
637
638 } else if (parent) {
639
640 // if we're the right child of our parent,
641 // then our parent contains the next lowest value
642 //
643 // Why the weird cast? I really don't know. gcc 2.95.2 on
644 // some platforms (os 10.0, 10.1, and mklinux) require it, but
645 // oddly don't in other cases of comparing left/right child to
646 // this.
647 if ((treenode<valuetype> *)parent->getRightChild()==
648 (treenode<valuetype> *)this) {
649 return parent;
650 }
651
652 // If we're the left child of our parent, then we have to
653 // move up until we find an acestor that's the right child of
654 // its parent. That node contains the next lowest value.
656 while (node) {
657 if (!node->getParent()) {
658 break;
659 }
660 if (node->getParent()->getRightChild()==node) {
661 return node->getParent();
662 }
664 }
665 }
666 return NULL;
667}
668
669template <class valuetype>
670inline
672
673 // in-order, depth-first traversal...
674
675 if (right) {
676
677 // if we have a right child then its leftmost descendent
678 // contains the next highest value...
679
680 // go right
682
683 // go as far left as possible
684 while (node->getLeftChild()) {
686 }
687 return node;
688
689 } else if (parent) {
690
691 // if we're the left child of our parent,
692 // then our parent contains the next highest value
693 //
694 // Why the weird cast? I really don't know. gcc 2.95.2 on
695 // some platforms (os 10.0, 10.1, and mklinux) require it, but
696 // oddly don't in other cases of comparing left/right child to
697 // this.
698 if ((treenode<valuetype> *)parent->getLeftChild()==
699 (treenode<valuetype> *)this) {
700 return parent;
701 }
702
703 // If we're the right child of our parent, then we have to
704 // move up until we find an acestor that's the left child of
705 // its parent. That node contains the next highest value.
707 while (node) {
708 if (!node->getParent()) {
709 break;
710 }
711 if (node->getParent()->getLeftChild()==node) {
712 return node->getParent();
713 }
715 }
716 }
717 return NULL;
718}
719
720template <class valuetype>
721inline
723 parent=node;
724}
725
726template <class valuetype>
727inline
729 left=node;
730}
731
732template <class valuetype>
733inline
735 right=node;
736}
737
738template <class valuetype>
739inline
741 leftheight=height;
742}
743
744template <class valuetype>
745inline
747 rightheight=height;
748}
749
750template <class valuetype>
751inline
753
754 if (left && right) {
755
756 // node with left and right children...
757
758 // get this node's successor...
759 //
760 // (eg. if the tree contains values 5, 7, 10, 12, 15, and 18,
761 // and this node is 10, then find the node with 12 in it)
762 //
763 // following the rules from our in-order, depth-first traversal
764 // above, since we have a right child, we must go right one,
765 // then go left as far as possible
767 while (successor->getLeftChild()) {
769 }
770
771 // if the successor was the immediate right child of this node
772 // then we need to handle a few things differently later
774
775
776 // swap this node with the successor...
777
778 // get a copy of the successor
781
782 // re-parent the successor
783 successor->setParent(parent);
784 if (successor->getParent()) {
785 if (successor->getParent()->getLeftChild()==this) {
787 setLeftChild(successor);
788 } else {
790 setRightChild(successor);
791 }
792 } else {
794 }
795
796 // replace the successor's children
797 // with those of this node
798 successor->setLeftChild(left);
799 if (successor->getLeftChild()) {
800 successor->getLeftChild()->setParent(successor);
801 }
803 successor->setRightChild(this);
804 successor->getRightChild()->setParent(successor);
805 } else {
806 successor->setRightChild(right);
807 if (successor->getRightChild()) {
809 setParent(successor);
810 }
811
812 // re-parent this node
813 parent=temp.parent;
814 if (parent->getLeftChild()==successor) {
815 parent->setLeftChild(this);
816 } else {
817 parent->setRightChild(this);
818 }
819 }
820
821 // replace the successor's heights
822 // with those of this node
823 successor->setLeftHeight(leftheight);
824 successor->setRightHeight(rightheight);
825
826
827 // replace this node's children
828 // with those of the successor
829 left=temp.left;
830 if (left) {
831 left->setParent(this);
832 }
833 right=temp.right;
834 if (right) {
835 right->setParent(this);
836 }
837
838 // replace this node's heights
839 // with those of the successor
840 leftheight=temp.getLeftHeight();
841 rightheight=temp.getRightHeight();
842
843 // fall through to the code below because now
844 // the node should have one or zero children...
845 }
846
847 // node with one or zero children...
848
849 // decide which child the node has
850 // NOTE: If the node has no children then this will implicitly
851 // set child=NULL (which is what we want in that case) because
852 // right=NULL.
853 treenode<valuetype> *child=(left)?left:right;
854
855 if (parent) {
856
857 // disconnect this node from its children
858 left=NULL;
859 right=NULL;
860
861 // connect the parent to the child
862 // (or to NULL if the node has no children)
863 // decrement the appropriate height of parent
864 if (parent->getLeftChild()==this) {
865 parent->setLeftChild(child);
866 parent->setLeftHeight(parent->getLeftHeight()-1);
867 } else {
868 parent->setRightChild(child);
869 parent->setRightHeight(parent->getRightHeight()-1);
870 }
871
872 // connect the child to the parent
873 if (child) {
874 child->setParent(parent);
875 }
876
877 // disconnect this node from its parent
878 // (but keep track of the parent so we
879 // can use it to balance)
880 treenode<valuetype> *p=parent;
881 parent=NULL;
882
883 // update heights up the tree
884 adjustParentHeights(p);
885
886 // balance the tree
887 p->balance(treetop);
888
889 } else {
890
891 // disconnect this node's child from it
892 if (child) {
893 child->setParent(NULL);
894 }
895
896 // disconnect this node from its children
897 left=NULL;
898 right=NULL;
899
900 // NOTE: If the node has no children, then this will
901 // implicitly (re)set treetop=NULL, which is what
902 // we want in that case.
903 *treetop=child;
904 }
905}
906
907template <class valuetype>
908inline
910
911 // move up the tree, starting with the parent of "node"...
912 while (node->getParent()) {
913
914 // calculate the new height of the parent
915 uint8_t height=((node->getLeftHeight()>
918 node->getRightHeight())+1;
919
920 // If "node" is the left child of the parent, then adjust the
921 // parent's left height.
922 // If "node" is the right child of the parent, then adjust the
923 // parent's right height.
924 // In either case, bail if the height is already the same as we
925 // calculated.
926 if (node->getParent()->getLeftChild()==node) {
927 if (node->getParent()->getLeftHeight()==height) {
928 return;
929 }
930 node->getParent()->setLeftHeight(height);
931 } else {
932 if (node->getParent()->getRightHeight()==height) {
933 return;
934 }
935 node->getParent()->setRightHeight(height);
936 }
937
938 // move up
940 }
941}
942
943template <class valuetype>
944inline
946
947 // AVL balance...
948
949 // start balancing with the current node
951 while (node) {
952
953 // there's an imbalance if the left and right
954 // tree heights differ by more than 1
959
960 // apply the appropriate rotation to restore balance
961 // and let the rotation method tell us whch node to
962 // process next
966 node=node->leftRotate(treetop);
967 } else {
968 node=node->rightLeftRotate(treetop);
969 }
970 } else if (node->getLeftHeight()>
971 node->getRightHeight()) {
973 node->getLeftChild()->
974 getRightHeight()) {
975 node=node->rightRotate(treetop);
976 } else {
977 node=node->leftRightRotate(treetop);
978 }
979 }
980
981 } else {
982
983 // if there's no imbalance then the next node we need
984 // to process is the parent of the current node
986 }
987 }
988}
989
990template <class valuetype>
991inline
994
995 /* one of these: (eg: insert order a,b,c)
996 *
997 * \
998 * a
999 * / \ \
1000 * b -> b
1001 * / \ / \
1002 * * c a c
1003 * / \ / \ / \
1004 * *
1005 * needs left rotation */
1006
1007 // get a, b, and "star"
1008 treenode<valuetype> *a=this;
1011 uint8_t starheight=b->getLeftHeight();
1012
1013 // move b
1015 if (p) {
1016 if (p->getRightChild()==a) {
1017 p->setRightChild(b);
1018 } else {
1019 p->setLeftChild(b);
1020 }
1021 } else {
1022 *treetop=b;
1023 }
1024 b->setParent(a->getParent());
1025 b->setLeftChild(a);
1026
1027 // move a
1028 a->setParent(b);
1029 a->setRightChild(star);
1030 a->setRightHeight(starheight);
1031
1032 // move "star"
1033 if (star) {
1034 star->setParent(a);
1035 }
1036
1037 // update heights up the tree
1038 adjustParentHeights(a);
1039
1040 // Since a was moved into a location in the tree that may not have
1041 // prevoiusly existed, and thus may have unbalanced the tree, we need
1042 // to continue balancing, starting at a.
1043 return a;
1044}
1045
1046template <class valuetype>
1047inline
1050
1051 /* one of these: (eg: insert order a,c,b)
1052 *
1053 * \ \
1054 * a a
1055 * / \ / \ \
1056 * c -> b -> b
1057 * / \ / \ / \
1058 * b c a c
1059 * / \ / \ / \ / \
1060 * * *
1061 *
1062 * needs right-left rotation */
1063
1064 // do the right part of the right-left rotation...
1065
1066 // get a, c, b, and "star"
1067 treenode<valuetype> *a=this;
1071 uint8_t starheight=b->getRightHeight();
1072
1073 // move b
1074 a->setRightChild(b);
1075 b->setParent(a);
1076 b->setRightChild(c);
1077
1078 // move c
1079 c->setParent(b);
1080 c->setLeftChild(star);
1081 c->setLeftHeight(starheight);
1082
1083 // move "star"
1084 if (star) {
1085 star->setParent(c);
1086 }
1087
1088 // update heights up the tree
1089 adjustParentHeights(c);
1090
1091 // do the left part of the right-left rotation
1092 leftRotate(treetop);
1093
1094 // Since c was moved into a location in the tree that may not have
1095 // prevoiusly existed, and thus may have unbalanced the tree, we need
1096 // to continue balancing, starting at c.
1097 return c;
1098}
1099
1100template <class valuetype>
1101inline
1104
1105 /* one of these: (insert order c,b,a)
1106 *
1107 * \
1108 * c
1109 * / \ \
1110 * b -> b
1111 * / \ / \
1112 * a * a c
1113 * / \ / \ / \
1114 * *
1115 * needs right rotation */
1116
1117 // get c, b, and "star"
1118 treenode<valuetype> *c=this;
1121 uint8_t starheight=b->getRightHeight();
1122
1123 // move b
1125 if (p) {
1126 if (p->getRightChild()==c) {
1127 p->setRightChild(b);
1128 } else {
1129 p->setLeftChild(b);
1130 }
1131 } else {
1132 *treetop=b;
1133 }
1134 b->setParent(c->getParent());
1135 b->setRightChild(c);
1136
1137 // move c
1138 c->setParent(b);
1139 c->setLeftChild(star);
1140 c->setLeftHeight(starheight);
1141
1142 // move "star"
1143 if (star) {
1144 star->setParent(c);
1145 }
1146
1147 // update heights up the tree
1148 adjustParentHeights(c);
1149
1150 // Since c was moved into a location in the tree that may not have
1151 // prevoiusly existed, and thus may have unbalanced the tree, we need
1152 // to continue balancing, starting at c.
1153 return c;
1154}
1155
1156template <class valuetype>
1157inline
1160
1161 /* one of these: (insert order c,a,b)
1162 *
1163 * \ \
1164 * c c
1165 * / \ / \ \
1166 * a -> b -> b
1167 * / \ / \ / \
1168 * b a a c
1169 * / \ / \ / \
1170 * * *
1171 *
1172 * needs left-right rotation */
1173
1174 // do the left part of the left-right rotation...
1175
1176 // get c, a, b, and "star"
1177 treenode<valuetype> *c=this;
1181 uint8_t starheight=b->getLeftHeight();
1182
1183 // move b
1184 c->setLeftChild(b);
1185 b->setParent(c);
1186 b->setLeftChild(a);
1187
1188 // move a
1189 a->setParent(b);
1190 a->setRightChild(star);
1191 a->setRightHeight(starheight);
1192
1193 // move "star"
1194 if (star) {
1195 star->setParent(a);
1196 }
1197
1198 // update heights up the tree
1199 adjustParentHeights(a);
1200
1201 // do the right part of the left-right rotation
1202 rightRotate(treetop);
1203
1204 // Since a was moved into a location in the tree that may not have
1205 // prevoiusly existed, and thus may have unbalanced the tree, we need
1206 // to continue balancing, starting at a.
1207 return a;
1208}
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
collection & operator=(collection &c)
Definition collectioninlines.h:30
Definition nodecollection.h:31
virtual nodecollectionnode< valuetype > * getFirst()=0
Definition nodecollection.h:12
Definition output.h:11
virtual ssize_t printf(const char *format,...)
Definition outputinlines.h:25
virtual ssize_t write(const byte_t *string, size_t size)=0
Definition treecollection.h:57
Definition treecollection.h:12