Class NavuTreeTraversal

Object
com.tailf.navu.traversal.NavuTreeTraversal

public class NavuTreeTraversal extends Object

Starting point for both Active and Passive mode traversal

Starting class from which one can retrieve an iterator or create an instance for passive mode traversal. In passive mode, the user registers one or more filter methods which are called for each NavuNode encountered by the traversal.

  • Method Details

    • iterator

      public static Iterator<NavuNode> iterator(NavuNode startNode)

      Retrieve an iterator to traverse part of a NAVU tree.

      This method should be used if we want to traverse a part of the tree starting from the children of supplied NavuNode. This is the active mode of traversal, meaning it is up to the user to retrieve the next node using the getNext() method on the iterator. The nodes are returned in depth-first order.
      Parameters:
      startNode - the starting NavuNode, which will be used as the root node for the iteration process
      Returns:
      iterator starting from the given NavuNode
    • iterator

      public static Iterator<NavuNode> iterator(NavuContext ctx)

      Retrieve an iterator to traverse the entire NAVU tree.

      This method should be used if we want to traverse the whole NAVU tree, i.e., every existing path for all loaded YANG models.

      This is the active mode of traversal, meaning it is up to the user to retrieve the next node using the getNext() method on the iterator. The nodes are returned in depth-first order.

      Parameters:
      ctx - NavuContext for which to perform the iteration
    • createInstance

      public static NavuTreeTraversal createInstance(NavuContext ctx, NavuTraversalMean travmeth) throws NavuException
      Factory method to retrieve an instance of this class.
      Returns:
      an instance of this class
      Throws:
      NavuException
    • addFilter

      public void addFilter(TraversalFilter filter)
    • traverse

      public Set<String> traverse() throws NavuException
      Start the traversal process.

      For each NavuNode encountered by the process, all added filters will be invoked.

      Returns:
      Set of all visited paths
      Throws:
      NavuException
    • printChain

      public void printChain(NavuNode node)