Class SourceCodePositioner

  • public class SourceCodePositioner
    extends java.lang.Object
    Calculates from an absolute offset in the source file the line/column coordinate. This is needed as Rhino only offers absolute positions for each node. Some other languages like XML and Apex use this, too. Idea from:
    • Constructor Detail

      • SourceCodePositioner

        public SourceCodePositioner​(java.lang.String sourceCode)
    • Method Detail

      • lineNumberFromOffset

        public int lineNumberFromOffset​(int offset)
      • columnFromOffset

        public int columnFromOffset​(int lineNumber,
                                    int offset)
      • getLastLine

        public int getLastLine()
      • getLastLineColumn

        public int getLastLineColumn()