42 template<
class objType,
class keyType >
56 template<
class objType,
class keyType,
int maxChildrenPerNode >
68 objType *
Find( keyType key )
const;
91 template<
class objType,
class keyType,
int maxChildrenPerNode >
93 assert( maxChildrenPerNode >= 4 );
97 template<
class objType,
class keyType,
int maxChildrenPerNode >
102 template<
class objType,
class keyType,
int maxChildrenPerNode >
107 template<
class objType,
class keyType,
int maxChildrenPerNode >
109 nodeAllocator.Shutdown();
113 template<
class objType,
class keyType,
int maxChildrenPerNode >
117 if ( root->numChildren >= maxChildrenPerNode ) {
119 newNode->
key = root->key;
123 root->parent = newNode;
134 if ( key > node->
key ) {
140 if ( key <= child->key ) {
147 if ( key <= child->key ) {
155 newNode->
next = child;
156 child->
prev = newNode;
164 newNode->
prev = child;
166 child->
next = newNode;
182 if ( key <= child->prev->key ) {
191 root->firstChild = newNode;
202 template<
class objType,
class keyType,
int maxChildrenPerNode >
224 if ( parent->
next ) {
225 parent = MergeNodes( parent, parent->
next );
226 }
else if ( parent->
prev ) {
227 parent = MergeNodes( parent->
prev, parent );
251 if ( root->numChildren == 1 && root->firstChild->object ==
NULL ) {
254 root = root->firstChild;
263 template<
class objType,
class keyType,
int maxChildrenPerNode >
268 while( node->
next ) {
269 if ( node->
key >= key ) {
275 if ( node->
key == key ) {
285 template<
class objType,
class keyType,
int maxChildrenPerNode >
290 while( node->
next ) {
291 if ( node->
key >= key ) {
297 if ( node->
key >= key ) {
307 template<
class objType,
class keyType,
int maxChildrenPerNode >
312 while( node->
prev ) {
313 if ( node->
key <= key ) {
319 if ( node->
key <= key ) {
329 template<
class objType,
class keyType,
int maxChildrenPerNode >
334 template<
class objType,
class keyType,
int maxChildrenPerNode >
336 return nodeAllocator.GetAllocCount();
339 template<
class objType,
class keyType,
int maxChildrenPerNode >
344 while( node && node->
next ==
NULL ) {
351 template<
class objType,
class keyType,
int maxChildrenPerNode >
359 while( node && node->
next ==
NULL ) {
374 template<
class objType,
class keyType,
int maxChildrenPerNode >
388 template<
class objType,
class keyType,
int maxChildrenPerNode >
390 nodeAllocator.Free( node );
393 template<
class objType,
class keyType,
int maxChildrenPerNode >
410 newNode->
key = child->
key;
430 newNode->
next = node;
431 node->
prev = newNode;
436 template<
class objType,
class keyType,
int maxChildrenPerNode >
468 template<
class objType,
class keyType,
int maxChildrenPerNode >
495 CheckTree_r( child, numNodes );
501 template<
class objType,
class keyType,
int maxChildrenPerNode >
506 CheckTree_r( root, numNodes );
509 assert( numNodes == nodeAllocator.GetAllocCount() );
512 lastNode = GetNextLeaf( GetRoot() );
514 for ( node = GetNextLeaf( lastNode ); node; lastNode = node, node = GetNextLeaf( node ) ) {
515 assert( lastNode->key <= node->key );
assert(prefInfo.fullscreenBtn)
void FreeNode(idBTreeNode< objType, keyType > *node)
idBTreeNode< objType, keyType > * root
void CheckTree_r(idBTreeNode< objType, keyType > *node, int &numNodes) const
idBlockAlloc< idBTreeNode< objType, keyType >, 128 > nodeAllocator
idBTreeNode< objType, keyType > * MergeNodes(idBTreeNode< objType, keyType > *node1, idBTreeNode< objType, keyType > *node2)
void Remove(idBTreeNode< objType, keyType > *node)
idBTreeNode< objType, keyType > * GetNextLeaf(idBTreeNode< objType, keyType > *node) const
idBTreeNode< objType, keyType > * Add(objType *object, keyType key)
idBTreeNode< objType, keyType > * AllocNode(void)
void SplitNode(idBTreeNode< objType, keyType > *node)
idBTreeNode< objType, keyType > * GetNext(idBTreeNode< objType, keyType > *node) const
idBTreeNode< objType, keyType > * GetRoot(void) const
objType * Find(keyType key) const
int GetNodeCount(void) const
objType * FindSmallestLargerEqual(keyType key) const
objType * FindLargestSmallerEqual(keyType key) const
void CheckTree(void) const