Overview
TheTNode<T> generic class provides a flexible tree structure for any data type.
See BI.Tree.pas:104-141 for the TNode<T> class definition.
Basic Usage
Creating a Tree
BI.Tree.pas:129-130 for the Add methods.
Generic Types
Define custom tree types:Node Properties
Data
Store custom data at each node:BI.Tree.pas:125 for the Data property.
Count
Get number of child nodes:BI.Tree.pas:132 for the Count method.
Empty
Check if node has children:BI.Tree.pas:134 for the Empty method.
Parent
Access parent node:BI.Tree.pas:140 for the Parent property.
Index
Get position in parent’s children:BI.Tree.pas:137 for the Index property.
Level
Get depth in tree (0 for root):BI.Tree.pas:139 for the Level property.
Accessing Children
Array Access
BI.Tree.pas:138 for the array property.
Tree Operations
Adding Nodes
Deleting Nodes
BI.Tree.pas:133 for the Delete method.
Clearing Tree
BI.Tree.pas:131 for the Clear method.
Moving Nodes
BI.Tree.pas:140 for the Parent property setter.
Traversing Trees
ForEach Method
Iterate through all nodes:BI.Tree.pas:135 for the ForEach method.
Non-Recursive Traversal
Complex Example
Organization Chart
File System Example
Memory Management
Next Steps
Charts
Visualize tree data in charts
Grids
Display tree data in grids
