Class LineTracker

java.lang.Object
aQute.bnd.properties.LineTracker

public class LineTracker extends Object
  • Field Details

    • fLines

      private final List<Line> fLines
      The line information
    • fTextLength

      private int fTextLength
      The length of the tracked text
  • Constructor Details

    • LineTracker

      protected LineTracker()
      Creates a new line tracker.
  • Method Details

    • findLine

      private int findLine(int offset)
      Binary search for the line at a given offset.
      Parameters:
      offset - the offset whose line should be found
      Returns:
      the line of the offset
    • getNumberOfLines

      private int getNumberOfLines(int startLine, int offset, int length) throws BadLocationException
      Returns the number of lines covered by the specified text range.
      Parameters:
      startLine - the line where the text range starts
      offset - the start offset of the text range
      length - the length of the text range
      Returns:
      the number of lines covered by this text range @exception BadLocationException if range is undefined in this tracker
      Throws:
      BadLocationException
    • getLineLength

      public final int getLineLength(int line) throws BadLocationException
      Throws:
      BadLocationException
    • getLineNumberOfOffset

      public final int getLineNumberOfOffset(int position) throws BadLocationException
      Throws:
      BadLocationException
    • getLineInformationOfOffset

      public final IRegion getLineInformationOfOffset(int position) throws BadLocationException
      Throws:
      BadLocationException
    • getLineInformation

      public final IRegion getLineInformation(int line) throws BadLocationException
      Throws:
      BadLocationException
    • getLineOffset

      public final int getLineOffset(int line) throws BadLocationException
      Throws:
      BadLocationException
    • getNumberOfLines

      public final int getNumberOfLines()
    • getNumberOfLines

      public final int getNumberOfLines(int position, int length) throws BadLocationException
      Throws:
      BadLocationException
    • computeNumberOfLines

      public final int computeNumberOfLines(String text)
    • getLineDelimiter

      public final String getLineDelimiter(int line) throws BadLocationException
      Throws:
      BadLocationException
    • nextDelimiterInfo

      protected Document.DelimiterInfo nextDelimiterInfo(String text, int offset)
      Returns the information about the first delimiter found in the given text starting at the given offset.
      Parameters:
      text - the text to be searched
      offset - the offset in the given text
      Returns:
      the information of the first found delimiter or null
    • createLines

      private int createLines(String text, int insertPosition, int offset)
      Creates the line structure for the given text. Newly created lines are inserted into the line structure starting at the given position. Returns the number of newly created lines.
      Parameters:
      text - the text for which to create a line structure
      insertPosition - the position at which the newly created lines are inserted into the tracker's line structure
      offset - the offset of all newly created lines
      Returns:
      the number of newly created lines
    • replace

      public final void replace(int position, int length, String text) throws BadLocationException
      Throws:
      BadLocationException
    • set

      public final void set(String text)
    • getLines

      final List<Line> getLines()
      Returns the internal data structure, a List of Lines. Used only by TreeLineTracker#TreeLineTracker(ListLineTracker) .
      Returns:
      the internal list of lines.