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

public abstract Class IRichSequenceBase<T extends IRichSequence<T>>

extends Object
implements IRichSequence<T extends IRichSequence<T>>
Class Inheritance
All Implemented Interfaces
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.MappedRichSequence, com.vladsch.flexmark.util.sequence.RichSequenceImpl, com.vladsch.flexmark.util.sequence.BasedSequenceImpl
Annotations
@SuppressWarnings:unchecked
Imports
com.vladsch.flexmark.util.collection.iteration.ArrayIterable, com.vladsch.flexmark.util.misc.CharPredicate, .Pair, com.vladsch.flexmark.util.sequence.builder.ISequenceBuilder, com.vladsch.flexmark.util.sequence.mappers.ChangeCase, .CharMapper, .SpaceMapper, org.jetbrains.annotations.Contract, .NotNull, .Nullable, java.util.Collection, .List, java.util.function.BiPredicate, .Predicate

An abstract base for RichSequence which implements most of the methods allowing subclasses to implement RichSequence with minimal support methods

Field Summary

Modifier and TypeField and Description
private int

Constructor Summary

AccessConstructor and Description
public
IRichSequenceBase(int
hash code for the char sequence.
hash
)

Constructor with pre-computed hash if available, 0 for lazy computation if length() not 0

Note

the hash code computed for this class is equivalent to the string hash of the same characters to ensure that equals can use the hash code for quick failure.

Method Summary

