## nni - n-Tree base Iterator

### Module Description

The nni module implements an iterator on the base n-Tree [nnt].

### Module Words

#### Iterator structure

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

#### Iterator creation, initialisation and destruction

nni-init ( nnt nni -- )
  Initialise the iterator with the n-tree nnt
nni-create ( nnt "<spaces>name" -- ; -- nni )
  Create a named iterator in the dictionary on the n-tree nnt
nni-new ( nnt -- nni )
  Create an iterator on the heap on the n-tree nnt
nni-free ( nni -- )
  Free the iterator from the heap

#### Member words

nni-get ( nni -- nnn | nil )
  Get the current node

#### Tree iterator words

nni-root? ( nni -- flag )
  Check if the current node is the root node
nni-root ( nni -- nnn | nil )
  Move the iterator to the root of the tree, return this node
nni-parent ( nni -- nnn | nil )
  Move the iterator to the parent of the current node, return this node
nni-children ( nni -- n )
  Return the number of children of the current node
nni-children? ( nni -- flag )
  Check if the current node has children
nni-child ( nni -- nnn | nil )
  Move the iterator to the first child of the current node, return this node
nni-prepend-child ( nnn nni -- )
  Prepend a child to the children of the current node, iterator is moved to the new child
nni-append-child ( nnn nni -- )
  Append a child to the children of the current node, iterator is moved to the new child

#### Sibling iterator words

nni-first ( nni -- nnn )
  Move the iterator to the first sibling, return this node
nni-next ( nni -- nnn | nil )
  Move the iterator to the next sibling, return this node
nni-prev ( nni -- nnn | nil )
  Move the iterator to the previous sibling
nni-last ( nni -- nnn )
  Move the iterator to the last sibling, return this node
nni-first? ( nni -- flag )
  Check if the iterator is on the first sibling
nni-last? ( nni -- flag )
  Check if the iterator is on the last sibling
nni-insert-before ( nnn nni -- )
  Insert a sibling before the current sibling in the tree
nni-insert-after ( nnn nni -- )
  Insert a sibling after the current sibling in the tree
nni-remove ( nni -- nnn )
  Remove the current sibling without children from the tree, move the iterator to the next, previous or parent node, return the removed node

#### Inspection

nni-dump ( nni -- )
  Dump the iterator

generated 03-Jun-2010 by ofcfrth-0.10.0