Class BFTreeVisitor<T>

  • Type Parameters:
    T - type of tree node payload.
    All Implemented Interfaces:
    ITreeVisitor<T>
    Direct Known Subclasses:
    LayerBreakdownVisitor

    public abstract class BFTreeVisitor<T>
    extends java.lang.Object
    implements ITreeVisitor<T>
    Breadth first visitor class.

    Note that this visitor should not be used for large trees, as the stack depth required can become quite large.

    See Also:
    BFIterator
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Queue<ITreeNode<T>> next  
    • Constructor Summary

      Constructors 
      Constructor Description
      BFTreeVisitor()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void processPayload​(T value, int level)
      Override in subclasses to act on the values in breadth first order.
      void visit​(ITreeNode<T> node)  
      • Methods inherited from class java.lang.Object

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

      • next

        private java.util.Queue<ITreeNode<T>> next
    • Constructor Detail

      • BFTreeVisitor

        public BFTreeVisitor()
    • Method Detail

      • processPayload

        protected abstract void processPayload​(T value,
                                               int level)
        Override in subclasses to act on the values in breadth first order.
        Parameters:
        value - the payload.
        level - the tree level.