Interface NodeTraversal.Callback

All Known Subinterfaces:
NodeTraversal.ScopedCallback
All Known Implementing Classes:
FindExportableNodes, NodeTraversal.AbstractNodeTypePruningCallback, NodeTraversal.AbstractPostOrderCallback, NodeTraversal.AbstractScopedCallback, NodeTraversal.AbstractShallowCallback, NodeTraversal.AbstractShallowStatementCallback, TypeCheck
Enclosing class:
NodeTraversal

public static interface NodeTraversal.Callback
Callback
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    shouldTraverse(NodeTraversal nodeTraversal, Node n, Node parent)
    Visits a node in pre order (before visiting its children) and decides whether this node's children should be traversed.
    void
    visit(NodeTraversal t, Node n, Node parent)
    Visits a node in post order (after its children have been visited).
  • Method Details

    • shouldTraverse

      boolean shouldTraverse(NodeTraversal nodeTraversal, Node n, Node parent)

      Visits a node in pre order (before visiting its children) and decides whether this node's children should be traversed. If children are traversed, they will be visited by visit(NodeTraversal, Node, Node) in post order.

      Implementations can have side effects (e.g. modifying the parse tree).

      Returns:
      whether the children of this node should be visited
    • visit

      void visit(NodeTraversal t, Node n, Node parent)

      Visits a node in post order (after its children have been visited). A node is visited only if all its parents should be traversed (shouldTraverse(NodeTraversal, Node, Node)).

      Implementations can have side effects (e.g. modifying the parse tree).