Class PmdCoordinatesSystem


  • public final class PmdCoordinatesSystem
    extends Object
    Maps PMD's (line, column) coordinate system to and from the code area's one-dimensional (absolute offset-based) system.
    Since:
    6.13.0
    Author:
    Clément Fournier
    • Method Detail

      • getRtfxParIndexFromPmdLine

        public static int getRtfxParIndexFromPmdLine​(int line)
      • findNodeAt

        public static Optional<net.sourceforge.pmd.lang.ast.Node> findNodeAt​(net.sourceforge.pmd.lang.ast.Node root,
                                                                             int target)
        Locates the innermost node in the given [root] that contains the position at [textOffset] in the [codeArea].
      • findNodeCovering

        public static Optional<net.sourceforge.pmd.lang.ast.Node> findNodeCovering​(net.sourceforge.pmd.lang.ast.Node root,
                                                                                   net.sourceforge.pmd.lang.document.TextRegion range,
                                                                                   boolean exact)
        Returns the innermost node that covers the entire given text range in the given tree.
        Parameters:
        root - Root of the tree
        range - Range to find
        exact - If true, will return the *outermost* node whose range is *exactly* the given text range, otherwise it may be larger.