Class TextDoc


  • class TextDoc
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<java.lang.Integer> lineOffsets
      This list has one entry for each line, denoting the start offset of the line.
      private java.util.List<java.lang.String> lines  
      private java.lang.String sourceCode  
      private int sourceCodeLength  
    • Constructor Summary

      Constructors 
      Constructor Description
      TextDoc​(java.lang.String sourceCode)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int columnFromOffset​(int lineNumber, int offset)  
      private int getLineLengthWithLineSeparator​(java.util.Scanner scanner)
      Sums the line length without the line separation and the characters which matched the line separation pattern
      (package private) ContextLines getLinesAround​(@com.github.oowekyala.ooxml.messages.Annots.OneBased int line, int numLinesAround)  
      java.lang.String getTextString()
      Returns the full source.
      int lineNumberFromOffset​(int offset)  
      • Methods inherited from class java.lang.Object

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

      • lineOffsets

        private final java.util.List<java.lang.Integer> lineOffsets
        This list has one entry for each line, denoting the start offset of the line. The start offset of the next line includes the length of the line terminator (1 for \r|\n, 2 for \r\n).
      • lines

        private final java.util.List<java.lang.String> lines
      • sourceCodeLength

        private final int sourceCodeLength
      • sourceCode

        private final java.lang.String sourceCode
    • Constructor Detail

      • TextDoc

        TextDoc​(java.lang.String sourceCode)
    • Method Detail

      • getTextString

        public java.lang.String getTextString()
        Returns the full source.
      • getLinesAround

        ContextLines getLinesAround​(@com.github.oowekyala.ooxml.messages.Annots.OneBased int line,
                                    int numLinesAround)
      • getLineLengthWithLineSeparator

        private int getLineLengthWithLineSeparator​(java.util.Scanner scanner)
        Sums the line length without the line separation and the characters which matched the line separation pattern
        Parameters:
        scanner - the scanner from which to read the line's length
        Returns:
        the length of the line with the line separator.
      • lineNumberFromOffset

        public int lineNumberFromOffset​(int offset)
      • columnFromOffset

        public int columnFromOffset​(int lineNumber,
                                    int offset)