nci - n-Tree cell Iterator

Module Description

The nci module implements an iterator on a cell n-Tree [nct].

Module Words

Iterator structure

nci% ( -- n )
Get the required space for a nci variable

Iterator creation, initialisation and destruction

nci-init ( nct nci -- )
Initialise the iterator with the n-tree nct

nci-create ( nct "<spaces>name" -- ; -- nci )
Create a named iterator in the dictionary on the n-tree nct

nci-new ( nct -- nci )
Create an iterator on the heap on the n-tree nct

nci-free ( nci -- )
Free the iterator from heap

Member words

nci-get ( nci -- x true | false )
Get the cell data x from the current node

Tree iterator words

nci-root? ( nci -- flag )
Check if the current node is the root node

nci-root ( nci -- x true | false )
Move the iterator to the root of the tree, return the cell data x from this node

nci-parent ( nci -- x true | false )
Move the iterator to the parent of the current node, return the cell data x from this node

nci-children ( nci -- n )
Return the number of children of the current node

nci-children? ( nci -- flag )
Check if the current node has children

nci-child ( nci -- x true | false )
Move the iterator to the first child of the current node, return the cell data x of this node

nci-prepend-child ( x nci -- )
Prepend data x as child to the children of the current node, iterator is moved to the new child

nci-append-child ( x nci -- )
Append data x as child to the children of the current node, iterator is moved to the new child

Sibling iterator words

nci-first ( nci -- x true | false )
Move the iterator to the first sibling, return the cell data x from this node

nci-next ( nci -- x true | false )
Move the iterator to the next sibling, return the cell data x from this node

nci-prev ( nci -- x true | false )
Move the iterator to the previous sibling, return the cell data x from this node

nci-last ( nci -- x true | false )
Move the iterator to the last sibling, return the cell data x from this node

nci-first? ( nci -- flag )
Check if the iterator is on the first sibling

nci-last? ( nci -- flag )
Check if the iterator is on the last sibling

nci-insert-before ( x nci -- )
Insert data x as sibling before the current sibling in the tree

nci-insert-after ( x nci -- )
Insert data x as sibling after the current sibling in the tree

nci-remove ( nci -- x true | false )
Remove the current sibling without children from the tree, move the iterator to the next, previous or parent node, return the cell data x of the removed node

Inspection

nci-dump ( nci -- )
Dump the iterator


generated 10-Apr-2008 by ofcfrth-0.5.0