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

public Interface BasedSequence

extends IRichSequence<BasedSequence>, BasedOptionsHolder
Known Direct Subinterfaces
com.vladsch.flexmark.util.sequence.ReplacedBasedSequence
Known Direct Implementers
com.vladsch.flexmark.util.sequence.BasedSequenceImpl
Annotations
@SuppressWarnings:SameParameterValue
Imports
com.vladsch.flexmark.util.data.DataHolder, .DataKeyBase, com.vladsch.flexmark.util.misc.CharPredicate, .Pair, com.vladsch.flexmark.util.sequence.builder.IBasedSegmentBuilder, .SequenceBuilder, com.vladsch.flexmark.util.sequence.builder.tree.SegmentTree, org.jetbrains.annotations.NotNull, .Nullable, java.util.ArrayList, .List

A CharSequence that references original char sequence with offsets into original preserved.

Note

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

Since equals is used for comparison of sequences and strings by base sequence manager, a base sequence with NUL may not compare equal to an equivalent unwrapped sequence because NUL chars are not converted. For Strings this is handled by using String.equals() for comparison. For other CharacterSequence types the match will fail if original has NUL in it.

a subSequence() returns a sub-sequence from the original base sequence with corresponding offsets

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final BasedSequence
public static final BasedSequence[]
public static final List<BasedSequence>
public static final BasedSequence[]
public static final BasedSequence
public static final BasedSequence
public static final BasedSequence
public static final BasedSequence
Inherited from com.vladsch.flexmark.util.sequence.BasedOptionsHolder:
F_APPLICATION_OPTIONSF_COLLECT_FIRST256_STATSF_COLLECT_SEGMENTED_STATSF_FULL_SEGMENTED_SEQUENCESF_LIBRARY_OPTIONSF_NO_ANCHORSF_TREE_SEGMENTED_SEQUENCESO_COLLECT_FIRST256_STATSO_COLLECT_SEGMENTED_STATSO_FULL_SEGMENTED_SEQUENCESO_NO_ANCHORSO_TREE_SEGMENTED_SEQUENCESSEGMENTED_STATS

Method Summary

Modifier and TypeMethod and Description
public void
addSegments(@NotNull IBasedSegmentBuilder<?>
builder
builder
)

Add segments for this sequence, replacing out of base characters with strings

public int
public int
baseColumnAtIndex(int index)

public int
public int
baseEndOfLine(int index)

public int
public int
public int
public @NotNull Pair<Integer, Integer>
public @NotNull Pair<Integer, Integer>
public @NotNull Pair<Integer, Integer>
public @NotNull Range
public @NotNull Range
public @NotNull Range
public int
baseStartOfLine(int index)

public int
public int
public int
public @NotNull BasedSequence

Returns:

based sequence whose contents reflect the selected portion
baseSubSequence
(int
offset from 0 of original sequence
startIndex
,
int
offset from 0 of original sequence
endIndex
)

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 @NotNull BasedSequence

Returns:

based sequence from startIndex to the endIndex
baseSubSequence
(int
offset from 0 of original sequence
startIndex
)

Get a portion of the original sequence that this sequence is based on

public boolean

Returns:

true if other is contained in this
containsAllOf
(@NotNull BasedSequence
based sequence from the same base
other
)

start/end offset based containment, not textual

public boolean

Returns:

true if line contains some characters from the set
containsOnlyIn
(@NotNull CharPredicate
set of characters to be tested
charSet
)

Test for line contains only characters from the set

public boolean

Returns:

true if line contains some characters from the set
containsOnlyNotIn
(@NotNull CharPredicate
set of characters to be tested
charSet
)

Test for line containing only characters not in the set

public boolean

Returns:

true if line contains some characters in the set
containsSomeIn
(@NotNull CharPredicate
set of characters to be tested
charSet
)

Test for line containing some of the characters in the set

public boolean

Returns:

true if line contains some characters not in the set
containsSomeNotIn
(@NotNull CharPredicate
set of characters to be tested
charSet
)

Test for line containing some characters not in the set

public boolean

Returns:

true if other is contained in this
containsSomeOf
(@NotNull BasedSequence
based sequence from the same base
other
)

start/end offset based containment, not textual

public @NotNull BasedSequence

Returns:

sequence which
extendByAny
(@NotNull CharPredicate
set of characters to include
charSet
,
int
maximum extra characters to include
maxCount
)

Extend this based sequence to include characters from underlying based sequence

public @NotNull BasedSequence
public @NotNull BasedSequence

Returns:

sequence which
extendByAnyNot
(@NotNull CharPredicate
set of characters to include
charSet
,
int
maximum extra characters to include
maxCount
)

Extend this based sequence to include characters from underlying based sequence not in character set

