Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

GLIBTreeNode< Data, ConfigData > Class Template Reference

Templated node class for a templated GLIB balanced tree. More...

#include <GLIBNode.h>

List of all members.

Public Member Functions

 GLIBTreeNode (Data *data)
 Constructor.
virtual ~GLIBTreeNode ()
 Destructor.

Static Public Member Functions

static void DeleteAllGLIBTreeNodes (GLIBTreeNode< Data, ConfigData > *Node, DeleteTreeDataEnum DeleteTreeData)
 Delete Node and all its children.
static GLIBTreeNode< Data,
ConfigData > * 
Insert (GLIBTreeNode< Data, ConfigData > *Node, ACompareNodesAlgorithm< Data, ConfigData > *Compare, Data *NodeData, bool *Inserted)
 Recursively search for the correct place for a node and insert it.
static GLIBTreeNode< Data,
ConfigData > * 
Remove (GLIBTreeNode< Data, ConfigData > *Node, ACompareNodesAlgorithm< Data, ConfigData > *Compare, Data *NodeData)
 Delete a node from the tree.
static Data * Lookup (GLIBTreeNode< Data, ConfigData > *Node, ACompareNodesAlgorithm< Data, ConfigData > *Compare, Data *NodeData)
 Recursive search for data. If not found, return NULL.
static Data * Search (GLIBTreeNode< Data, ConfigData > *Node, ACompareNodesAlgorithm< Data, ConfigData > *Compare, Data *NodeData)
 Loop search for data. If not found, return NULL.
static int GetHeight (GLIBTreeNode< Data, ConfigData > *Node)
 Get height (depth) of the tree.
static int GetNodeCount (GLIBTreeNode< Data, ConfigData > *Node)
 Get the number of nodes in a tree.

Static Protected Member Functions

static GLIBTreeNode< Data,
ConfigData > * 
Balance (GLIBTreeNode< Data, ConfigData > *Node)
 Balance the node tree.
static GLIBTreeNode< Data,
ConfigData > * 
RemoveLeftmost (GLIBTreeNode< Data, ConfigData > *Node, GLIBTreeNode< Data, ConfigData > **Leftmost)
 Remove the leftmost node.
static GLIBTreeNode< Data,
ConfigData > * 
RestoreLeftBalance (GLIBTreeNode< Data, ConfigData > *Node, int OldBalance)
 Balance the left side of the tree.
static GLIBTreeNode< Data,
ConfigData > * 
RestoreRightBalance (GLIBTreeNode< Data, ConfigData > *Node, int OldBalance)
 Balance the right side of the tree.
static GLIBTreeNode< Data,
ConfigData > * 
RotateLeft (GLIBTreeNode< Data, ConfigData > *Node)
 Rotate node one node to the left.
static GLIBTreeNode< Data,
ConfigData > * 
RotateRight (GLIBTreeNode< Data, ConfigData > *Node)
 Rotate node one node to the right.

Protected Attributes

GLIBTreeNode< Data, ConfigData > * m_Left
 Pointer to the left node.
GLIBTreeNode< Data, ConfigData > * m_Right
 Pointer to the right node.
Data * m_Data
 Pointer to the data in the node.
signed char m_Balance
 Balance of the node - used to rebranch tree.


Detailed Description

template<class Data, class ConfigData>
class GLIBTreeNode< Data, ConfigData >

This class is based off of the GLIB implementation of a balanced tree written in C

Definition at line 17 of file GLIBNode.h.


Member Function Documentation

template<class Data, class ConfigData>
GLIBTreeNode< Data, ConfigData > * GLIBTreeNode< Data, ConfigData >::Balance GLIBTreeNode< Data, ConfigData > *  Node  )  [static, protected]
 

Parameters:
Node is the node that will be the base of the balance
Returns:
Returns the newly balanced node

Definition at line 349 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::m_Balance, GLIBTreeNode< Data, ConfigData >::m_Left, GLIBTreeNode< Data, ConfigData >::m_Right, GLIBTreeNode< Data, ConfigData >::RotateLeft(), and GLIBTreeNode< Data, ConfigData >::RotateRight().

