Interface ITextDocumentPart
- All Known Implementing Classes:
CodeDocumentPart
,COutputSink
,CppLikeDocumentPart
,JavaOutputSink
,TextDocumentPart
A document part cannot contain more than 2B (2^31) lines. A document can represent up to 2^63*2^31 lines.
Example: let an ITextDocument with:
- 3 anchors: 0, 1, 2
- anchor #0 contains N0 lines
- anchor #1 contains N1 lines
- anchor #2 contains N2 lines
Those document parts would be valid:
- A document part could contain the data for anchor #0, with the lines [0, N0[
- A document part could contain the data for anchors #0 and #1, with the lines [0, N0+N1[
- A document part could contain the data for anchors #1 and #2, with the lines [N0, N0+N1+N2[
This document part would NOT be valid:
- A document part could contain the data for anchor #0, with the lines [0, N0+x[ where 0 < x < N1
An anchor is identified by a long integer. Integers are not necessarily contiguous. A line may also span multiple anchors. (This is a common-case scenario with processor-based code units, where the anchor is attached to a virtual memory address.)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault IAnchor
getAnchor
(int index) Get the anchors within that part.default ILine
getLine
(int index) getLines()
Get the lines within that part.default List<? extends IObjectLocation>
Retrieve the list of objects represented in the part, as well as their locations (line start/end, column start/end).
-
Method Details
-
getLines
Get the lines within that part. The lines may span over one or more anchors.- Returns:
- the list of lines
-
getLine
- Returns:
-
getAnchors
Get the anchors within that part. The last anchor object may be used to specify the first anchor id of the next, contiguous part. It is especially useful in cases where a line spans multiple anchor ids.- Returns:
- the list of anchors
-
getAnchor
- Parameters:
index
-
-
getObjectLocations
Retrieve the list of objects represented in the part, as well as their locations (line start/end, column start/end). A given coordinates within the part may host multiple objects.Implementation of this method is optional; to ensure backward compatibility with existing documents, the default implementation returns an empty collection.
- Returns:
- a collection of objects; the type of objects is specific to the document (and in the common case, the unit that generated the document)
-