Class TBinTree (unit EZDSLBtr)

Inherits from

TAbstractContainer

---Place any compiler options you require here----------------------} {--------------------------------------------------------------------} {$I EZDSLOPT.INC

Constructors


constructor Clone(Source : TAbstractContainer; DataOwner : boolean; NewCompare : TCompareFunc);

--------

constructor Create(DataOwner : boolean);

===TBinTree========================================================== A simple binary tree.


Functions

function Delete(Cursor : TTreeCursor) : TTreeCursor;

--------

procedure Empty;

--------

function Erase(Cursor : TTreeCursor) : TTreeCursor;

--------

function Examine(Cursor : TTreeCursor) : pointer;

--------

procedure Insert(var Cursor : TTreeCursor; aData : pointer);

--------

function IsLeaf(Cursor : TTreeCursor) : boolean;

--------

function IsRoot(Cursor : TTreeCursor) : boolean;

--------

function Iterate(Action : TIterator; Backwards : boolean; ExtraData : pointer) : TTreeCursor;

--------

procedure Join(Cursor : TTreeCursor; Tree : TBinTree);

--------

function Left(Cursor : TTreeCursor) : TTreeCursor;

--------

function Parent(Cursor : TTreeCursor) : TTreeCursor;

--------

function Replace(Cursor : TTreeCursor; aData : pointer) : pointer;

--------

function Right(Cursor : TTreeCursor) : TTreeCursor;

--------

function Root : TTreeCursor;

--------

function Search(var Cursor : TTreeCursor; aData : pointer) : boolean;

--------

procedure btInsertPrim(var Cursor : TTreeCursor; aNode : PNode);

--------

Properties

property TraversalType : TTraversalType


property UseRecursion : boolean


Events

Variables

btRt : PNode;


btTravType : TTraversalType;


btUseRecursion : boolean;



Constructors


constructor Clone(Source : TAbstractContainer; DataOwner : boolean; NewCompare : TCompareFunc);

--------


constructor Create(DataOwner : boolean);

===TBinTree========================================================== A simple binary tree. A binary tree is a data structure where each node has up to two children, and one parent. This implementation makes a distinction between external nodes (that have no children at all) and internal nodes (that always have two children). External nodes are called leaves. The object uses external cursors to navigate the tree (these are NOT the nodes themselves). You position a given cursor in the tree by moving it with the object's methods, and can use a cursor to insert and delete data objects in the tree (although there are restrictions on where this can happen). The object has two iterators, and four methods to traverse the tree with them. The four traversal methods are pre-order, in-order, post-order and level-order. Note that traversals can be done either by recursive routines or a TStack will be used to unravel the recursion. This choice is set via the UseRecursion property. =====================================================================


Functions


function Delete(Cursor : TTreeCursor) : TTreeCursor;

--------


procedure Empty;

--------


function Erase(Cursor : TTreeCursor) : TTreeCursor;

--------


function Examine(Cursor : TTreeCursor) : pointer;

--------


procedure Insert(var Cursor : TTreeCursor; aData : pointer);

--------


function IsLeaf(Cursor : TTreeCursor) : boolean;

--------


function IsRoot(Cursor : TTreeCursor) : boolean;

--------


function Iterate(Action : TIterator; Backwards : boolean; ExtraData : pointer) : TTreeCursor;

--------


procedure Join(Cursor : TTreeCursor; Tree : TBinTree);

--------


function Left(Cursor : TTreeCursor) : TTreeCursor;

--------


function Parent(Cursor : TTreeCursor) : TTreeCursor;

--------


function Replace(Cursor : TTreeCursor; aData : pointer) : pointer;

--------


function Right(Cursor : TTreeCursor) : TTreeCursor;

--------


function Root : TTreeCursor;

--------


function Search(var Cursor : TTreeCursor; aData : pointer) : boolean;

--------


procedure btInsertPrim(var Cursor : TTreeCursor; aNode : PNode);

--------


Properties


property TraversalType : TTraversalType


property UseRecursion : boolean


Events


Variables


btRt : PNode;


btTravType : TTraversalType;


btUseRecursion : boolean;