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

public abstract Class SegmentedSequence

extends BasedSequenceImpl
implements ReplacedBasedSequence
Class Inheritance
All Implemented Interfaces
com.vladsch.flexmark.util.sequence.ReplacedBasedSequence, com.vladsch.flexmark.util.sequence.BasedSequence, com.vladsch.flexmark.util.sequence.BasedOptionsHolder, com.vladsch.flexmark.util.sequence.IRichSequence, com.vladsch.flexmark.util.sequence.SequenceUtils, java.lang.Comparable, java.lang.CharSequence
Known Direct Subclasses
com.vladsch.flexmark.util.sequence.SegmentedSequenceFull, com.vladsch.flexmark.util.sequence.SegmentedSequenceTree
Imports
com.vladsch.flexmark.util.collection.iteration.ArrayIterable, com.vladsch.flexmark.util.data.DataHolder, .DataKeyBase, com.vladsch.flexmark.util.sequence.builder.BasedSegmentBuilder, .SequenceBuilder, org.jetbrains.annotations.NotNull, .Nullable

A BasedSequence which consists of segments of other BasedSequences

Field Summary

Modifier and TypeField and Description
protected final BasedSequence
protected final int
protected final int
protected final int

Constructor Summary

AccessConstructor and Description
protected
SegmentedSequence(BasedSequence baseSeq, int startOffset, int endOffset, int length)

Method Summary

Modifier and TypeMethod and Description
public final boolean
allOptions(int
option flags
options
)

Implements com.vladsch.flexmark.util.sequence.BasedOptionsHolder.allOptions.

Options test for options for this sequence

default reports true for global default options (if any) , variation available on BasedSequenceWithOptions

public final boolean
anyOptions(int
option flags
options
)

Implements com.vladsch.flexmark.util.sequence.BasedOptionsHolder.anyOptions.

Options test for options for this sequence

default reports true for global default options (if any) , variation available on BasedSequenceWithOptions

public final @NotNull BasedSequence
baseSubSequence(int
offset from 0 of original sequence
startIndex
,
int
offset from 0 of original sequence
endIndex
)

Overrides com.vladsch.flexmark.util.sequence.BasedSequenceImpl.baseSubSequence.

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

Get a portion of this sequence's base sequence

Note

this means that if this sequence applies modifications to the original sequence then these modifications are NOT be applied to the returned sequence.

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)
create
(BasedSequence
base sequence for the segments
basedSequence
,
@NotNull Iterable<? extends BasedSequence>
list of based sequences to put into a based sequence
segments
)

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
create(BasedSequence... segments)

public static BasedSequence
public final @NotNull Object
getBase()

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

Get the underlying object on which this sequence contents are based

public final @NotNull BasedSequence
public final int

Returns:

end in base sequence
getEndOffset
()

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

Get the end offset in the base sequence

Note

this is the endOffset determined when the sequence was built from segments and may differ from the endOffset of the last based segment in this sequence

public final <T> T
getOption(DataKeyBase<T>
in options
dataKey
)

Implements com.vladsch.flexmark.util.sequence.BasedOptionsHolder.getOption.

Options holder, default has none, only available on BasedSequenceWithOptions

public final int
getOptionFlags()

Implements com.vladsch.flexmark.util.sequence.BasedOptionsHolder.getOptionFlags.

Options test for options for this sequence

default reports true for global default options (if any) , variation available on BasedSequenceWithOptions

public final @Nullable DataHolder
getOptions()

Implements com.vladsch.flexmark.util.sequence.BasedOptionsHolder.getOptions.

Options holder, default has none, only available on BasedSequenceWithOptions

public final @NotNull Range
getSourceRange()

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

Get the range of this sequence in original getBaseSequence() and getBase() original text source.

public final int

Returns:

start in base sequence
getStartOffset
()

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

Get the start in the base sequence for this segmented sequence.

public final int
length()

Implements java.lang.CharSequence.length.

Returns the length of this character sequence.

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
of(BasedSequence... segments)
Deprecated

Inherited from com.vladsch.flexmark.util.sequence.BasedSequenceImpl:
addSegmentsbaseColumnAtEndbaseColumnAtIndexbaseColumnAtStartbaseEndOfLinebaseEndOfLinebaseEndOfLineAnyEOLbaseEndOfLineAnyEOLbaseLineColumnAtEndbaseLineColumnAtIndexbaseLineColumnAtStartbaseLineRangeAtEndbaseLineRangeAtIndexbaseLineRangeAtStartbaseStartOfLinebaseStartOfLinebaseStartOfLineAnyEOLbaseStartOfLineAnyEOLbaseSubSequencecontainsAllOfcontainsOnlyIncontainsOnlyNotIncontainsSomeIncontainsSomeNotIncontainsSomeOfcreateemptyArrayextendByAnyextendByAnyextendByAnyNotextendByAnyNotextendByOneOfAnyextendByOneOfAnyNotextendToEndOfLineextendToEndOfLineextendToEndOfLineextendToEndOfLineextendToStartOfLineextendToStartOfLineextendToStartOfLineextendToStartOfLinefirstNonNullgetBuildergetEmptyPrefixgetEmptySuffixgetSegmentTreeintersectisBaseCharAtisContinuationOfisContinuedBynormalizeEndWithEOLnormalizeEOLnullSequenceprefixOfprefixWithprefixWithIndentprefixWithIndentsafeBaseCharAtsafeCharAtsequenceOfspliceAtEndsuffixOftoMappedtoStringOrNullunescapeunescapeunescapeNoEntities

