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.
Modifier and Type | Method and Description |
---|---|
void |
addFilter(TraversalFilter filter) |
static NavuTreeTraversal |
createInstance(NavuContext ctx,
NavuTraversalMean travmeth)
Factory method to retrieve an instance of this class.
|
static Iterator<NavuNode> |
iterator(NavuContext ctx)
Retrieve an iterator to traverse the entire NAVU tree.
|
static Iterator<NavuNode> |
iterator(NavuNode startNode)
Retrieve an iterator to traverse part of a NAVU tree.
|
void |
printChain(NavuNode node) |
Set<String> |
traverse()
Start the traversal process.
|
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 suppliedNavuNode
. 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.startNode
- the starting NavuNode
, which will be used
as the root node for the iteration processNavuNode
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.
ctx
- NavuContext for which to perform the iterationpublic static NavuTreeTraversal createInstance(NavuContext ctx, NavuTraversalMean travmeth) throws NavuException
NavuException
public void addFilter(TraversalFilter filter)
public Set<String> traverse() throws NavuException
For each NavuNode encountered by the process, all added filters will be invoked.
NavuException
public void printChain(NavuNode node)