class NstTreeTraversal

This class implements a standard traversal of the tree

Inheritance:


Public Methods

virtual int in_action(NstTree* t, NstTree* st, int num)
This method is called for each component of a node
virtual void post_action(NstTree* t)
This method is called by the method traversal at each node, after the recursion
virtual int pre_action(NstTree* t)
This method is called by the method traversal at each node
virtual 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.
virtual int 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.

virtual int 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.

virtual void 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.

virtual void 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 hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de