Referenced by GLIBTreeNode< Data, ConfigData >::Insert(), GLIBTreeNode< Data, ConfigData >::RestoreLeftBalance(), and GLIBTreeNode< Data, ConfigData >::RestoreRightBalance().

template<class Data, class ConfigData>
void GLIBTreeNode< Data, ConfigData >::DeleteAllGLIBTreeNodes GLIBTreeNode< Data, ConfigData > *  Node,
DeleteTreeDataEnum  DeleteTreeData
[static]
 

Parameters:
Node is the node to be deleted (with its children)

Definition at line 472 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::m_Data, GLIBTreeNode< Data, ConfigData >::m_Left, and GLIBTreeNode< Data, ConfigData >::m_Right.

Referenced by GLIBTree< Data, ConfigData >::~GLIBTree().

template<class Data, class ConfigData>
int GLIBTreeNode< Data, ConfigData >::GetHeight GLIBTreeNode< Data, ConfigData > *  Node  )  [static]
 

Parameters:
Node is the node to start counting depth
Returns:
Height of the tree.

Definition at line 316 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::m_Left, and GLIBTreeNode< Data, ConfigData >::m_Right.

Referenced by GLIBTree< Data, ConfigData >::GetHeight().

template<class Data, class ConfigData>
int GLIBTreeNode< Data, ConfigData >::GetNodeCount GLIBTreeNode< Data, ConfigData > *  Node  )  [static]
 

Parameters:
Node is the node to start counting from
Returns:
Number of nodes in tree.

Definition at line 336 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::m_Left, and GLIBTreeNode< Data, ConfigData >::m_Right.

Referenced by GLIBTree< Data, ConfigData >::GetNumberOfNodes().

template<class Data, class ConfigData>
GLIBTreeNode< Data, ConfigData > * GLIBTreeNode< Data, ConfigData >::Insert GLIBTreeNode< Data, ConfigData > *  Node,
ACompareNodesAlgorithm< Data, ConfigData > *  Compare,
Data *  NodeData,
bool *  Inserted
[static]
 

Parameters:
Node is starting node to be searched
Compare is the algorithm used to compare nodes
NodeData is the data of the node to be inserted
Inserted is a flag to determine if the data was inserted
Returns:
A pointer to the node inserted or found

Definition at line 149 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::Balance(), GLIBTreeNode< Data, ConfigData >::m_Balance, GLIBTreeNode< Data, ConfigData >::m_Data, GLIBTreeNode< Data, ConfigData >::m_Left, and GLIBTreeNode< Data, ConfigData >::m_Right.

Referenced by GLIBTree< Data, ConfigData >::Insert().

template<class Data, class ConfigData>
Data * GLIBTreeNode< Data, ConfigData >::Lookup GLIBTreeNode< Data, ConfigData > *  Node,
ACompareNodesAlgorithm< Data, ConfigData > *  Compare,
Data *  NodeData
[static]
 

Parameters:
Node is the node to start searching from
Compare is the algorithm used to compare nodes
NodeData is the value being searched for.
Returns:
A pointer to the value found. NULL if data isn't found.

Definition at line 266 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::m_Data, GLIBTreeNode< Data, ConfigData >::m_Left, and GLIBTreeNode< Data, ConfigData >::m_Right.

Referenced by GLIBTree< Data, ConfigData >::Find().

template<class Data, class ConfigData>
GLIBTreeNode< Data, ConfigData > * GLIBTreeNode< Data, ConfigData >::Remove GLIBTreeNode< Data, ConfigData > *  Node,
ACompareNodesAlgorithm< Data, ConfigData > *  Compare,
Data *  NodeData
[static]
 

Parameters:
Node is the node to start searching from
Compare is the algorithm used to compare nodes
NodeData is the value of the node to be deleted (Data is not deleted!).
Returns:
New root of the tree

Definition at line 212 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::m_Balance, GLIBTreeNode< Data, ConfigData >::m_Data, GLIBTreeNode< Data, ConfigData >::m_Left, GLIBTreeNode< Data, ConfigData >::m_Right, GLIBTreeNode< Data, ConfigData >::RemoveLeftmost(), GLIBTreeNode< Data, ConfigData >::RestoreLeftBalance(), and GLIBTreeNode< Data, ConfigData >::RestoreRightBalance().

