Class AstTraversalUtil


  • public final class AstTraversalUtil
    extends Object
    Author:
    Clément Fournier
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Optional<net.sourceforge.pmd.lang.ast.Node> findOldNodeInNewAst​(net.sourceforge.pmd.lang.ast.Node oldSelection, net.sourceforge.pmd.lang.ast.Node newRoot)  
      static boolean isParent​(net.sourceforge.pmd.lang.ast.Node parent, net.sourceforge.pmd.lang.ast.Node child)  
      static Optional<net.sourceforge.pmd.lang.ast.Node> mapToMyTree​(net.sourceforge.pmd.lang.ast.Node myRoot, net.sourceforge.pmd.lang.ast.Node node, @Nullable Integer caretPositionOrNull)
      Tries hard to find the node in [myRoot] that corresponds most closely to the given [node], which may be from another tree.
      static <T> Iterator<javafx.scene.control.TreeItem<T>> parentIterator​(javafx.scene.control.TreeItem<T> deepest, boolean includeSelf)
      Returns an iterator over the parents of the given node, in innermost to outermost order.
      static Iterator<net.sourceforge.pmd.lang.ast.Node> parentIterator​(net.sourceforge.pmd.lang.ast.Node deepest, boolean includeSelf)
      Returns an iterator over the parents of the given node, in innermost to outermost order.
    • Method Detail

      • mapToMyTree

        public static Optional<net.sourceforge.pmd.lang.ast.Node> mapToMyTree​(net.sourceforge.pmd.lang.ast.Node myRoot,
                                                                              net.sourceforge.pmd.lang.ast.Node node,
                                                                              @Nullable Integer caretPositionOrNull)
        Tries hard to find the node in [myRoot] that corresponds most closely to the given [node], which may be from another tree.
        Parameters:
        myRoot - (Nullable) root of the tree in which to search
        node - (Nullable) node to look for
      • findOldNodeInNewAst

        public static Optional<net.sourceforge.pmd.lang.ast.Node> findOldNodeInNewAst​(net.sourceforge.pmd.lang.ast.Node oldSelection,
                                                                                      net.sourceforge.pmd.lang.ast.Node newRoot)
        Parameters:
        oldSelection - Not null
        newRoot - Not null
      • parentIterator

        public static Iterator<net.sourceforge.pmd.lang.ast.Node> parentIterator​(net.sourceforge.pmd.lang.ast.Node deepest,
                                                                                 boolean includeSelf)
        Returns an iterator over the parents of the given node, in innermost to outermost order.
      • parentIterator

        public static <T> Iterator<javafx.scene.control.TreeItem<T>> parentIterator​(javafx.scene.control.TreeItem<T> deepest,
                                                                                    boolean includeSelf)
        Returns an iterator over the parents of the given node, in innermost to outermost order.
      • isParent

        public static boolean isParent​(net.sourceforge.pmd.lang.ast.Node parent,
                                       net.sourceforge.pmd.lang.ast.Node child)