Interface SourcePosition

    • Method Detail

      • isValidPosition

        boolean isValidPosition()
        Returns:
        true if this instance holds start/end indexes of related sources. false if they are unknown
      • toString

        String toString()
        Returns a string representation of this position in the form "sourcefile:line", or "sourcefile" if no line number is available.
        Overrides:
        toString in class Object
      • getFile

        File getFile()
        Gets the file for this position.
      • getCompilationUnit

        CompilationUnit getCompilationUnit()
        Gets the compilation unit for this position.
      • getLine

        int getLine()
        Gets the line in the source file (1 indexed). Prefer using getSourceStart()}. For CtNamedElement the line is where the name is declared.
      • getEndLine

        int getEndLine()
        Gets the end line in the source file (1 indexed). Prefer using getSourceEnd()}.
      • getSourceEnd

        int getSourceEnd()
        Gets the index at which the position ends in the source file. Heavily used for the sniper mode.
      • getSourceStart

        int getSourceStart()
        Gets the index at which the position starts in the source file.