Referenced by GLIBTree< Data, ConfigData >::Delete().

template<class Data, class ConfigData>
GLIBTreeNode< Data, ConfigData > * GLIBTreeNode< Data, ConfigData >::RemoveLeftmost GLIBTreeNode< Data, ConfigData > *  Node,
GLIBTreeNode< Data, ConfigData > **  Leftmost
[static, protected]
 

Parameters:
Node is the node to start from
Leftmost is the node that is removed
Returns:
Pointer to a newly balanced tree

Definition at line 368 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::m_Left, GLIBTreeNode< Data, ConfigData >::m_Right, and GLIBTreeNode< Data, ConfigData >::RestoreLeftBalance().

Referenced by GLIBTreeNode< Data, ConfigData >::Remove().

template<class Data, class ConfigData>
GLIBTreeNode< Data, ConfigData > * GLIBTreeNode< Data, ConfigData >::RestoreLeftBalance GLIBTreeNode< Data, ConfigData > *  Node,
int  OldBalance
[static, protected]
 

Parameters:
Node is the node that will be the base of the balance
OldBalance is the balance of the starting node
Returns:
Pointer to a newly balanced tree

Definition at line 382 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::Balance(), GLIBTreeNode< Data, ConfigData >::m_Balance, and GLIBTreeNode< Data, ConfigData >::m_Left.

Referenced by GLIBTreeNode< Data, ConfigData >::Remove(), and GLIBTreeNode< Data, ConfigData >::RemoveLeftmost().

template<class Data, class ConfigData>
GLIBTreeNode< Data, ConfigData > * GLIBTreeNode< Data, ConfigData >::RestoreRightBalance GLIBTreeNode< Data, ConfigData > *  Node,
int  OldBalance
[static, protected]
 

Parameters:
Node is the node that will be the base of the balance
OldBalance is the balance of the starting node
Returns:
Pointer to a newly balanced tree

Definition at line 396 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::Balance(), GLIBTreeNode< Data, ConfigData >::m_Balance, and GLIBTreeNode< Data, ConfigData >::m_Right.

Referenced by GLIBTreeNode< Data, ConfigData >::Remove().

template<class Data, class ConfigData>
GLIBTreeNode< Data, ConfigData > * GLIBTreeNode< Data, ConfigData >::RotateLeft GLIBTreeNode< Data, ConfigData > *  Node  )  [static, protected]
 

Parameters:
Node is the node to be moved
Returns:
Node that replaced the moved node

Definition at line 410 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::m_Balance, GLIBTreeNode< Data, ConfigData >::m_Left, and GLIBTreeNode< Data, ConfigData >::m_Right.

Referenced by GLIBTreeNode< Data, ConfigData >::Balance().

template<class Data, class ConfigData>
GLIBTreeNode< Data, ConfigData > * GLIBTreeNode< Data, ConfigData >::RotateRight GLIBTreeNode< Data, ConfigData > *  Node  )  [static, protected]
 

Parameters:
Node is the node to be moved
Returns:
Node that replaced the moved node

Definition at line 442 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::m_Balance, GLIBTreeNode< Data, ConfigData >::m_Left, and GLIBTreeNode< Data, ConfigData >::m_Right.

Referenced by GLIBTreeNode< Data, ConfigData >::Balance().

template<class Data, class ConfigData>
Data * GLIBTreeNode< Data, ConfigData >::Search GLIBTreeNode< Data, ConfigData > *  Node,
ACompareNodesAlgorithm< Data, ConfigData > *  Compare,
Data *  NodeData
[static]
 

Parameters:
Node is the node to start searching from
Compare is the algorithm used to compare nodes
NodeData is the value being searched for.
Returns:
A pointer to the data found. NULL if data isn't found.

Definition at line 292 of file GLIBNode.h.

References GLIBTreeNode< Data, ConfigData >::m_Data, GLIBTreeNode< Data, ConfigData >::m_Left, and GLIBTreeNode< Data, ConfigData >::m_Right.

Referenced by GLIBTree< Data, ConfigData >::Search().


The documentation for this class was generated from the following file:
Generated on Sat Nov 5 11:20:17 2005 for Cpp Freecell Solver by  doxygen 1.4.4