public @NotNull BasedSequence
public @NotNull BasedSequence
public @NotNull BasedSequence
public default @NotNull BasedSequence
extendToAny(@NotNull CharPredicate charSet, int maxCount)
Deprecated

public default @NotNull BasedSequence
extendToAny(@NotNull CharPredicate charSet)
Deprecated

public @NotNull BasedSequence

Returns:

resulting sequence after extension. If already spanning the line then this sequence is returned. if the last character of this sequence are found in eolChars then no extension will be performed since it already includes the line end
extendToEndOfLine
(@NotNull CharPredicate
characters to consider as EOL, note eolStartLength(int) eolEndLength(int) should report length of EOL found if length > 1
eolChars
,
boolean
if to include the eol in the string
includeEol
)

Extend in contained based sequence

public @NotNull BasedSequence
public @NotNull BasedSequence
extendToEndOfLine(boolean includeEol)

public @NotNull BasedSequence
public @NotNull BasedSequence

Returns:

resulting sequence after extension. If already spanning the line then this sequence is returned. if the first character of this sequence are found in eolChars then no extension will be performed since it already includes the line end
extendToStartOfLine
(@NotNull CharPredicate
characters to consider as EOL, note eolStartLength(int) eolEndLength(int) should report length of EOL found if length > 1
eolChars
,
boolean
if to include the eol in the string
includeEol
)

Extend in contained based sequence

public @NotNull BasedSequence
public @NotNull BasedSequence
extendToStartOfLine(boolean includeEol)

public @NotNull BasedSequence
public @NotNull Object

Returns:

underlying object containing original text
getBase
()

Get the underlying object on which this sequence contents are based

public @NotNull BasedSequence

Returns:

base sequence
getBaseSequence
()

Get the base sequence for the text

public @NotNull SequenceBuilder
getBuilder()

Redeclares com.vladsch.flexmark.util.sequence.IRichSequence.getBuilder.

Get a sequence builder for this sequence type

public @NotNull BasedSequence

Returns:

same as subSequence(0,0)
getEmptyPrefix
()

Get empty prefix to this sequence

public @NotNull BasedSequence

Returns:

same as subSequence(length())
getEmptySuffix
()

Get empty suffix to this sequence

public int

Returns:

end offset in original text
getEndOffset
()

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

public int

Returns:

offset of index of this sequence in original text
getIndexOffset
(int
index for which to get the offset in original source
index
)

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

public @NotNull SegmentTree

Returns:

segment tree
getSegmentTree
()

Get the segment tree for this sequence

public @NotNull Range

Returns:

Range of start offset and end offset
getSourceRange
()

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

public int

Returns:

start offset in original text
getStartOffset
()

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

public @NotNull BasedSequence

Returns:

sequence which is the intersection of the range of this and other
intersect
(@NotNull BasedSequence
based sequence from the same parent
other
)

start/end offset based intersection, not textual

public boolean

Returns:

true if character at index tests true
isBaseCharAt
(int
index in string
index
,
@NotNull CharPredicate
character set predicate
predicate
)

Safe, if index out of range but based sequence has characters will return those, else returns '\0'

Allows peeking into preceding/following characters to the ones contained in this sequence

public boolean

Returns:

true if this sequence is a continuation of the given sequence in original source text
isContinuationOf
(@NotNull BasedSequence
sequence to test
other
)

Test if this sequence is a continuation of the given sequence in original source text

public boolean

Returns:

true if the given sequence is a continuation of this one in the original text
isContinuedBy
(@NotNull BasedSequence
sequence to test
other
)

Test if the given sequence is a continuation of this sequence in original source text

public @NotNull BasedSequence

Returns:

based sequence with only \n for line separators and terminated by \n
normalizeEndWithEOL
(@NotNull ReplacedTextMapper
replaced text mapper which will be uses to map unescaped index to original source index
textMapper
)

replace any \r\n and \r by \n, append terminating EOL if one is not present

public @NotNull BasedSequence

Returns:

based sequence with only \n for line separators
normalizeEOL
(@NotNull ReplacedTextMapper
replaced text mapper which will be uses to map unescaped index to original source index
textMapper
)

replace any \r\n and \r by \n

public static @NotNull BasedSequence
of(@Nullable CharSequence charSequence)

public static @NotNull BasedSequence
ofSpaces(int count)

public @NotNull BasedSequence

Returns:

prefix part of this as compared to other, start/end offset based, not content
prefixOf
(@NotNull BasedSequence
based sequence from the same base
other
)

Get the prefix part of this from other, start/end offset based containment, not textual

public @NotNull BasedSequence

Returns:

sequence which
prefixWithIndent
(int
maximum columns to include, default Integer#MAX_VALUE
maxColumns
)

Extend this based sequence to include characters from underlying based sequence taking tab expansion to 4th spaces into account

public @NotNull BasedSequence
public static @NotNull BasedSequence
repeatOf(char c, int count)

public static @NotNull BasedSequence
repeatOf(@NotNull CharSequence chars, int count)

public static @NotNull BasedSequence
repeatOf(@NotNull CharSequence chars, int startIndex, int endIndex)

public char

Returns:

character or '\0' if index out of base sequence
safeBaseCharAt
(int
index in string
index
)

Safe, if index out of range but based sequence has characters will return those, else returns '\0'

Allows peeking into preceding/following characters to the ones contained in this sequence

public @NotNull BasedSequence

Returns:

based sequence that contains the span from start of this sequence and end of other

assertion will fail if the other sequence is not a continuation of this one

spliceAtEnd
(@NotNull BasedSequence
sequence to append to end of this one
other
)

Splice the given sequence to the end of this one and return a BasedSequence of the result.

public @NotNull BasedSequence

Returns:

based sequence which represents the requested range of this sequence.
subSequence
(int
offset from startIndex of this sequence
startIndex
,
int
offset from startIndex of this sequence
endIndex
)

Redeclares com.vladsch.flexmark.util.sequence.IRichSequence.subSequence.

Get a portion of this sequence

public @NotNull BasedSequence

Returns:

suffix part of this as compared to other, start/end offset based, not content
suffixOf
(@NotNull BasedSequence
based sequence from the same base
other
)

Get the suffix part of this from other, start/end offset based containment, not textual

public @NotNull String

Returns:

unescaped text
unescape
()

Get the unescaped string of this sequence content

public @NotNull BasedSequence

Returns:

unescaped text in based sequence
unescape
(@NotNull ReplacedTextMapper
replaced text mapper which will be uses to map unescaped index to original source index
textMapper
)

Get the unescaped string of this sequence content

public @NotNull String

Returns:

unescaped text
unescapeNoEntities
()

Get the unescaped string of this sequence content without unescaping entities

Inherited from com.vladsch.flexmark.util.sequence.BasedOptionsHolder:
allOptionsanyOptionsgetOptiongetOptionFlagsgetOptionsoptionsToString
Inherited from com.vladsch.flexmark.util.sequence.IRichSequence:
appendappendappendEOLappendRangesToappendRangesToappendRangesToappendRangesToappendSpaceappendSpacesappendToappendToappendToappendToappendToappendToblankLinesRemovedRangesblankLinesRemovedRangesblankLinesRemovedRangesblankLinesRemovedRangescolumnAtIndexcountLeadingcountLeadingcountLeadingcountLeadingcountLeadingcountLeadingColumnscountLeadingNotcountLeadingNotcountLeadingNotcountLeadingNotSpacecountLeadingNotSpacecountLeadingNotSpacecountLeadingNotSpaceTabcountLeadingNotSpaceTabcountLeadingNotSpaceTabcountLeadingNotWhitespacecountLeadingNotWhitespacecountLeadingNotWhitespacecountLeadingSpacecountLeadingSpacecountLeadingSpacecountLeadingSpaceTabcountLeadingSpaceTabcountLeadingSpaceTabcountLeadingWhitespacecountLeadingWhitespacecountLeadingWhitespacecountOfcountOfAnycountOfAnycountOfAnycountOfAnyNotcountOfAnyNotcountOfAnyNotcountOfNotSpaceTabcountOfNotWhitespacecountOfSpaceTabcountOfWhitespacecountTrailingcountTrailingcountTrailingcountTrailingcountTrailingNotcountTrailingNotcountTrailingNotcountTrailingNotSpacecountTrailingNotSpacecountTrailingNotSpacecountTrailingNotSpaceTabcountTrailingNotSpaceTabcountTrailingNotSpaceTabcountTrailingNotWhitespacecountTrailingNotWhitespacecountTrailingNotWhitespacecountTrailingSpacecountTrailingSpacecountTrailingSpacecountTrailingSpaceTabcountTrailingSpaceTabcountTrailingSpaceTabcountTrailingWhitespacecountTrailingWhitespacecountTrailingWhitespacedeleteemptyArrayendCharAtendOfDelimitedByendOfDelimitedByAnyendOfDelimitedByAnyNotendOfLineendOfLineAnyEOLendSequenceendSequenceendsWithendsWithendsWithendsWithAnyEOLendsWithEOLendsWithIgnoreCaseendsWithSpaceendsWithSpaceTabendsWithWhitespaceeolEndLengtheolEndLengtheolEndRangeeolLengtheolStartLengtheolStartLengtheolStartRangeequalsequalsequalsIgnoreCaseextractRangesextractRangesfirstChargetColumnAtIndexgetLineColumnAtIndexhashCodeifNullifNullEmptyAfterifNullEmptyBeforeindexOfindexOfindexOfindexOfindexOfindexOfindexOfAllindexOfAnyindexOfAnyindexOfAnyindexOfAnyNotindexOfAnyNotindexOfAnyNotindexOfNotindexOfNotindexOfNotinsertinsertisBlankisCharAtisEmptyisInisInisNotBlankisNotEmptyisNotNullisNulllastCharlastIndexOflastIndexOflastIndexOflastIndexOflastIndexOflastIndexOflastIndexOfAnylastIndexOfAnylastIndexOfAnylastIndexOfAnyNotlastIndexOfAnyNotlastIndexOfAnyNotlastIndexOfNotlastIndexOfNotlastIndexOfNotleadingBlankLinesRangeleadingBlankLinesRangeleadingBlankLinesRangeleadingBlankLinesRangelineAtlineAtAnyEOLlineColumnAtIndexlineRangeAtlineRangeAtAnyEOLmatchCharsmatchCharsmatchCharsmatchCharsmatchCharsIgnoreCasematchCharsIgnoreCasematchCharsReversedmatchCharsReversedmatchCharsReversedIgnoreCasematchedCharCountmatchedCharCountmatchedCharCountmatchedCharCountmatchedCharCountmatchedCharCountIgnoreCasematchedCharCountIgnoreCasematchedCharCountReversedmatchedCharCountReversedmatchedCharCountReversedmatchedCharCountReversedmatchedCharCountReversedIgnoreCasematchedCharCountReversedIgnoreCasematchesmatchesmatchesIgnoreCasemidCharAtmidSequencemidSequencenormalizeEndWithEOLnormalizeEOLnullIfnullIfnullIfnullIfnullIfBlanknullIfEmptynullIfEndsWithnullIfEndsWithnullIfEndsWithIgnoreCasenullIfEndsWithNotnullIfNotnullIfNotnullIfNotnullIfNotEndsWithnullIfNotEndsWithnullIfNotEndsWithIgnoreCasenullIfNotStartsWithnullIfNotStartsWithnullIfNotStartsWithIgnoreCasenullIfStartsWithnullIfStartsWithnullIfStartsWithIgnoreCasenullIfStartsWithNotnullSequencepaddingpaddingpadEndpadEndpadStartpadStartprefixOnceWithprefixOnceWithEOLprefixOnceWithSpaceprefixWithprefixWithEOLprefixWithSpaceprefixWithSpacesremovePrefixremovePrefixremovePrefixIgnoreCaseremoveProperPrefixremoveProperPrefixremoveProperPrefixIgnoreCaseremoveProperSuffixremoveProperSuffixremoveProperSuffixIgnoreCaseremoveSuffixremoveSuffixremoveSuffixIgnoreCasereplacereplacesafeCharAtsafeSubSequencesafeSubSequencesequenceOfsequenceOfsequenceOfsplitsplitsplitsplitsplitsplitsplitsplitsplitEOLsplitEOLsplitListsplitListsplitListsplitListsplitListsplitListEOLsplitListEOLsplitListEOLstartOfDelimitedBystartOfDelimitedByAnystartOfDelimitedByAnyNotstartOfLinestartOfLineAnyEOLstartsWithstartsWithstartsWithstartsWithAnyEOLstartsWithEOLstartsWithIgnoreCasestartsWithSpacestartsWithSpaceTabstartsWithWhitespacesubSequencesubSequencesubSequenceAftersubSequenceBeforesuffixOnceWithsuffixOnceWithEOLsuffixOnceWithSpacesuffixWithsuffixWithEOLsuffixWithSpacesuffixWithSpacestoLowerCasetoMappedtoNbSptoSpctoStringOrNulltoUpperCasetoVisibleWhitespaceStringtrailingBlankLinesRangetrailingBlankLinesRangetrailingBlankLinesRangetrailingBlankLinesRangetrimtrimtrimtrimtrimEndtrimEndtrimEndtrimEndtrimEndRangetrimEndRangetrimEndRangetrimEndRangetrimEOLtrimLeadBlankLinestrimmedtrimmedtrimmedtrimmedtrimmedEndtrimmedEndtrimmedEndtrimmedEndtrimmedEOLtrimmedStarttrimmedStarttrimmedStarttrimmedStarttrimRangetrimRangetrimRangetrimRangetrimStarttrimStarttrimStarttrimStarttrimStartRangetrimStartRangetrimStartRangetrimStartRangetrimTailBlankLinestrimToEndOfLinetrimToEndOfLinetrimToEndOfLinetrimToEndOfLinetrimToEndOfLinetrimToStartOfLinetrimToStartOfLinetrimToStartOfLinetrimToStartOfLinetrimToStartOfLine