TAVLTree class
AVL tree component.
Declaration
TAVLTree = classDescends from it: TAvgLvlTree
Description
TAVLTree maintains a balanced AVL tree. The tree consists of
TAVLTreeNode nodes, each of which has a
Data pointer
associated with it. The
TAVLTree component offers methods to
balance and search the tree.
By default, the list is searched with a simple pointer comparison algorithm, but a custom search mechanism can be specified in the OnCompare property.
See also
Properties
NodeClass | public | Node class to create. |
Root | public | Root node of the tree. |
Count | public | Number of nodes in the tree. |
Methods
BalanceAfterInsert | protected | |
BalanceAfterDelete | protected | |
DeletingNode | protected | |
FindInsertPos | protected | |
Init | protected | |
NodeAdded | protected | |
RotateLeft | protected | |
RotateRight | protected | |
SwitchPositionWithSuccessor | protected | |
SetOnCompare | protected | |
SetOnObjectCompare | protected | |
SetCompares | protected | |
SetNodeClass | protected | |
Create | public | Create a new instance of TAVLTree. |
CreateObjectCompare | public | Create an instance of the tree with extended compare method. |
Destroy | public | Destroy the TAVLTree instance. |
SetNodeManager | public | Set the node instance manager to use. |
NewNode | public | Create a new tree node. |
DisposeNode | public | Dispose of a node outside of the tree. |
Add | public | Add a new node to the tree. |
AddAscendingSequence | public | |
Delete | public | Delete a node from the tree. |
Remove | public | Remove a data item from the list. |
RemovePointer | public | Remove a pointer item from the list. |
MoveDataLeftMost | public | Move data to the nearest left element. |
MoveDataRightMost | public | Move data to the nearest right element. |
Clear | public | Clears the tree. |
FreeAndClear | public | Clears the tree and frees nodes. |
FreeAndDelete | public | Delete a node from the tree and destroy it. |
Equals | public | Check if two trees are equal. |
IsEqual | public | Check whether 2 tree instances are equal. |
Assign | public | Assign another tree. |
Compare | public | Compare 2 nodes. |
Find | public | Find a data item in the tree. |
FindKey | public | Find a data item in the tree using alternate compare mechanism. |
FindNearestKey | public | Find nearest key for a data pointer. |
FindSuccessor | public | Find successor to node. |
FindPrecessor | public | |
FindLowest | public | Find the lowest (leftmost) node in the tree. |
FindHighest | public | Find the highest (rightmost) node in the tree. |
FindNearest | public | Find the node closest to the data in the tree. |
FindPointer | public | Search for a data pointer. |
FindLeftMost | public | Find the node most left to a specified data node. |
FindRightMost | public | Find the node most right to a specified node. |
FindLeftMostKey | public | Find the node most left to a specified key node. |
FindRightMostKey | public | Find the node most right to a specified key node. |
FindLeftMostSameKey | public | Find the node most left to a specified node with the same data. |
FindRightMostSameKey | public | Find the node most right of a specified node with the same data. |
GetEnumerator | public | Get an enumerator for the tree. |
GetEnumeratorHighToLow | public | Return an enumerator that enumerates the tree in reversed order. |
ConsistencyCheck | public | Check the consistency of the tree. |
WriteReportToStream | public | Write the contents of the tree consistency check to the stream. |
NodeToReportStr | public | Create a textual dump of the tree. |
ReportAsString | public | Return the tree report as a string. |
Events
OnCompare | public | Compare function used when comparing nodes. |
OnObjectCompare | public | Compare handler. |
Fields
FCount | protected | |
FNodeClass | protected | |
fNodeMgr | protected | |
fNodeMgrAutoFree | protected | |
FOnCompare | protected | |
FOnObjectCompare | protected | |
FRoot | protected |
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
