Top Description Fields Constructors Methods
com.vladsch.flexmark.util.sequence

public final Class SegmentedSequenceFull

extends SegmentedSequence
Class Inheritance
Imports
com.vladsch.flexmark.util.sequence.builder.*, org.jetbrains.annotations.NotNull

A BasedSequence which consists of segments of other BasedSequences NOTE: very efficient for random access but extremely wasteful with space by allocating 4 bytes per character in the sequence with corresponding construction penalty use SegmentedSequenceTree which is binary tree based segmented sequence with minimal overhead and optimized to give penalty free random access for most applications.

Field Summary

Modifier and TypeField and Description
private final int[]
private final int
private final boolean
Inherited from com.vladsch.flexmark.util.sequence.SegmentedSequence:
baseSeqendOffsetlengthstartOffset

Constructor Summary

AccessConstructor and Description
private
SegmentedSequenceFull(BasedSequence baseSeq, int startOffset, int endOffset, int length, boolean nonBaseChars, int[] baseOffsets, int baseStartOffset)

Method Summary

Modifier and TypeMethod and Description
public void
public char
charAt(int
the index of the char value to be returned
index
)

Implements java.lang.CharSequence.charAt.

Returns the char value at the specified index.

public static SegmentedSequenceFull

Returns:

segmented sequence
create
(@NotNull BasedSequence
base sequence for segmented sequence
baseSequence
,
ISegmentBuilder<?>
builder for which to construct segmented sequence
builder
)

Base Constructor

public int
getIndexOffset(int
index for which to get the offset in original source
index
)

Implements com.vladsch.flexmark.util.sequence.BasedSequence.getIndexOffset.

Get the offset of index in this sequence mapped to offset into getBaseSequence() and getBase() original text source.

public static BasedSequence

Returns:

based sequence of segments. Result is a sequence which looks like all the segments were concatenated, while still maintaining the original offset for each character when using getIndexOffset(int)(int index)
of
(BasedSequence
base sequence for the segments
basedSequence
,
@NotNull Iterable<? extends BasedSequence>
list of based sequences to put into a based sequence
segments
)
Deprecated use BasedSequence#getBuilder() and then SequenceBuilder#addAll(Iterable) or if you know which are based segments vs. out of base Strings then use BasedSegmentBuilder to construct segments directly.

public static BasedSequence
public @NotNull BasedSequence
subSequence(int
offset from startIndex of this sequence
startIndex
,
int
offset from startIndex of this sequence
endIndex
)

Implements com.vladsch.flexmark.util.sequence.BasedSequence.subSequence, com.vladsch.flexmark.util.sequence.IRichSequence.subSequence.

Get a portion of this sequence

private SegmentedSequenceFull
subSequence(final BasedSequence baseSeq, final int[] baseOffsets, final int baseStartOffset, final boolean nonBaseChars, final int length)

Inherited from com.vladsch.flexmark.util.sequence.SegmentedSequence:
allOptionsanyOptionsbaseSubSequencecreatecreatecreategetBasegetBaseSequencegetEndOffsetgetOptiongetOptionFlagsgetOptionsgetSourceRangegetStartOffsetlengthof

Field Detail

baseOffsetsback to summary
private final int[] baseOffsets
baseStartOffsetback to summary
private final int baseStartOffset
nonBaseCharsback to summary
private final boolean nonBaseChars

Constructor Detail

SegmentedSequenceFullback to summary
private SegmentedSequenceFull(BasedSequence baseSeq, int startOffset, int endOffset, int length, boolean nonBaseChars, int[] baseOffsets, int baseStartOffset)

Method Detail

addSegmentsback to summary
public void addSegments(@NotNull IBasedSegmentBuilder<?> builder)
Annotations
@Override
charAtback to summary
public char charAt(int index)

Implements java.lang.CharSequence.charAt.

Doc from java.lang.CharSequence.charAt.

Returns the char value at the specified index. An index ranges from zero to length() - 1. The first char value of the sequence is at index zero, the next at index one, and so on, as for array indexing.

If the char value specified by the index is a surrogate, the surrogate value is returned.

Parameters
index:int

the index of the char value to be returned

Returns:char

the specified char value

Annotations
@Override
createback to summary
public static SegmentedSequenceFull create(@NotNull BasedSequence baseSequence, ISegmentBuilder<?> builder)

Base Constructor

Parameters
baseSequence:@NotNull BasedSequence

base sequence for segmented sequence

builder:ISegmentBuilder<?>

builder for which to construct segmented sequence

Returns:SegmentedSequenceFull

segmented sequence

getIndexOffsetback to summary
public int getIndexOffset(int index)

Implements com.vladsch.flexmark.util.sequence.BasedSequence.getIndexOffset.

Doc from com.vladsch.flexmark.util.sequence.BasedSequence.getIndexOffset.

Get the offset of index in this sequence mapped to offset into getBaseSequence() and getBase() original text source.

Note

if the character at given index does not equal the corresponding character in the base sequence then this method should return -1 otherwise segmented based sequence will be created for original base character

Parameters
index:int

index for which to get the offset in original source

Returns:int

offset of index of this sequence in original text

Annotations
@Override
ofback to summary
public static BasedSequence of(BasedSequence basedSequence, @NotNull Iterable<? extends BasedSequence> segments)

Deprecated

use BasedSequence#getBuilder() and then SequenceBuilder#addAll(Iterable) or if you know which are based segments vs. out of base Strings then use BasedSegmentBuilder to construct segments directly. If you must use segments then use SegmentedSequence#create(BasedSequence, Iterable) which does the builder calls for you.

Parameters
basedSequence:BasedSequence

base sequence for the segments

segments:@NotNull Iterable<? extends BasedSequence>

list of based sequences to put into a based sequence

Returns:BasedSequence

based sequence of segments. Result is a sequence which looks like all the segments were concatenated, while still maintaining the original offset for each character when using getIndexOffset(int)(int index)

Annotations
@Deprecated
ofback to summary
public static BasedSequence of(BasedSequence... segments)

Hides com.vladsch.flexmark.util.sequence.SegmentedSequence.of.

Deprecated

Annotations
@Deprecated
subSequenceback to summary
public @NotNull BasedSequence subSequence(int startIndex, int endIndex)

Implements com.vladsch.flexmark.util.sequence.BasedSequence.subSequence, com.vladsch.flexmark.util.sequence.IRichSequence.subSequence.

Doc from com.vladsch.flexmark.util.sequence.BasedSequence.subSequence.

Get a portion of this sequence

Parameters
startIndex:int

offset from startIndex of this sequence

endIndex:int

offset from startIndex of this sequence

Returns:@NotNull BasedSequence

based sequence which represents the requested range of this sequence.

Annotations
@NotNull
@Override
subSequenceback to summary
private SegmentedSequenceFull subSequence(final BasedSequence baseSeq, final int[] baseOffsets, final int baseStartOffset, final boolean nonBaseChars, final int length)