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

public final Class PrefixedSubSequence

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
Imports
com.vladsch.flexmark.util.data.DataHolder, .DataKeyBase, com.vladsch.flexmark.util.sequence.builder.IBasedSegmentBuilder, org.jetbrains.annotations.NotNull, .Nullable

A BasedSequence with an out of scope of original char sequence prefix

a subSequence() returns a sub-sequence from the original base sequence, possibly with a prefix if it falls in range

Field Summary

Modifier and TypeField and Description
private final BasedSequence
private final CharSequence

Constructor Summary

AccessConstructor and Description
private
PrefixedSubSequence(CharSequence prefix, BasedSequence baseSeq, 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 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 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 @NotNull Object
getBase()

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

Get the underlying object on which this sequence contents are based

public @NotNull BasedSequence
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(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 PrefixedSubSequence
of(CharSequence prefix, BasedSequence baseSeq)
Deprecated

public static PrefixedSubSequence
of(CharSequence prefix, BasedSequence baseSeq, int startIndex)
Deprecated

public static PrefixedSubSequence
of(CharSequence prefix, BasedSequence baseSeq, int startIndex, int endIndex)
Deprecated

public static PrefixedSubSequence
public static PrefixedSubSequence
prefixOf(CharSequence prefix, BasedSequence baseSeq, int startIndex)

public static PrefixedSubSequence
prefixOf(CharSequence prefix, BasedSequence baseSeq, int startIndex, int endIndex)

public static PrefixedSubSequence
repeatOf(CharSequence prefix, int count, BasedSequence baseSeq)

public static PrefixedSubSequence
repeatOf(char prefix, int count, BasedSequence baseSeq)

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

public @NotNull String
toString()

Overrides com.vladsch.flexmark.util.sequence.IRichSequenceBase.toString.

Implements java.lang.CharSequence.toString.

Returns a string containing the characters in this sequence in the same order as this sequence.

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

Field Detail

baseback to summary
private final BasedSequence base
prefixback to summary
private final CharSequence prefix

Constructor Detail

PrefixedSubSequenceback to summary
private PrefixedSubSequence(CharSequence prefix, BasedSequence baseSeq, 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 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
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
getBaseback to summary
public @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 @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 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

Annotations
@Override
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(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 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

Annotations
@Override
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 PrefixedSubSequence of(CharSequence prefix, BasedSequence baseSeq)

Deprecated

Annotations
@Deprecated
ofback to summary
public static PrefixedSubSequence of(CharSequence prefix, BasedSequence baseSeq, int startIndex)

Deprecated

Annotations
@Deprecated
ofback to summary
public static PrefixedSubSequence of(CharSequence prefix, BasedSequence baseSeq, int startIndex, int endIndex)

Deprecated

Annotations
@Deprecated
prefixOfback to summary
public static PrefixedSubSequence prefixOf(CharSequence prefix, BasedSequence baseSeq)
prefixOfback to summary
public static PrefixedSubSequence prefixOf(CharSequence prefix, BasedSequence baseSeq, int startIndex)
prefixOfback to summary
public static PrefixedSubSequence prefixOf(CharSequence prefix, BasedSequence baseSeq, int startIndex, int endIndex)
repeatOfback to summary
public static PrefixedSubSequence repeatOf(CharSequence prefix, int count, BasedSequence baseSeq)
repeatOfback to summary
public static PrefixedSubSequence repeatOf(char prefix, int count, BasedSequence baseSeq)
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
toStringback to summary
public @NotNull String toString()

Overrides com.vladsch.flexmark.util.sequence.IRichSequenceBase.toString.

Implements java.lang.CharSequence.toString.

Doc from java.lang.CharSequence.toString.

Returns a string containing the characters in this sequence in the same order as this sequence. The length of the string will be the length of this sequence.

Returns:@NotNull String

a string consisting of exactly this sequence of characters

Annotations
@NotNull
@Override