Class NodeTraversor


  • public class NodeTraversor
    extends java.lang.Object
    Depth-first node traversor. Use to iterate through all nodes under and including the specified root node.

    This implementation does not use recursion, so a deep DOM does not risk blowing the stack.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void traverse​(Node root)
      Start a depth-first traverse of the root and all of its descendants.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NodeTraversor

        public NodeTraversor​(NodeVisitor visitor)
        Create a new traversor.
        Parameters:
        visitor - a class implementing the NodeVisitor interface, to be called when visiting each node.
    • Method Detail

      • traverse

        public void traverse​(Node root)
        Start a depth-first traverse of the root and all of its descendants.
        Parameters:
        root - the root node point to traverse.