Field Detail

baseSeqback to summary
protected final BasedSequence baseSeq
endOffsetback to summary
protected final int endOffset
lengthback to summary
protected final int length
startOffsetback to summary
protected final int startOffset

Constructor Detail

SegmentedSequenceback to summary
protected SegmentedSequence(BasedSequence baseSeq, int startOffset, int endOffset, int length)

Method Detail

allOptionsback to summary
public final boolean allOptions(int options)

Implements com.vladsch.flexmark.util.sequence.BasedOptionsHolder.allOptions.

Doc from com.vladsch.flexmark.util.sequence.BasedOptionsHolder.allOptions.

Options test for options for this sequence

default reports true for global default options (if any) , variation available on BasedSequenceWithOptions

Parameters
options:int

option flags

Returns:boolean

true if all option flags passed are set for this sequence

Annotations
@Override
anyOptionsback to summary
public final boolean anyOptions(int options)

Implements com.vladsch.flexmark.util.sequence.BasedOptionsHolder.anyOptions.

Doc from com.vladsch.flexmark.util.sequence.BasedOptionsHolder.anyOptions.

Options test for options for this sequence

default reports true for global default options (if any) , variation available on BasedSequenceWithOptions

Parameters
options:int

option flags

Returns:boolean

true if any option flags passed are set for this sequence

Annotations
@Override
baseSubSequenceback to summary
public final @NotNull BasedSequence baseSubSequence(int startIndex, int endIndex)

Overrides com.vladsch.flexmark.util.sequence.BasedSequenceImpl.baseSubSequence.

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

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

Get a portion of this sequence's base sequence

Note

this means that if this sequence applies modifications to the original sequence then these modifications are NOT be applied to the returned sequence.

Note

It should only be implemented in classes which provide base sequences such as CharSubSequence and SubSequence others use inherited implementation of BasedSequenceImpl

Parameters
startIndex:int

offset from 0 of original sequence

endIndex:int

offset from 0 of original sequence

Returns:@NotNull BasedSequence

based sequence whose contents reflect the selected portion

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

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.

Use only if you absolutely need to use this old method because it calls the builder.addAll() for all the segments anyway.

If you need the location where content would have been use the FencedCodeBlock.getOpeningMarker().getEndOffset() + 1

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)

createback to summary
public static BasedSequence create(BasedSequence... segments)
createback to summary
public static BasedSequence create(SequenceBuilder builder)
getBaseback to summary
public final @NotNull Object getBase()

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

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

Get the underlying object on which this sequence contents are based

Returns:@NotNull Object

underlying object containing original text

Annotations
@NotNull
@Override
getBaseSequenceback to summary
public final @NotNull BasedSequence getBaseSequence()

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

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

Get the base sequence for the text

Returns:@NotNull BasedSequence

base sequence

Annotations
@NotNull
@Override
getEndOffsetback to summary
public final int getEndOffset()

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

Get the end offset in the base sequence

Note

this is the endOffset determined when the sequence was built from segments and may differ from the endOffset of the last based segment in this sequence

Returns:int

end in base sequence

getOptionback to summary
public final <T> T getOption(DataKeyBase<T> dataKey)

Implements com.vladsch.flexmark.util.sequence.BasedOptionsHolder.getOption.

Doc from com.vladsch.flexmark.util.sequence.BasedOptionsHolder.getOption.

Options holder, default has none, only available on BasedSequenceWithOptions

Parameters
<T>
type of value held by key
dataKey:DataKeyBase<T>

in options

Returns:T

true if data key is available

Annotations
@Override
getOptionFlagsback to summary
public final int getOptionFlags()

Implements com.vladsch.flexmark.util.sequence.BasedOptionsHolder.getOptionFlags.

Doc from com.vladsch.flexmark.util.sequence.BasedOptionsHolder.getOptionFlags.

Options test for options for this sequence

default reports true for global default options (if any) , variation available on BasedSequenceWithOptions

Returns:int

option flags for this sequence

Annotations
@Override
getOptionsback to summary
public final @Nullable DataHolder getOptions()

Implements com.vladsch.flexmark.util.sequence.BasedOptionsHolder.getOptions.

Doc from com.vladsch.flexmark.util.sequence.BasedOptionsHolder.getOptions.

Options holder, default has none, only available on BasedSequenceWithOptions

Returns:@Nullable DataHolder

data holder with options or null if none for this sequence

Annotations
@Override
@Nullable
getSourceRangeback to summary
public final @NotNull Range getSourceRange()

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

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

Get the range of this sequence in original getBaseSequence() and getBase() original text source.

Returns:@NotNull Range

Range of start offset and end offset

Annotations
@NotNull
@Override
getStartOffsetback to summary
public final int getStartOffset()

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

Get the start in the base sequence for this segmented sequence.

Note

this is the startOffset determined when the sequence was built from segments and may differ from the startOffset of the first based segment in this sequence

Returns:int

start in base sequence

lengthback to summary
public final int length()

Implements java.lang.CharSequence.length.

Doc from java.lang.CharSequence.length.

Returns the length of this character sequence. The length is the number of 16-bit chars in the sequence.

Returns:int

the number of chars in this sequence

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 absolutely need to use the old method then use SegmentedSequence#create(BasedSequence, Iterable)

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)

Deprecated

Annotations
@Deprecated