Package aQute.bnd.properties
Class LineTracker
java.lang.Object
aQute.bnd.properties.LineTracker
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe line informationprivate intThe length of the tracked text -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal intcomputeNumberOfLines(String text) private intcreateLines(String text, int insertPosition, int offset) Creates the line structure for the given text.private intfindLine(int offset) Binary search for the line at a given offset.final StringgetLineDelimiter(int line) final IRegiongetLineInformation(int line) final IRegiongetLineInformationOfOffset(int position) final intgetLineLength(int line) final intgetLineNumberOfOffset(int position) final intgetLineOffset(int line) getLines()final intfinal intgetNumberOfLines(int position, int length) private intgetNumberOfLines(int startLine, int offset, int length) Returns the number of lines covered by the specified text range.protected Document.DelimiterInfonextDelimiterInfo(String text, int offset) Returns the information about the first delimiter found in the given text starting at the given offset.final voidfinal void
-
Field Details
-
fLines
The line information -
fTextLength
private int fTextLengthThe 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
Returns the number of lines covered by the specified text range.- Parameters:
startLine- the line where the text range startsoffset- the start offset of the text rangelength- 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
- Throws:
BadLocationException
-
getLineNumberOfOffset
- Throws:
BadLocationException
-
getLineInformationOfOffset
- Throws:
BadLocationException
-
getLineInformation
- Throws:
BadLocationException
-
getLineOffset
- Throws:
BadLocationException
-
getNumberOfLines
public final int getNumberOfLines() -
getNumberOfLines
- Throws:
BadLocationException
-
computeNumberOfLines
-
getLineDelimiter
- Throws:
BadLocationException
-
nextDelimiterInfo
Returns the information about the first delimiter found in the given text starting at the given offset.- Parameters:
text- the text to be searchedoffset- the offset in the given text- Returns:
- the information of the first found delimiter or
null
-
createLines
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 structureinsertPosition- the position at which the newly created lines are inserted into the tracker's line structureoffset- the offset of all newly created lines- Returns:
- the number of newly created lines
-
replace
- Throws:
BadLocationException
-
set
-
getLines
Returns the internal data structure, aListofLines. Used only by.invalid reference
TreeLineTracker#TreeLineTracker(ListLineTracker)- Returns:
- the internal list of lines.
-