Package com.tailf.navu.traversal


package com.tailf.navu.traversal

Utility package for traversing the NAVU tree (or a subset thereof) using the NAVU API.

Using this package it is possible to retrieve all the NavuNodes that exist in CDB as well as those available through external data providers.

There are two ways that one could use the Traversal API:

The following example shows a passive traversal (Breadth-first traversal)

  NavuContext ctx = new NavuContext(maapi, th);
  NavuTreeTraversal traversalProcess =
      NavuTreeTraversal.createInstance(ctx, new NavuTraversalBfsMean());
  traversalProcess.addFilter(new TraversalFilter() {
      public void currentNode(NavuNode node) throws NavuException {
          // process the current node
      }
  }
  traversalProcess.traverse();
 
The following example shows a passive traversal (Depth-first traversal)
  NavuContext ctx = new NavuContext(maapi, th);
  NavuTreeTraversal traversalProcess =
      NavuTreeTraversal.createInstance(ctx, new NavuTraversalDfsMean());
  traversalProcess.addFilter(new TraversalFilter() {
      public void currentNode(NavuNode node) throws NavuException {
          // process the current node
      }
  }
  traversalProcess.traverse();
 
The following example shows an active traversal
 
  NavuContext ctx = new NavuContext(maapi, th);
  Iterator<NavuNode> it = NavuTreeTraversal.iterator(ctx);
  while(it.hasNext()) {
      NavuNode currentNode = it.next();
      // Process the node
  }
 
 

  • Class
    Description
    This implements the NavuTraversalMean for BFS (Breath-first traversal).
    This implements the NavuTraversalMean for DFS (Depth-first traversal).
     
    Starting point for both Active and Passive mode traversal