Top Fields Constructors Methods
com.vladsch.flexmark.util.sequence.builder.tree

public Class BasedOffsetTracker

extends Object
Class Inheritance
Imports
com.vladsch.flexmark.util.sequence.BasedSequence, org.jetbrains.annotations.NotNull, .Nullable

Field Summary

Modifier and TypeField and Description
private @Nullable Segment
protected final @NotNull SegmentOffsetTree
protected final @NotNull BasedSequence

Constructor Summary

AccessConstructor and Description
protected
protected

Method Summary

Modifier and TypeMethod and Description
public static @NotNull BasedOffsetTracker

Returns:

based offset tracker
create
(@NotNull BasedSequence
sequence which to create offset tracker
sequence
)

Create a based offset tracker for the given sequence

public static @NotNull BasedOffsetTracker

Returns:

based offset tracker
create
(@NotNull BasedSequence
sequence which to create offset tracker
sequence
,
@NotNull SegmentOffsetTree
segment offset tree for the sequence
segmentOffsetTree
)

Create a based offset tracker for the given sequence

public @NotNull OffsetInfo

Returns:

information about the offset in this sequence
getOffsetInfo
(int
offset in base sequence
offset
,
boolean
if true then offset represents the range [offset, offset) so it is located between character at offset-1 and character at offset if false then offset represents the character at offset and the range [offset, offset+1)
isEndOffset
)

Return the range of indices in the sequence of this based offset tracker that correspond to the given offset in the base sequence from which this sequence was derived.

public @NotNull SegmentOffsetTree
public @NotNull BasedSequence
public int
size()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

lastSegmentback to summary
private @Nullable Segment lastSegment
Annotations
@Nullable
segmentOffsetTreeback to summary
protected final @NotNull SegmentOffsetTree segmentOffsetTree
Annotations
@NotNull
sequenceback to summary
protected final @NotNull BasedSequence sequence
Annotations
@NotNull

Constructor Detail

BasedOffsetTrackerback to summary
protected BasedOffsetTracker(@NotNull BasedSequence sequence, @NotNull SegmentTree segmentTree)
BasedOffsetTrackerback to summary
protected BasedOffsetTracker(@NotNull BasedSequence sequence, @NotNull SegmentOffsetTree segmentOffsetTree)

Method Detail

createback to summary
public static @NotNull BasedOffsetTracker create(@NotNull BasedSequence sequence)

Create a based offset tracker for the given sequence

Parameters
sequence:@NotNull BasedSequence

sequence which to create offset tracker

Returns:@NotNull BasedOffsetTracker

based offset tracker

Annotations
@NotNull
createback to summary
public static @NotNull BasedOffsetTracker create(@NotNull BasedSequence sequence, @NotNull SegmentOffsetTree segmentOffsetTree)

Create a based offset tracker for the given sequence

Parameters
sequence:@NotNull BasedSequence

sequence which to create offset tracker

segmentOffsetTree:@NotNull SegmentOffsetTree

segment offset tree for the sequence

Returns:@NotNull BasedOffsetTracker

based offset tracker

Annotations
@NotNull
getOffsetInfoback to summary
public @NotNull OffsetInfo getOffsetInfo(int offset, boolean isEndOffset)

Return the range of indices in the sequence of this based offset tracker that correspond to the given offset in the base sequence from which this sequence was derived.

Note

indented use is the recover the editing caret position from original text after some text transformation such as formatting, rendering HTML or paragraph wrapping.

Parameters
offset:int

offset in base sequence

isEndOffset:boolean

if true then offset represents the range [offset, offset) so it is located between character at offset-1 and character at offset if false then offset represents the character at offset and the range [offset, offset+1)

Returns:@NotNull OffsetInfo

information about the offset in this sequence

Annotations
@NotNull
getSegmentOffsetTreeback to summary
public @NotNull SegmentOffsetTree getSegmentOffsetTree()
Annotations
@NotNull
getSequenceback to summary
public @NotNull BasedSequence getSequence()
Annotations
@NotNull
sizeback to summary
public int size()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override