act - AVL binary tree cell module

Module Description

The act module implements an AVL binary tree with the key and data cell based. The act module is a specialisation of the bct module. As a result the bci iterator can be used as iterator on the act tree. The implementation is non-recursive.

Module Words

act% ( -- n )
Get the required space for an act variable

Tree creation, initialisation and destruction

act-init ( act -- )
Initialise the act tree

act-(free) ( act -- )
Free the nodes from the heap

act-create ( "<spaces>name" -- ; -- act )
Create a named tree in the dictionary

act-new ( -- act )
Create a new tree on the heap

act-free ( act -- )
Free the tree from the heap

Member words

act-length@ ( act -- u )
Get the number of elements in the tree

act-empty? ( act -- flag )
Check for an empty tree

act-compare@ ( act -- xt )
Get the compare execution token for comparing keys

act-compare! ( xt act -- )
Set the compare execution token for comparing keys

Tree words

act-insert ( x1 x2 act -- )
Insert data x1 with key x2 in the tree

act-delete ( x1 act -- false | x2 true )
Delete key x1 from the tree, return the data x2 if found

act-get ( x1 act -- false | x2 true )
Get the data x2 related to key x1 from the tree

act-has? ( x1 act -- flag )
Check if the key x1 is present in the tree

act-execute ( i*x xt act -- i*x )
Execute xt for every key and data in the tree

Inspection

act-dump ( act -- )
Dump the tree variable


generated 10-Apr-2008 by ofcfrth-0.5.0