Package aQute.bnd.properties
Class LineTracker
java.lang.Object
aQute.bnd.properties.LineTracker
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe line informationprivate int
The length of the tracked text -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal int
computeNumberOfLines
(String text) private int
createLines
(String text, int insertPosition, int offset) Creates the line structure for the given text.private int
findLine
(int offset) Binary search for the line at a given offset.final String
getLineDelimiter
(int line) final IRegion
getLineInformation
(int line) final IRegion
getLineInformationOfOffset
(int position) final int
getLineLength
(int line) final int
getLineNumberOfOffset
(int position) final int
getLineOffset
(int line) getLines()
final int
final int
getNumberOfLines
(int position, int length) private int
getNumberOfLines
(int startLine, int offset, int length) Returns the number of lines covered by the specified text range.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.final void
final 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, aList
ofLine
s. Used only byTreeLineTracker#TreeLineTracker(ListLineTracker)
.- Returns:
- the internal list of lines.
-