Interface ITextDocumentPart

All Known Implementing Classes:
CodeDocumentPart, COutputSink, CppLikeDocumentPart, JavaOutputSink, TextDocumentPart

public interface ITextDocumentPart
This interface represents document parts. A document part represents the partial content of a document. Anchors contained in a document part should be incremental and non-overlapping. A document part must contain at least one anchor.

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 Details

    • getLines

      List<? extends ILine> getLines()
      Get the lines within that part. The lines may span over one or more anchors.
      Returns:
      the list of lines
    • getLine

      default ILine getLine(int index)
      Returns:
    • getAnchors

      List<? extends IAnchor> 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

      default IAnchor getAnchor(int index)
      Parameters:
      index -
    • getObjectLocations

      default List<? extends IObjectLocation> 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)