Interface Visitable<T extends Visitable<T>>

    • Method Detail

      • accept

        void accept​(Visitor<T> visitor)
        Contains the logic to invoke the visitor and continue the traversal. Typically invokes the pre-visit method of the visitor, then sends the visitor to the children (or predecessors) and then invokes the post-visit method.

        A typical code example is the following:

        
         public void accept(Visitor<Operator> visitor) {
             boolean descend = visitor.preVisit(this);
             if (descend) {
                 if (this.input != null) {
                     this.input.accept(visitor);
                 }
                 visitor.postVisit(this);
             }
         }
         
        Parameters:
        visitor - The visitor to be called with this object as the parameter.
        See Also:
        Visitor.preVisit(Visitable), Visitor.postVisit(Visitable)