#include <T2RedBlackTree.h>
Definition at line 50 of file T2RedBlackTree.h.
◆ T2GenericRedBlackTree()
T2GenericRedBlackTree::T2GenericRedBlackTree |
( |
T2Allocator * | pAllocator | ) |
|
|
inlineprotected |
Definition at line 53 of file T2RedBlackTree.h.
55 {
58 }
static constinit T2GenericRedBlackTreeNode ms_oNil
T2Allocator * m_pAllocator
T2GenericRedBlackTreeNode m_oRoot
◆ ~T2GenericRedBlackTree()
T2GenericRedBlackTree::~T2GenericRedBlackTree |
( |
| ) |
|
|
inlineprotected |
◆ DeleteFixUp()
Definition at line 92 of file T2RedBlackTree.cpp.
93{
95 T2GenericRedBlackTreeNode* pTVar1;
96 T2GenericRedBlackTreeNode* pTVar3;
97 T2GenericRedBlackTreeNode* pTVar4;
98
100 while ( pNode->
red == 0 && pTVar4 != pNode )
101 {
104
105 if ( pNode == pTVar1 )
106 {
108
109 if ( pTVar1->
red != 0 )
110 {
116 }
117
119 if ( ( uVar2 == 0 ) && ( pTVar1->
m_pLeft->
red == 0 ) )
120 {
123 }
124 else
125 {
126 if ( uVar2 == 0 )
127 {
133 }
134
135 pTVar1->
red = pTVar3->
red;
139 pNode = pTVar4;
140 }
141 }
142 else
143 {
144 if ( pTVar1->
red != 0 )
145 {
151 }
152
154 {
157 }
158 else
159 {
161 {
167 }
168
169 pTVar1->
red = pTVar3->
red;
173 pNode = pTVar4;
174 }
175 }
176 }
177
179 CheckValid();
180}
T2GenericRedBlackTreeNode * m_pParent
T2GenericRedBlackTreeNode * m_pRight
T2GenericRedBlackTreeNode * m_pLeft
void LeftRotate(T2GenericRedBlackTreeNode *pNode)
void RightRotate(T2GenericRedBlackTreeNode *pNode)
◆ DeleteNode()
Definition at line 182 of file T2RedBlackTree.cpp.
183{
184 T2GenericRedBlackTreeNode* pTVar1;
185 T2GenericRedBlackTreeNode* y;
186 T2GenericRedBlackTreeNode* pTVar3;
187
188 y = pNode;
190 {
192 }
193
196 {
198 }
199
202
204 {
206 }
207 else
208 {
210
212 {
214 }
215 else
216 {
218 }
219 }
220
221 if ( y == pNode )
222 {
224 {
226 }
227
228 CheckValid();
231
232 return y;
233 }
234
236
243
244 if ( pNode == pTVar1->
m_pLeft )
245 {
247 }
248 else
249 {
251 }
252
255
256 if ( oldRedValue == 0 )
257 {
259 }
260
261 CheckValid();
264 return pNode;
265}
static T2GenericRedBlackTreeNode * GetSuccessorOf(const T2GenericRedBlackTreeNode *pNode)
void DeleteFixUp(T2GenericRedBlackTreeNode *pNode)
◆ GetAllocator()
T2Allocator * T2GenericRedBlackTree::GetAllocator |
( |
| ) |
const |
|
inlineprotected |
◆ GetFirstNode()
Definition at line 14 of file T2RedBlackTree.cpp.
15{
16 T2GenericRedBlackTreeNode* pCurrentNode = &
m_oRoot;
17 T2GenericRedBlackTreeNode* pResult =
TNULL;
18
19 while ( pCurrentNode != &
ms_oNil )
20 {
21 pResult = pCurrentNode;
22 pCurrentNode = pResult->
m_pLeft;
23 }
24
25 return pResult;
26}
◆ GetNumElements()
size_t T2GenericRedBlackTree::GetNumElements |
( |
| ) |
const |
|
inlineprotected |
◆ GetPredecessorOf()
Definition at line 366 of file T2RedBlackTree.cpp.
367{
368 T2GenericRedBlackTreeNode* pTVar1;
369 T2GenericRedBlackTreeNode* pTVar2 = pNode->
m_pLeft;
371
373 {
375 if ( pNode == pTVar2->
m_pLeft )
376 {
377 do
378 {
380
381 if ( pTVar1 == pTVar2 )
382 {
384 }
385
386 bVar3 = pTVar2 == pTVar1->
m_pLeft;
387 pTVar2 = pTVar1;
388 } while ( bVar3 );
389
390 return pTVar1;
391 }
392 }
393 else
394 {
396
398 {
399 do
400 {
401 pTVar2 = pTVar1;
404 }
405 }
406
407 return pTVar2;
408}
◆ GetSuccessorOf()
Definition at line 327 of file T2RedBlackTree.cpp.
328{
329 T2GenericRedBlackTreeNode* pTVar1;
330 T2GenericRedBlackTreeNode* pTVar2;
331 bool bVar3;
332
335 {
337 pTVar2 = pTVar1;
339 {
340 do {
343 pTVar2 = pTVar1;
344 } while ( bVar3 );
345 }
347 {
349 }
350 }
351 else
352 {
355 {
356 do {
357 pTVar1 = pTVar2;
359 }
while ( pTVar2 != &
ms_oNil );
360 return pTVar1;
361 }
362 }
363 return pTVar1;
364}
◆ Insert()
Definition at line 28 of file T2RedBlackTree.cpp.
29{
30 T2GenericRedBlackTreeNode* pNode_00;
31 T2GenericRedBlackTreeNode* pTVar1;
32 T2GenericRedBlackTreeNode* node;
33
36 node = pNode;
37
39 {
41 if ( pNode_00 == pTVar1 )
42 {
44
45 if ( pTVar1->
red == 0 )
46 {
48 {
50 node = pNode_00;
51 }
52
56 }
57 else
58 {
63 }
64 }
65 else if ( pTVar1->
red == 0 )
66 {
67 if ( node == pNode_00->
m_pLeft )
68 {
70 node = pNode_00;
71 }
72
76 }
77 else
78 {
83 }
84 }
85
87 CheckValid();
88
89 return pNode;
90}
◆ LeftRotate()
Definition at line 267 of file T2RedBlackTree.cpp.
268{
269 T2GenericRedBlackTreeNode* pTVar1;
270 T2GenericRedBlackTreeNode* pTVar2;
271
274
276 {
278 }
279
282
283 if ( pNode == pTVar1->
m_pLeft )
284 {
286 }
287 else
288 {
290 }
291
294 CheckValid();
295}
◆ RightRotate()
Definition at line 297 of file T2RedBlackTree.cpp.
298{
299 T2GenericRedBlackTreeNode* pTVar1;
300 T2GenericRedBlackTreeNode* pTVar2;
301
304
306 {
308 }
309
312
313 if ( pNode == pTVar1->
m_pLeft )
314 {
316 }
317 else
318 {
320 }
321
324 CheckValid();
325}
◆ m_iNumElements
size_t T2GenericRedBlackTree::m_iNumElements |
|
protected |
◆ m_oRoot
◆ m_pAllocator
◆ ms_oNil
The documentation for this class was generated from the following files: