Class AstTraversalUtil


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Optional<net.sourceforge.pmd.lang.ast.Node> findOldNodeInNewAst​(net.sourceforge.pmd.lang.ast.Node oldSelection, net.sourceforge.pmd.lang.ast.Node newRoot)  
      static net.sourceforge.pmd.lang.ast.Node getRoot​(net.sourceforge.pmd.lang.ast.Node n)  
      static boolean isParent​(net.sourceforge.pmd.lang.ast.Node parent, net.sourceforge.pmd.lang.ast.Node child)  
      static java.util.Optional<net.sourceforge.pmd.lang.ast.Node> mapToMyTree​(net.sourceforge.pmd.lang.ast.Node myRoot, net.sourceforge.pmd.lang.ast.Node node, PmdCoordinatesSystem.TextPos2D 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> java.util.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 java.util.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.
      • Methods inherited from class java.lang.Object

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

      • getRoot

        public static net.sourceforge.pmd.lang.ast.Node getRoot​(net.sourceforge.pmd.lang.ast.Node n)
      • mapToMyTree

        public static java.util.Optional<net.sourceforge.pmd.lang.ast.Node> mapToMyTree​(net.sourceforge.pmd.lang.ast.Node myRoot,
                                                                                        net.sourceforge.pmd.lang.ast.Node node,
                                                                                        PmdCoordinatesSystem.TextPos2D 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 java.util.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 java.util.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> java.util.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)