class NstTreeTraversal

This class implements a standard traversal of the tree

Inheritance:


Public Methods

[more]int pre_action(NstTree* t)
This method is called by the method traversal at each node
[more]int in_action(NstTree* t, NstTree* st, int num)
This method is called for each component of a node
[more]void post_action(NstTree* t)
This method is called by the method traversal at each node, after the recursion
[more]void traversal(NstTree* t)
Recursive traversal of the tree


Documentation

This class implements a standard traversal of the tree. This class has been conceived to be extended.
oint pre_action(NstTree* t)
This method is called by the method traversal at each node. If this methods returns a nonzero value, the recursion stops.
Returns:
by default, returns 0.
Parameters:
t - the current node of the tree.

oint in_action(NstTree* t, NstTree* st, int num)
This method is called for each component of a node. If this method returns a nonzero value, the recursion stops.
Returns:
by default, returns 0.
Parameters:
t - the current node of the tree.
st - the current subcomponent of t.
num - the number of the component.

ovoid post_action(NstTree* t)
This method is called by the method traversal at each node, after the recursion.
Parameters:
t - the current node of the tree.

ovoid traversal(NstTree* t)
Recursive traversal of the tree. Here is the source code of the traversal method:
      void NstTreeTraversal::traversal(NstTree* t)
      {
        if (pre_action(t) == 0)
          {
            int stn = 0;
            NstTree* current = t->init();
            while (current)
              {
                stn++;
                if (in_action(t, current, stn) == 0)
                  traversal(current);
                current = t->next();
              }
          }
        post_action(t);
      }
      


Direct child classes:
NstTreeTraversalPrint

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.