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

public final Class SubSequence

extends BasedSequenceImpl
Class Inheritance
Imports
com.vladsch.flexmark.util.data.DataHolder, .DataKeyBase, com.vladsch.flexmark.util.sequence.builder.IBasedSegmentBuilder, org.jetbrains.annotations.NotNull, .Nullable

A BasedSequence implementation which wraps original CharSequence to provide a BasedSequence for all its subsequences, a subSequence() returns a SubSequence from the original base sequence.

Note

'\0' changed to '�' use com.vladsch.flexmark.util.sequence.mappers.NullEncoder#decodeNull mapper to get original null chars.

Field Summary

Modifier and TypeField and Description
private final @NotNull SubSequence
private final @NotNull CharSequence
private final int
private final int

Constructor Summary

AccessConstructor and Description
private
private
SubSequence(@NotNull SubSequence subSequence, int startIndex, int endIndex)

Method Summary

Modifier and TypeMethod and Description
public void
public 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 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 @NotNull SubSequence
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 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.

pack-priv static BasedSequence
public @NotNull CharSequence
getBase()

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

Get the underlying object on which this sequence contents are based

public @NotNull SubSequence
public int
getEndOffset()

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

Get the end offset of this sequence into getBaseSequence() and getBase() original text source.

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 <T> T
getOption(@NotNull DataKeyBase<T>
in options
dataKey
)

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

Options holder, default has none, only available on BasedSequenceWithOptions

public 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 @Nullable DataHolder
getOptions()

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

Options holder, default has none, only available on BasedSequenceWithOptions

public @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 int
getStartOffset()

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

Get the start offset of this sequence into getBaseSequence() and getBase() original text source.

public int
length()

Implements java.lang.CharSequence.length.

Returns the length of this character sequence.

public static BasedSequence
of(@Nullable CharSequence charSequence)
Deprecated

public static BasedSequence
of(@Nullable CharSequence charSequence, int startIndex)
Deprecated

public static BasedSequence
of(@Nullable CharSequence charSequence, int startIndex, int endIndex)
Deprecated

public @NotNull SubSequence
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

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

Field Detail

baseSeqback to summary
private final @NotNull SubSequence baseSeq
Annotations
@NotNull
charSequenceback to summary
private final @NotNull CharSequence charSequence
Annotations
@NotNull
endOffsetback to summary
private final int endOffset
startOffsetback to summary
private final int startOffset

Constructor Detail

SubSequenceback to summary
private SubSequence(@NotNull CharSequence charSequence)
SubSequenceback to summary
private SubSequence(@NotNull SubSequence subSequence, int startIndex, int endIndex)

Method Detail

addSegmentsback to summary
public void addSegments(@NotNull IBasedSegmentBuilder<?> builder)
Annotations
@Override
allOptionsback to summary
public 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 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 @NotNull SubSequence 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 SubSequence

based sequence whose contents reflect the selected portion

Annotations
@NotNull
@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
pack-priv static BasedSequence create(@Nullable CharSequence charSequence)
getBaseback to summary
public @NotNull CharSequence 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 CharSequence

underlying object containing original text

Annotations
@NotNull
@Override
getBaseSequenceback to summary
public @NotNull SubSequence 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 SubSequence

base sequence

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

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

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

Get the end offset of this sequence into getBaseSequence() and getBase() original text source.

Returns:int

end offset in original text

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
getOptionback to summary
public <T> T getOption(@NotNull 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:@NotNull DataKeyBase<T>

in options

Returns:T

true if data key is available

Annotations
@Override
getOptionFlagsback to summary
public 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 @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 @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 int getStartOffset()

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

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

Get the start offset of this sequence into getBaseSequence() and getBase() original text source.

Returns:int

start offset in original text

lengthback to summary
public 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(@Nullable CharSequence charSequence)

Deprecated

Annotations
@Deprecated
ofback to summary
public static BasedSequence of(@Nullable CharSequence charSequence, int startIndex)

Deprecated

Annotations
@Deprecated
ofback to summary
public static BasedSequence of(@Nullable CharSequence charSequence, int startIndex, int endIndex)

Deprecated

Annotations
@Deprecated
subSequenceback to summary
public @NotNull SubSequence 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 SubSequence

based sequence which represents the requested range of this sequence.

Annotations
@NotNull
@Override