Modifier and TypeMethod and Description
public final T
append(CharSequence...
list of char sequences to append to this sequence, null sequences are skipped
sequences
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.append.

Concatenate this sequence and list of others, returning sequence of result

public final T
public final T
public final T
public final T
public final T
public final T
public final T
public final T
public final T
public final T
appendTo(@NotNull StringBuilder out, @Nullable CharMapper charMapper, int startIndex)

public final T
public final T
appendTo(@NotNull StringBuilder out, int startIndex)

public final T
appendTo(@NotNull StringBuilder out, int startIndex, int endIndex)

public final T
appendTo(@NotNull StringBuilder out, @Nullable CharMapper charMapper, int startIndex, int endIndex)

public final @NotNull List<Range>
public final @NotNull List<Range>
public final @NotNull List<Range>
public final @NotNull List<Range>
blankLinesRemovedRanges(@NotNull CharPredicate eolChars, int fromIndex, int endIndex)

public final int
public int
compareTo(@NotNull CharSequence
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public final int
public final int
countLeading(@NotNull CharPredicate chars, int fromIndex)

public final int
countLeading(@NotNull CharPredicate chars, int fromIndex, int endIndex)

public final int
countLeadingColumns(int startColumn, @NotNull CharPredicate chars)

public final int
public final int
countLeadingNot(@NotNull CharPredicate chars, int fromIndex)

public final int
countLeadingNot(@NotNull CharPredicate chars, int startIndex, int endIndex)

public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
countOfAny(@NotNull CharPredicate chars, int fromIndex)

public final int
public final int
countOfAny(@NotNull CharPredicate s, int fromIndex, int endIndex)

public final int
countOfAnyNot(@NotNull CharPredicate chars, int fromIndex)

public final int
public final int
countOfAnyNot(@NotNull CharPredicate chars, int startIndex, int endIndex)

public final int
public final int
public final int
public final int
public final int
public final int
countTrailing(@NotNull CharPredicate chars, int fromIndex)

public final int
countTrailing(@NotNull CharPredicate chars, int startIndex, int fromIndex)

public final int
public final int
countTrailingNot(@NotNull CharPredicate chars, int fromIndex)

public final int
countTrailingNot(@NotNull CharPredicate chars, int startIndex, int endIndex)

public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public final int
public T
delete(int
start index of deletion
startIndex
,
int
end index, not inclusive, of insertion
endIndex
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.delete.

Delete range in sequence

public final char
endCharAt(int
offset from end of sequence
index
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.endCharAt.

Convenience method to get characters offset from end of sequence.

public final int
public final int
public final int
public final int
endOfLine(int
index where to start searching for end of line
index
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.endOfLine.

Get the offset of the end of line at given index, end of line delimited by \n

public final int
endOfLineAnyEOL(int
index where to start searching for end of line
index
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.endOfLineAnyEOL.

Get the offset of the end of line at given index, end of line delimited by \n or any of \n \r \r\n for Any methods.

public final T
endSequence(int
offset from endIndex of sequence [ 0..length() )
startIndex
,
int
offset from endIndex of sequence [ 0..length() )
endIndex
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.endSequence.

Convenience method to get characters offset from endIndex of sequence.

public final T
endSequence(int
offset from endIndex of sequence [ 0..length() )
startIndex
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.endSequence.

Convenience method to get characters offset from endIndex of sequence.

public final boolean
public final boolean
endsWith(@NotNull CharSequence suffix, boolean ignoreCase)

public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final int
eolEndLength()

Implements com.vladsch.flexmark.util.sequence.IRichSequence.eolEndLength.

Get the length of EOL character at the end of this sequence, if present.

public final int
eolEndLength(int
index where the EOL ends, if any, any value can be passed for this argument. If > length of this sequence then it is the same as passing length(), if 0 or less then 0 is returned.
eolEnd
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.eolEndLength.

Get the length of EOL character at the given index of this sequence, if present.

public final @NotNull Range
eolEndRange(int
index where the EOL ends, if any, any value can be passed for this argument. If > length of this sequence then it is the same as passing length(), if 0 or less then 0 is returned.
eolEnd
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.eolEndRange.

Return Range of eol at given index

public final int
eolStartLength(int
index where the EOL starts, if any, any value can be passed for this argument. If >= length of this sequence then 0 is returned if 0 or less then it is the same as 0
eolStart
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.eolStartLength.

Get the length of EOL character at the given index of this sequence, if present.

public @NotNull Range
eolStartRange(int
index where the EOL starts, if any, any value can be passed for this argument. If >= length of this sequence then 0 is returned if 0 or less then it is the same as 0
eolStart
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.eolStartRange.

Return Range of eol at given index

public final boolean

Returns:

true if character contents are equal
equals
(Object
any char sequence
o
)

Overrides java.lang.Object.equals.

Equality comparison based on character content of this sequence, with quick fail resorting to content comparison only if length and hashCodes are equal

public final boolean
equals(@Nullable Object other, boolean ignoreCase)

public final boolean
public final T
extractRanges(Range...
ranges to extract
ranges
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.extractRanges.

Build a sequence of ranges in this sequence

Note

BasedSequence ranges must be non-overlapping and ordered by startOffset or IllegalArgumentException will be thrown

public final T
public final char
public final int

Returns:

hash code of equivalent string
hashCode
()

Overrides java.lang.Object.hashCode.

Implements com.vladsch.flexmark.util.sequence.IRichSequence.hashCode.

String hash code computation

public final T
ifNull(T
based sequence to return if this is nullSequence()
other
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.ifNull.

If this sequence is the nullSequence() instance then returns other, otherwise returns this sequence.

public final T
ifNullEmptyAfter(T
based sequence from which to take the empty sequence
other
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.ifNullEmptyAfter.

If this sequence is the nullSequence() instance then returns an empty subSequence from the end of other, otherwise returns this sequence.

public final T
ifNullEmptyBefore(T
based sequence from which to take the empty sequence
other
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.ifNullEmptyBefore.

If this sequence is the nullSequence() instance then returns an empty subSequence from the start of other, otherwise returns this sequence.

public final int
public final int
indexOf(@NotNull CharSequence s, int fromIndex)

public final int
indexOf(@NotNull CharSequence s, int fromIndex, int endIndex)

public final int
public final int
public final int
indexOf(char c, int fromIndex, int endIndex)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.indexOf.

public final @NotNull int[]
public final int
public final int
public final int
indexOfAny(@NotNull CharPredicate s, int fromIndex, int endIndex)

public final int
public final int
public final int
indexOfAnyNot(@NotNull CharPredicate s, int fromIndex, int endIndex)

public final int
public final int
public final int
indexOfNot(char c, int fromIndex, int endIndex)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.indexOfNot.

public T
insert(int index, @NotNull CharSequence chars)

public final boolean
public boolean
isCharAt(int index, @NotNull CharPredicate predicate)

public final boolean
isEmpty()

Implements com.vladsch.flexmark.util.sequence.IRichSequence.isEmpty.

Returns true if this character sequence is empty.

public boolean
isIn(@NotNull String[] texts)

public boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final char
public final int
public final int
public final int
public final int
lastIndexOf(@NotNull CharSequence s, int fromIndex)

public final int
lastIndexOf(@NotNull CharSequence s, int startIndex, int fromIndex)

public final int
lastIndexOf(char c, int startIndex, int fromIndex)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.lastIndexOf.

public final int
public final int
public final int
lastIndexOfAny(@NotNull CharPredicate s, int startIndex, int fromIndex)

public final int
public final int
public final int
lastIndexOfAnyNot(@NotNull CharPredicate s, int startIndex, int fromIndex)

public final int
public final int
public final int
lastIndexOfNot(char c, int startIndex, int fromIndex)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.lastIndexOfNot.

public final @NotNull Range
public final @NotNull Range
public final @NotNull Range
public final @NotNull Range
leadingBlankLinesRange(@NotNull CharPredicate eolChars, int fromIndex, int endIndex)

public final T
lineAt(int
index at which to get the line
index
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.lineAt.

Get the line characters at given index, line delimited by \n

public final T
lineAtAnyEOL(int
index at which to get the line
index
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.lineAtAnyEOL.

Get the line characters at given index, line delimited by \n, \r or \r\n

public final @NotNull Pair<Integer, Integer>
lineColumnAtIndex(int
index for which to get line information
index
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.lineColumnAtIndex.

Get the line and column information from index into sequence

public final @NotNull Range
lineRangeAt(int
index at which to get the line
index
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.lineRangeAt.

Get the line characters at given index, line delimited by \n

public final @NotNull Range
lineRangeAtAnyEOL(int
index at which to get the line
index
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.lineRangeAtAnyEOL.

Get the line characters at given index, line delimited by \n, \r or \r\n

public final boolean
matchChars(@NotNull CharSequence chars, int startIndex, boolean ignoreCase)

public final boolean
matchChars(@NotNull CharSequence chars, int startIndex)

public final boolean
matchChars(@NotNull CharSequence chars, boolean ignoreCase)

public final boolean
public final boolean
public final boolean
public final boolean
matchCharsReversed(@NotNull CharSequence chars, int endIndex, boolean ignoreCase)

public final boolean
public final boolean
public final int
matchedCharCount(@NotNull CharSequence chars, int startIndex, int endIndex, boolean ignoreCase)

public final int
matchedCharCount(@NotNull CharSequence chars, int startIndex, boolean ignoreCase)

public final int
matchedCharCount(@NotNull CharSequence chars, int startIndex, int endIndex)

public final int
matchedCharCount(@NotNull CharSequence chars, int startIndex)

public final int
matchedCharCount(@NotNull CharSequence chars, int startIndex, int endIndex, boolean fullMatchOnly, boolean ignoreCase)

public final int
public final int
matchedCharCountIgnoreCase(@NotNull CharSequence chars, int startIndex, int endIndex)

public final int
matchedCharCountReversed(@NotNull CharSequence chars, int startIndex, int fromIndex)

public final int
matchedCharCountReversed(@NotNull CharSequence chars, int fromIndex, boolean ignoreCase)

public final int
public final int
matchedCharCountReversed(@NotNull CharSequence chars, int startIndex, int fromIndex, boolean ignoreCase)

public final int
matchedCharCountReversedIgnoreCase(@NotNull CharSequence chars, int startIndex, int fromIndex)

public final int
public final boolean
matches(@NotNull CharSequence chars, boolean ignoreCase)

public final boolean
public final boolean
public final char
midCharAt(int
of character to get
index
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.midCharAt.

Convenience method to get characters offset from start or end of sequence.

public final T
midSequence(int
offset into this sequence
startIndex
,
int
offset into this sequence
endIndex
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.midSequence.

Convenience method to get characters offset from start or end of sequence.

public final T
midSequence(int
offset into this sequence
startIndex
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.midSequence.

Convenience method to get characters offset from start or end of sequence.

public final @NotNull String
normalizeEndWithEOL()

Implements com.vladsch.flexmark.util.sequence.IRichSequence.normalizeEndWithEOL.

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

public final @NotNull String
public final T
nullIf(boolean
when true return NULL else this
condition
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.nullIf.

If condition is true return nullSequence() otherwise returns this sequence.

public final T
nullIf(@NotNull Predicate<? super CharSequence> predicate, CharSequence... matches)

public final T
nullIf(CharSequence...
match sequence list
matches
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.nullIf.

If this sequence matches one of given sequences return nullSequence() otherwise returns this sequence.

public final T
nullIf(@NotNull BiPredicate<? super T, ? super CharSequence> predicate, CharSequence... matches)

public final T
nullIfBlank()

Implements com.vladsch.flexmark.util.sequence.IRichSequence.nullIfBlank.

If this sequence is blank return nullSequence() otherwise returns this sequence.

public final T
nullIfEmpty()

Implements com.vladsch.flexmark.util.sequence.IRichSequence.nullIfEmpty.

If this sequence is empty return nullSequence() otherwise returns this sequence.

public final T
public final T
public final T
public final T
nullIfNot(@NotNull BiPredicate<? super T, ? super CharSequence> predicate, CharSequence... matches)

public final T
nullIfNot(@NotNull Predicate<? super CharSequence> predicate, CharSequence... matches)

public final T
public final T
public final T
public final T
public final T
public final T
public final T
public final T
public final T
public final T
public final T
padding(int
length
length
,
char
char to use for padding
pad
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.padding.

Get the chars needed for padding to length

public final T
public T
public T
public T
padStart(int
length to pad
length
,
char
char to use for padding
pad
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.padStart.

Pad this sequence to given length

public T
public final T
public final T
public final T
public T
public final T
public final T
public final T
public final T
public final T
removePrefix(@NotNull CharSequence prefix, boolean ignoreCase)

public final T
public final T
public final T
removeProperPrefix(@NotNull CharSequence prefix, boolean ignoreCase)

public final T
public final T
public final T
removeProperSuffix(@NotNull CharSequence suffix, boolean ignoreCase)

public final T
public final T
public final T
removeSuffix(@NotNull CharSequence suffix, boolean ignoreCase)

public final T
public final T
replace(int startIndex, int endIndex, @NotNull CharSequence replacement)

public final T
public char
safeCharAt(int
index
index
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.safeCharAt.

return char at index or '\0' if index <0 or >=length()

public T
safeSubSequence(int
offset from startIndex of this sequence
startIndex
,
int
offset from startIndex of this sequence
endIndex
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.safeSubSequence.

Get a portion of this sequence, if index < 0 use 0, if > length() use length

Note

the returned value should only depend on start/end indices.

public T
safeSubSequence(int
offset from startIndex of this sequence
startIndex
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.safeSubSequence.

Get a portion of this sequence, if index < 0 use 0, if > length() use length

Note

the returned value should only depend on start/end indices.

public final T
public final T
sequenceOf(@Nullable CharSequence charSequence, int startIndex)

public final T[]
split(@NotNull CharSequence delimiter, boolean includeDelims, @Nullable CharPredicate trimChars)

public final T[]
public final T[]
split(@NotNull CharSequence delimiter, int limit, boolean includeDelims, @Nullable CharPredicate trimChars)

public final T[]
split(@NotNull CharSequence delimiter, int limit, int flags)

public final T[]
split(@NotNull CharSequence delimiter, int limit, int flags, @Nullable CharPredicate trimChars)

public final T[]
public final T[]
public final @NotNull List<T>
public final @NotNull List<T>
splitList(@NotNull CharSequence delimiter, int limit, boolean includeDelims, @Nullable CharPredicate trimChars)

public final @NotNull List<T>
splitList(@NotNull CharSequence delimiter, int limit, int flags)

public final @NotNull List<T>
splitList(@NotNull CharSequence delimiter, boolean includeDelims, @Nullable CharPredicate trimChars)

public final @NotNull List<T>
splitList(@NotNull CharSequence delimiter, int limit, int flags, @Nullable CharPredicate trimChars)

public final @NotNull List<T>
public final @NotNull List<T>
public final @NotNull List<T>
splitListEOL(boolean includeDelims, @Nullable CharPredicate trimChars)

public final int
public final int
public final int
public final int
startOfLine(int
index where to start searching for end of line
index
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.startOfLine.

Get the offset of the start of line at given index, start of line delimited by \n

public final int
startOfLineAnyEOL(int
index where to start searching for end of line
index
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.startOfLineAnyEOL.

Get the offset of the start of line at given index, start of line delimited by \n or any of \n \r \r\n for Any methods.

public final boolean
public final boolean
startsWith(@NotNull CharSequence prefix, boolean ignoreCase)

public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final boolean
public final T
subSequence(int
offset from startIndex of this sequence
startIndex
)

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

Get a portion of this sequence starting from a given offset to endIndex of the sequence

public final T

Returns:

sequence whose contents reflect the selected portion, if range.isNull() then this is returned
subSequence
(@NotNull Range
range to get, coordinates offset form start of this sequence
range
)

Get a portion of this sequence selected by range

public final T

Returns:

sequence whose contents come after the selected range, if range.isNull() then nullSequence()
subSequenceAfter
(@NotNull Range
range to get, coordinates offset form start of this sequence
range
)

Get a portion of this sequence after one selected by range

public final T

Returns:

sequence whose contents come before the selected range, if range.isNull() then nullSequence()
subSequenceBefore
(@NotNull Range
range to get, coordinates offset form start of this sequence
range
)

Get a portion of this sequence before one selected by range

public final Pair<T, T>

Returns:

sequence whose contents come before and after the selected range, if range.isNull() then nullSequence()
subSequenceBeforeAfter
(Range
range to get, coordinates offset form start of this sequence
range
)

Get a portions of this sequence before and after one selected by range

public final T
public final T
public final T
public T
public final T
public final T
public final T
public final T
toLowerCase()

Implements com.vladsch.flexmark.util.sequence.IRichSequence.toLowerCase.

Map characters of this sequence to: Uppercase, Lowercase or use custom mapping

public final T
toNbSp()

Implements com.vladsch.flexmark.util.sequence.IRichSequence.toNbSp.

Map spaces to non break spaces

public final T
toSpc()

Implements com.vladsch.flexmark.util.sequence.IRichSequence.toSpc.

Map non break spaces to spaces

public @NotNull String
toString()

Overrides java.lang.Object.toString.

Implements java.lang.CharSequence.toString.

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

public @Nullable String
toStringOrNull()

Implements com.vladsch.flexmark.util.sequence.IRichSequence.toStringOrNull.

Return string or null if BaseSequence.NULL

public final T
public final @NotNull String
public final @NotNull Range
public final @NotNull Range
public final @NotNull Range
public final @NotNull Range
trailingBlankLinesRange(CharPredicate
characters to consider as EOL, note eolStartLength(int) should report length of EOL found if length > 1
eolChars
,
int
index in sequence from which to start blank line search, also maximum index to include in blank lines range can be any value, if less than 0 it is the same as 0, if greater than length() it is the same as length()
startIndex
,
int
maximum index in sequence to check and include in range of blank lines can be any value, if less than 0 it is the same as 0, if greater than length() it is the same as length()
fromIndex
)

Implements com.vladsch.flexmark.util.sequence.IRichSequence.trailingBlankLinesRange.

Get Range of trailing blank lines at given index offsets in sequence

public final T
public final T
public final T
public final T
trim(int keep, @NotNull CharPredicate chars)

public final T
public final T
public final T
public final T
trimEnd(int keep, @NotNull CharPredicate chars)

public final @NotNull Range
public final @NotNull Range
public final @NotNull Range
public final @NotNull Range
public final T
trimEOL()

Implements com.vladsch.flexmark.util.sequence.IRichSequence.trimEOL.

Trim last eol at the end of this sequence,

public final T
public final @NotNull Pair<T, T>
public final @NotNull Pair<T, T>
public final @NotNull Pair<T, T>
public final @NotNull Pair<T, T>
trimmed(int keep, @NotNull CharPredicate chars)

public final T
public final T
public final T
public final T
public final T
public final T
public final T
public final T
public final T
public final @NotNull Range
trimRange(int keep, @NotNull CharPredicate chars)

public final @NotNull Range
public final @NotNull Range
public final @NotNull Range
public final T
public final T
public final T
public final T
trimStart(int keep, @NotNull CharPredicate chars)

public final @NotNull Range
public final @NotNull Range
public final @NotNull Range
public final @NotNull Range
public final T
trimTailBlankLines()

Implements com.vladsch.flexmark.util.sequence.IRichSequence.trimTailBlankLines.

Trim leading trailing blank lines in this sequence

public T
public T
public T
public T
public T
trimToEndOfLine(@NotNull CharPredicate eolChars, boolean includeEol, int index)

public T
public T
public T
public T
public T
trimToStartOfLine(@NotNull CharPredicate eolChars, boolean includeEol, int index)

public final void
validateIndex(int index)

public final void
public final void
validateStartEnd(int startIndex, int endIndex)

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait