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

public final Class CharSubSequence

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

A CharSequence that references original char[] a subSequence() returns a sub-sequence 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 CharSubSequence
private final char[]
private final int
private final int

Constructor Summary

AccessConstructor and Description
private
CharSubSequence(char[] chars, int hash)

private
CharSubSequence(CharSubSequence baseSeq, int startIndex, int endIndex)

Method Summary

Modifier and TypeMethod and Description
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 CharSubSequence
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 char[]
getBase()

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

Get the underlying object on which this sequence contents are based

public @NotNull CharSubSequence
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 CharSubSequence
of(CharSequence charSequence)

public static CharSubSequence
of(CharSequence charSequence, int startIndex)

public static CharSubSequence

Returns:

CharSubSequence based sequence of array
of
(char[]
char array
chars
,
int
start index in array
startIndex
,
int
end index in array
endIndex
)
Deprecated NOTE: use BasedSequence.of() for creating based sequences

private static CharSubSequence

Returns:

char based sequence
of
(CharSequence
char sequence
charSequence
,
int
start index in sequence
startIndex
,
int
end index in sequence
endIndex
)

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

baseback to summary
private final CharSubSequence base
baseCharsback to summary
private final char[] baseChars
endOffsetback to summary
private final int endOffset
startOffsetback to summary
private final int startOffset

Constructor Detail

CharSubSequenceback to summary
private CharSubSequence(char[] chars, int hash)
CharSubSequenceback to summary
private CharSubSequence(CharSubSequence baseSeq, int startIndex, int endIndex)

Method Detail

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 CharSubSequence 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 CharSubSequence

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 char[] 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 char[]

underlying object containing original text

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

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(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

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 CharSubSequence of(CharSequence charSequence)
ofback to summary
public static CharSubSequence of(CharSequence charSequence, int startIndex)
ofback to summary
public static CharSubSequence of(char[] chars, int startIndex, int endIndex)

Deprecated

NOTE: use BasedSequence.of() for creating based sequences

Parameters
chars:char[]

char array

startIndex:int

start index in array

endIndex:int

end index in array

Returns:CharSubSequence

CharSubSequence based sequence of array

Annotations
@Deprecated
ofback to summary
private static CharSubSequence of(CharSequence charSequence, int startIndex, int endIndex)
Parameters
charSequence:CharSequence

char sequence

startIndex:int

start index in sequence

endIndex:int

end index in sequence

Returns:CharSubSequence

char based sequence

subSequenceback to summary
public @NotNull CharSubSequence 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 CharSubSequence

based sequence which represents the requested range of this sequence.

Annotations
@NotNull
@Override