AVLTree: Add convenience LeftMost/RightMost with no arguments.
They return the left and right most nodes of the entire tree, i.e. starting from the root node. Change-Id: I651a9db6d12308aef4c2ed71484958428e58c9bc Reviewed-on: https://review.haiku-os.org/c/haiku/+/2838 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
928d780bc9
commit
621f53700f
@@ -47,7 +47,9 @@ public:
|
||||
Value* Previous(Value* value) const;
|
||||
Value* Next(Value* value) const;
|
||||
|
||||
Value* LeftMost() const;
|
||||
Value* LeftMost(Value* value) const;
|
||||
Value* RightMost() const;
|
||||
Value* RightMost(Value* value) const;
|
||||
|
||||
inline Iterator GetIterator();
|
||||
@@ -258,6 +260,15 @@ AVLTree<Definition>::Next(Value* value) const
|
||||
}
|
||||
|
||||
|
||||
template<typename Definition>
|
||||
inline typename AVLTree<Definition>::Value*
|
||||
AVLTree<Definition>::LeftMost() const
|
||||
{
|
||||
AVLTreeNode* node = fTree.LeftMost();
|
||||
return node != NULL ? _GetValue(node) : NULL;
|
||||
}
|
||||
|
||||
|
||||
template<typename Definition>
|
||||
inline typename AVLTree<Definition>::Value*
|
||||
AVLTree<Definition>::LeftMost(Value* value) const
|
||||
@@ -270,6 +281,15 @@ AVLTree<Definition>::LeftMost(Value* value) const
|
||||
}
|
||||
|
||||
|
||||
template<typename Definition>
|
||||
inline typename AVLTree<Definition>::Value*
|
||||
AVLTree<Definition>::RightMost() const
|
||||
{
|
||||
AVLTreeNode* node = fTree.RightMost();
|
||||
return node != NULL ? _GetValue(node) : NULL;
|
||||
}
|
||||
|
||||
|
||||
template<typename Definition>
|
||||
inline typename AVLTree<Definition>::Value*
|
||||
AVLTree<Definition>::RightMost(Value* value) const
|
||||
|
||||
Reference in New Issue
Block a user