Class BasedOffsetTracker
- java.lang.Object
-
- com.vladsch.flexmark.util.sequence.builder.tree.BasedOffsetTracker
-
public class BasedOffsetTracker extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected SegmentOffsetTree
segmentOffsetTree
protected BasedSequence
sequence
-
Constructor Summary
Constructors Modifier Constructor Description protected
BasedOffsetTracker(BasedSequence sequence, SegmentOffsetTree segmentOffsetTree)
protected
BasedOffsetTracker(BasedSequence sequence, SegmentTree segmentTree)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BasedOffsetTracker
create(BasedSequence sequence)
Create a based offset tracker for the given sequencestatic BasedOffsetTracker
create(BasedSequence sequence, SegmentOffsetTree segmentOffsetTree)
Create a based offset tracker for the given sequenceOffsetInfo
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.SegmentOffsetTree
getSegmentOffsetTree()
BasedSequence
getSequence()
int
size()
java.lang.String
toString()
-
-
-
Field Detail
-
sequence
@NotNull protected final BasedSequence sequence
-
segmentOffsetTree
@NotNull protected final SegmentOffsetTree segmentOffsetTree
-
-
Constructor Detail
-
BasedOffsetTracker
protected BasedOffsetTracker(@NotNull BasedSequence sequence, @NotNull SegmentTree segmentTree)
-
BasedOffsetTracker
protected BasedOffsetTracker(@NotNull BasedSequence sequence, @NotNull SegmentOffsetTree segmentOffsetTree)
-
-
Method Detail
-
size
public int size()
-
getOffsetInfo
@NotNull public 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
- offset in base sequenceisEndOffset
- 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:
- information about the offset in this sequence
-
getSequence
@NotNull public BasedSequence getSequence()
-
getSegmentOffsetTree
@NotNull public SegmentOffsetTree getSegmentOffsetTree()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
create
@NotNull public static BasedOffsetTracker create(@NotNull BasedSequence sequence)
Create a based offset tracker for the given sequence- Parameters:
sequence
- sequence which to create offset tracker- Returns:
- based offset tracker
-
create
@NotNull public static BasedOffsetTracker create(@NotNull BasedSequence sequence, @NotNull SegmentOffsetTree segmentOffsetTree)
Create a based offset tracker for the given sequence- Parameters:
sequence
- sequence which to create offset trackersegmentOffsetTree
- segment offset tree for the sequence- Returns:
- based offset tracker
-
-