Interface SourcePosition

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int getColumn()
      Gets the column in the source file (1 indexed).
      CompilationUnit getCompilationUnit()
      Gets the compilation unit for this position.
      int getEndColumn()
      Gets the end column in the source file (1 indexed).
      int getEndLine()
      Gets the end line in the source file (1 indexed).
      java.io.File getFile()
      Gets the file for this position.
      int getLine()
      Gets the line in the source file (1 indexed).
      int getSourceEnd()
      Gets the index at which the position ends in the source file.
      int getSourceStart()
      Gets the index at which the position starts in the source file.
      boolean isValidPosition()  
      java.lang.String toString()
      Returns a string representation of this position in the form "sourcefile:line", or "sourcefile" if no line number is available.
    • Method Detail

      • isValidPosition

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

        java.lang.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 java.lang.Object
      • getFile

        java.io.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.