#include <OTC/collctn/avlnode.hh> class OTC_AVLNode : public OTC_MPObject {
public:
virtual ~OTC_AVLNode();
inline OTC_AVLNode* father() const;
inline OTC_AVLTree* tree() const;
inline OTC_Boolean isRoot() const;
inline OTC_AVLNode* left() const;
inline OTC_AVLNode* right() const;
inline OTC_Boolean isLeft() const;
inline OTC_Boolean isRight() const;
OTC_AVLNode* brother() const;
u_int level() const;
inline u_int count() const;
u_int index() const;
u_int height() const;
void addBefore(OTC_AVLNode* theNode);
void addAfter(OTC_AVLNode* theNode);
void swap(OTC_AVLNode* theNode);
void unlink();
protected:
OTC_AVLNode();
};
virtual ~OTC_AVLNode();
inline OTC_AVLNode* father() const;
0
is returned.
inline OTC_AVLTree* tree() const;
0
is returned.
inline OTC_Boolean isRoot() const;
OTCLIB_TRUE
if this node is a
root node of a tree. Will also return
OTCLIB_TRUE
if the node is not contained
within a tree at all.
inline OTC_AVLNode* left() const;
0
if there is no left subtree.
inline OTC_AVLNode* right() const;
0
if there is no right subtree.
inline OTC_Boolean isLeft() const;
OTCLIB_TRUE
if this node is the
root node of the left subtree of its
father node. This will always return
OTCLIB_FALSE
if this node is a root
node, or is not contained within a tree.
inline OTC_Boolean isRight() const;
OTCLIB_TRUE
if this node is the
root node of the right subtree of its
father node. This will always return
OTCLIB_FALSE
if this node is a root
node, or is not contained within a tree.
OTC_AVLNode* brother() const;
0
is returned.
u_int level() const;
0
.
inline u_int count() const;
1
.
u_int index() const;
u_int height() const;
void addBefore(OTC_AVLNode* theNode);
theNode
before this node in the
tree, based on an inorder traversal. Doing
this, will automatcially result in
the tree being rebalanced. Note that
due to the nature of balanced trees,
theNode
will not necessarily end up
being the left node of this node.
theNode
must not already be in a
tree; if it is, an exception is raised.
void addAfter(OTC_AVLNode* theNode);
theNode
after this node in the
tree, based on an inorder traversal.
Doing this, will automatcially result in
the tree being rebalanced. Note that
due to the nature of balanced trees,
theNode
will not necessarily end up
being the right node of this node.
theNode
must not already be in a
tree; if it is, an exception is raised.
void swap(OTC_AVLNode* theNode);
theNode
and
this node. This node must be in a tree,
if it isn't, an exception is raised.
void unlink();
OTC_AVLTree