Rudiments
Public Member Functions | List of all members
avltreenode< valuetype > Class Template Reference

Public Member Functions

 avltreenode (valuetype value)
 
 ~avltreenode ()
 
valuetype getValue () const
 
int32_t compare (valuetype value) const
 
int32_t compare (avltreenode< valuetype > *peer) const
 
avltreenode< valuetype > * getParent ()
 
avltreenode< valuetype > * getLeftChild ()
 
avltreenode< valuetype > * getRightChild ()
 
uint8_t getLeftHeight ()
 
uint8_t getRightHeight ()
 
avltreenode< valuetype > * getPrevious ()
 
avltreenode< valuetype > * getNext ()
 
void print () const
 

Detailed Description

template<class valuetype>
class avltreenode< valuetype >

The avltreenode class stores the values that compose a avltree.

Constructor & Destructor Documentation

◆ avltreenode()

template<class valuetype>
avltreenode< valuetype >::avltreenode ( valuetype  value)

Creates an instance of the avltreenode class that stores value "value".

◆ ~avltreenode()

template<class valuetype>
avltreenode< valuetype >::~avltreenode ( )

Deletes this instance of the avltreenode class. Note however, that the value stored in the avltreenode is not deleted by this call.

Member Function Documentation

◆ compare() [1/2]

template<class valuetype>
int32_t avltreenode< valuetype >::compare ( valuetype  value) const

Returns a negative number, 0, or a positive number depending on whether the value stored in the node is respectively less than, equal to or greater than "value".

◆ compare() [2/2]

template<class valuetype>
int32_t avltreenode< valuetype >::compare ( avltreenode< valuetype > *  peer) const

Returns a negative number, 0, or a positive number depending on whether the value stored in the node is respectively less than, equal to or greater than the value stored in "peer".

◆ getLeftChild()

template<class valuetype>
avltreenode<valuetype>* avltreenode< valuetype >::getLeftChild ( )

Returns the left child of this node in the avltree or NULL if this node has no left child.

◆ getLeftHeight()

template<class valuetype>
uint8_t avltreenode< valuetype >::getLeftHeight ( )

Returns the left height of this node in the avltree.

◆ getNext()

template<class valuetype>
avltreenode<valuetype>* avltreenode< valuetype >::getNext ( )

Returns the next node in the avltree (in an in-order, depth-first traversal) or NULL if this node is the last node in the tree.

◆ getParent()

template<class valuetype>
avltreenode<valuetype>* avltreenode< valuetype >::getParent ( )

Returns the parent node in the avltree or NULL if this node is the top-most node in the tree.

◆ getPrevious()

template<class valuetype>
avltreenode<valuetype>* avltreenode< valuetype >::getPrevious ( )

Returns the previous node in the avltree (in an in-order, depth-first traversal) or NULL if this node is the first node in the tree.

◆ getRightChild()

template<class valuetype>
avltreenode<valuetype>* avltreenode< valuetype >::getRightChild ( )

Returns the right child of this node in the avltree or NULL if this node has no right child.

◆ getRightHeight()

template<class valuetype>
uint8_t avltreenode< valuetype >::getRightHeight ( )

Returns the right height of this node in the avltree.

◆ getValue()

template<class valuetype>
valuetype avltreenode< valuetype >::getValue ( ) const

Return the value stored in the node.

◆ print()

template<class valuetype>
void avltreenode< valuetype >::print ( ) const

Prints the value stored in the node.