Class BasedSequenceImpl
- java.lang.Object
-
- com.vladsch.flexmark.util.sequence.IRichSequenceBase<BasedSequence>
-
- com.vladsch.flexmark.util.sequence.BasedSequenceImpl
-
- All Implemented Interfaces:
BasedOptionsHolder
,BasedSequence
,IRichSequence<BasedSequence>
,SequenceUtils
,java.lang.CharSequence
,java.lang.Comparable<java.lang.CharSequence>
- Direct Known Subclasses:
BasedSequence.EmptyBasedSequence
,CharSubSequence
,MappedBasedSequence
,PrefixedSubSequence
,SegmentedSequence
,SubSequence
public abstract class BasedSequenceImpl extends IRichSequenceBase<BasedSequence> implements BasedSequence
Implementation of BaseSequence
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vladsch.flexmark.util.sequence.BasedOptionsHolder
BasedOptionsHolder.Options
-
Nested classes/interfaces inherited from interface com.vladsch.flexmark.util.sequence.BasedSequence
BasedSequence.EmptyBasedSequence
-
-
Field Summary
-
Fields inherited from interface com.vladsch.flexmark.util.sequence.BasedOptionsHolder
F_APPLICATION_OPTIONS, F_COLLECT_FIRST256_STATS, F_COLLECT_SEGMENTED_STATS, F_FULL_SEGMENTED_SEQUENCES, F_LIBRARY_OPTIONS, F_NO_ANCHORS, F_TREE_SEGMENTED_SEQUENCES, O_COLLECT_FIRST256_STATS, O_COLLECT_SEGMENTED_STATS, O_FULL_SEGMENTED_SEQUENCES, O_NO_ANCHORS, O_TREE_SEGMENTED_SEQUENCES, SEGMENTED_STATS
-
Fields inherited from interface com.vladsch.flexmark.util.sequence.BasedSequence
EMPTY, EMPTY_ARRAY, EMPTY_LIST, EMPTY_SEGMENTS, EOL, LINE_SEP, NULL, SPACE
-
Fields inherited from interface com.vladsch.flexmark.util.sequence.SequenceUtils
ANY_EOL, ANY_EOL_SET, BACKSLASH_SET, DECIMAL_DIGITS, EMPTY_INDICES, ENC_NUL, EOL, EOL_CHAR, EOL_CHAR1, EOL_CHAR2, EOL_CHARS, EOL_SET, HASH_SET, HEXADECIMAL_DIGITS, LINE_SEP, LS, LSEP, NBSP, NBSP_CHARS, NUL, OCTAL_DIGITS, SPACE, SPACE_EOL, SPACE_EOL_SET, SPACE_SET, SPACE_TAB, SPACE_TAB_EOL_SET, SPACE_TAB_NBSP_SET, SPACE_TAB_SET, SPC, SPLIT_INCLUDE_DELIM_PARTS, SPLIT_INCLUDE_DELIMS, SPLIT_SKIP_EMPTY, SPLIT_TRIM_PARTS, SPLIT_TRIM_SKIP_EMPTY, TAB_SET, US, US_CHARS, US_SET, visibleSpacesMap, WHITESPACE, WHITESPACE_CHARS, WHITESPACE_NBSP, WHITESPACE_NBSP_CHARS, WHITESPACE_NBSP_SET, WHITESPACE_NO_EOL_CHARS, WHITESPACE_SET
-
-
Constructor Summary
Constructors Constructor Description BasedSequenceImpl(int hash)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSegments(IBasedSegmentBuilder<?> builder)
Add segments for this sequence, replacing out of base characters with stringsint
baseColumnAtEnd()
int
baseColumnAtIndex(int index)
int
baseColumnAtStart()
int
baseEndOfLine()
int
baseEndOfLine(int index)
int
baseEndOfLineAnyEOL()
int
baseEndOfLineAnyEOL(int index)
Pair<java.lang.Integer,java.lang.Integer>
baseLineColumnAtEnd()
Pair<java.lang.Integer,java.lang.Integer>
baseLineColumnAtIndex(int index)
Pair<java.lang.Integer,java.lang.Integer>
baseLineColumnAtStart()
Range
baseLineRangeAtEnd()
Range
baseLineRangeAtIndex(int index)
Range
baseLineRangeAtStart()
int
baseStartOfLine()
int
baseStartOfLine(int index)
int
baseStartOfLineAnyEOL()
int
baseStartOfLineAnyEOL(int index)
BasedSequence
baseSubSequence(int startIndex)
Get a portion of the original sequence that this sequence is based onBasedSequence
baseSubSequence(int startIndex, int endIndex)
Get a portion of this sequence's base sequenceboolean
containsAllOf(BasedSequence other)
start/end offset based containment, not textualboolean
containsOnlyIn(CharPredicate charSet)
Test for line contains only characters from the setboolean
containsOnlyNotIn(CharPredicate charSet)
Test for line containing only characters not in the setboolean
containsSomeIn(CharPredicate charSet)
Test for line containing some of the characters in the setboolean
containsSomeNotIn(CharPredicate charSet)
Test for line containing some characters not in the setboolean
containsSomeOf(BasedSequence other)
start/end offset based containment, not textualBasedSequence[]
emptyArray()
BasedSequence
extendByAny(CharPredicate charSet)
BasedSequence
extendByAny(CharPredicate charSet, int maxCount)
Extend this based sequence to include characters from underlying based sequenceBasedSequence
extendByAnyNot(CharPredicate charSet)
BasedSequence
extendByAnyNot(CharPredicate charSet, int maxCount)
Extend this based sequence to include characters from underlying based sequence not in character setBasedSequence
extendByOneOfAny(CharPredicate charSet)
BasedSequence
extendByOneOfAnyNot(CharPredicate charSet)
BasedSequence
extendToEndOfLine()
BasedSequence
extendToEndOfLine(boolean includeEol)
BasedSequence
extendToEndOfLine(CharPredicate eolChars)
BasedSequence
extendToEndOfLine(CharPredicate eolChars, boolean includeEol)
Extend in contained based sequenceBasedSequence
extendToStartOfLine()
BasedSequence
extendToStartOfLine(boolean includeEol)
BasedSequence
extendToStartOfLine(CharPredicate eolChars)
BasedSequence
extendToStartOfLine(CharPredicate eolChars, boolean includeEol)
Extend in contained based sequencestatic BasedSequence
firstNonNull(BasedSequence... sequences)
SequenceBuilder
getBuilder()
Get a sequence builder for this sequence typeBasedSequence
getEmptyPrefix()
Get empty prefix to this sequenceBasedSequence
getEmptySuffix()
Get empty suffix to this sequenceSegmentTree
getSegmentTree()
Get the segment tree for this sequence or null if sequence is contiguous from startOffset to endOffsetBasedSequence
intersect(BasedSequence other)
start/end offset based intersection, not textualboolean
isBaseCharAt(int index, CharPredicate predicate)
Safe, if index out of range but based sequence has characters will return those, else returns '\0'boolean
isContinuationOf(BasedSequence other)
Test if this sequence is a continuation of the given sequence in original source textboolean
isContinuedBy(BasedSequence other)
Test if the given sequence is a continuation of this sequence in original source textBasedSequence
normalizeEndWithEOL(ReplacedTextMapper textMapper)
replace any \r\n and \r by \n, append terminating EOL if one is not presentBasedSequence
normalizeEOL(ReplacedTextMapper textMapper)
replace any \r\n and \r by \nBasedSequence
nullSequence()
BasedSequence
prefixOf(BasedSequence other)
Get the prefix part of this from other, start/end offset based containment, not textualBasedSequence
prefixWith(java.lang.CharSequence prefix)
Prefix this sequence with a char sequenceBasedSequence
prefixWithIndent()
BasedSequence
prefixWithIndent(int maxColumns)
Extend this based sequence to include characters from underlying based sequence taking tab expansion to 4th spaces into accountchar
safeBaseCharAt(int index)
Safe, if index out of range but based sequence has characters will return those, else returns '\0'char
safeCharAt(int index)
return char at index or '\0' if index <0 or >=length()BasedSequence
sequenceOf(java.lang.CharSequence charSequence, int startIndex, int endIndex)
Factory functionBasedSequence
spliceAtEnd(BasedSequence other)
Splice the given sequence to the end of this one and return a BasedSequence of the result.BasedSequence
suffixOf(BasedSequence other)
Get the suffix part of this from other, start/end offset based containment, not textualBasedSequence
toMapped(CharMapper mapper)
java.lang.String
toStringOrNull()
Return string or null if BaseSequence.NULLjava.lang.String
unescape()
Get the unescaped string of this sequence contentBasedSequence
unescape(ReplacedTextMapper textMapper)
Get the unescaped string of this sequence contentjava.lang.String
unescapeNoEntities()
Get the unescaped string of this sequence content without unescaping entities-
Methods inherited from class com.vladsch.flexmark.util.sequence.IRichSequenceBase
append, append, appendEOL, appendRangesTo, appendRangesTo, appendRangesTo, appendRangesTo, appendSpace, appendSpaces, appendTo, appendTo, appendTo, appendTo, appendTo, appendTo, blankLinesRemovedRanges, blankLinesRemovedRanges, blankLinesRemovedRanges, blankLinesRemovedRanges, columnAtIndex, compareTo, countLeading, countLeading, countLeading, countLeadingColumns, countLeadingNot, countLeadingNot, countLeadingNot, countLeadingNotSpace, countLeadingNotSpace, countLeadingNotSpace, countLeadingNotSpaceTab, countLeadingNotSpaceTab, countLeadingNotSpaceTab, countLeadingNotWhitespace, countLeadingNotWhitespace, countLeadingNotWhitespace, countLeadingSpace, countLeadingSpace, countLeadingSpace, countLeadingSpaceTab, countLeadingSpaceTab, countLeadingSpaceTab, countLeadingWhitespace, countLeadingWhitespace, countLeadingWhitespace, countOfAny, countOfAny, countOfAny, countOfAnyNot, countOfAnyNot, countOfAnyNot, countOfNotSpaceTab, countOfNotWhitespace, countOfSpaceTab, countOfWhitespace, countTrailing, countTrailing, countTrailing, countTrailingNot, countTrailingNot, countTrailingNot, countTrailingNotSpace, countTrailingNotSpace, countTrailingNotSpace, countTrailingNotSpaceTab, countTrailingNotSpaceTab, countTrailingNotSpaceTab, countTrailingNotWhitespace, countTrailingNotWhitespace, countTrailingNotWhitespace, countTrailingSpace, countTrailingSpace, countTrailingSpace, countTrailingSpaceTab, countTrailingSpaceTab, countTrailingSpaceTab, countTrailingWhitespace, countTrailingWhitespace, countTrailingWhitespace, delete, endCharAt, endOfDelimitedBy, endOfDelimitedByAny, endOfDelimitedByAnyNot, endOfLine, endOfLineAnyEOL, endSequence, endSequence, endsWith, endsWith, endsWith, endsWithAnyEOL, endsWithEOL, endsWithIgnoreCase, endsWithSpace, endsWithSpaceTab, endsWithWhitespace, eolEndLength, eolEndLength, eolEndRange, eolStartLength, eolStartRange, equals, equals, equalsIgnoreCase, extractRanges, extractRanges, firstChar, hashCode, ifNull, ifNullEmptyAfter, ifNullEmptyBefore, indexOf, indexOf, indexOf, indexOf, indexOf, indexOf, indexOfAll, indexOfAny, indexOfAny, indexOfAny, indexOfAnyNot, indexOfAnyNot, indexOfAnyNot, indexOfNot, indexOfNot, indexOfNot, insert, isBlank, isCharAt, isEmpty, isIn, isIn, isNotBlank, isNotEmpty, isNotNull, isNull, lastChar, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOfAny, lastIndexOfAny, lastIndexOfAny, lastIndexOfAnyNot, lastIndexOfAnyNot, lastIndexOfAnyNot, lastIndexOfNot, lastIndexOfNot, lastIndexOfNot, leadingBlankLinesRange, leadingBlankLinesRange, leadingBlankLinesRange, leadingBlankLinesRange, lineAt, lineAtAnyEOL, lineColumnAtIndex, lineRangeAt, lineRangeAtAnyEOL, matchChars, matchChars, matchChars, matchChars, matchCharsIgnoreCase, matchCharsIgnoreCase, matchCharsReversed, matchCharsReversed, matchCharsReversedIgnoreCase, matchedCharCount, matchedCharCount, matchedCharCount, matchedCharCount, matchedCharCount, matchedCharCountIgnoreCase, matchedCharCountIgnoreCase, matchedCharCountReversed, matchedCharCountReversed, matchedCharCountReversed, matchedCharCountReversed, matchedCharCountReversedIgnoreCase, matchedCharCountReversedIgnoreCase, matches, matches, matchesIgnoreCase, midCharAt, midSequence, midSequence, normalizeEndWithEOL, normalizeEOL, nullIf, nullIf, nullIf, nullIf, nullIfBlank, nullIfEmpty, nullIfEndsWith, nullIfEndsWith, nullIfEndsWithIgnoreCase, nullIfNot, nullIfNot, nullIfNot, nullIfNotEndsWith, nullIfNotEndsWith, nullIfNotEndsWithIgnoreCase, nullIfNotStartsWith, nullIfNotStartsWith, nullIfNotStartsWithIgnoreCase, nullIfStartsWith, nullIfStartsWith, nullIfStartsWithIgnoreCase, padding, padding, padEnd, padEnd, padStart, padStart, prefixOnceWith, prefixOnceWithEOL, prefixOnceWithSpace, prefixWithEOL, prefixWithSpace, prefixWithSpaces, removePrefix, removePrefix, removePrefixIgnoreCase, removeProperPrefix, removeProperPrefix, removeProperPrefixIgnoreCase, removeProperSuffix, removeProperSuffix, removeProperSuffixIgnoreCase, removeSuffix, removeSuffix, removeSuffixIgnoreCase, replace, replace, safeSubSequence, safeSubSequence, sequenceOf, sequenceOf, split, split, split, split, split, splitEOL, splitEOL, splitList, splitList, splitList, splitList, splitList, splitListEOL, splitListEOL, splitListEOL, startOfDelimitedBy, startOfDelimitedByAny, startOfDelimitedByAnyNot, startOfLine, startOfLineAnyEOL, startsWith, startsWith, startsWith, startsWithAnyEOL, startsWithEOL, startsWithIgnoreCase, startsWithSpace, startsWithSpaceTab, startsWithWhitespace, subSequence, subSequence, subSequenceAfter, subSequenceBefore, subSequenceBeforeAfter, suffixOnceWith, suffixOnceWithEOL, suffixOnceWithSpace, suffixWith, suffixWithEOL, suffixWithSpace, suffixWithSpaces, toLowerCase, toNbSp, toSpc, toString, toUpperCase, toVisibleWhitespaceString, trailingBlankLinesRange, trailingBlankLinesRange, trailingBlankLinesRange, trailingBlankLinesRange, trim, trim, trim, trim, trimEnd, trimEnd, trimEnd, trimEnd, trimEndRange, trimEndRange, trimEndRange, trimEndRange, trimEOL, trimLeadBlankLines, trimmed, trimmed, trimmed, trimmed, trimmedEnd, trimmedEnd, trimmedEnd, trimmedEnd, trimmedEOL, trimmedStart, trimmedStart, trimmedStart, trimmedStart, trimRange, trimRange, trimRange, trimRange, trimStart, trimStart, trimStart, trimStart, trimStartRange, trimStartRange, trimStartRange, trimStartRange, trimTailBlankLines, trimToEndOfLine, trimToEndOfLine, trimToEndOfLine, trimToEndOfLine, trimToEndOfLine, trimToStartOfLine, trimToStartOfLine, trimToStartOfLine, trimToStartOfLine, trimToStartOfLine, validateIndex, validateIndexInclusiveEnd, validateStartEnd
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.vladsch.flexmark.util.sequence.BasedOptionsHolder
allOptions, anyOptions, getOption, getOptionFlags, getOptions
-
Methods inherited from interface com.vladsch.flexmark.util.sequence.BasedSequence
extendToAny, extendToAny, getBase, getBaseSequence, getEndOffset, getIndexOffset, getSourceRange, getStartOffset, subSequence
-
Methods inherited from interface com.vladsch.flexmark.util.sequence.IRichSequence
append, append, appendEOL, appendRangesTo, appendRangesTo, appendRangesTo, appendRangesTo, appendSpace, appendSpaces, appendTo, appendTo, appendTo, appendTo, appendTo, appendTo, blankLinesRemovedRanges, blankLinesRemovedRanges, blankLinesRemovedRanges, blankLinesRemovedRanges, columnAtIndex, countLeading, countLeading, countLeading, countLeading, countLeading, countLeadingColumns, countLeadingNot, countLeadingNot, countLeadingNot, countLeadingNotSpace, countLeadingNotSpace, countLeadingNotSpace, countLeadingNotSpaceTab, countLeadingNotSpaceTab, countLeadingNotSpaceTab, countLeadingNotWhitespace, countLeadingNotWhitespace, countLeadingNotWhitespace, countLeadingSpace, countLeadingSpace, countLeadingSpace, countLeadingSpaceTab, countLeadingSpaceTab, countLeadingSpaceTab, countLeadingWhitespace, countLeadingWhitespace, countLeadingWhitespace, countOf, countOfAny, countOfAny, countOfAny, countOfAnyNot, countOfAnyNot, countOfAnyNot, countOfNotSpaceTab, countOfNotWhitespace, countOfSpaceTab, countOfWhitespace, countTrailing, countTrailing, countTrailing, countTrailing, countTrailingNot, countTrailingNot, countTrailingNot, countTrailingNotSpace, countTrailingNotSpace, countTrailingNotSpace, countTrailingNotSpaceTab, countTrailingNotSpaceTab, countTrailingNotSpaceTab, countTrailingNotWhitespace, countTrailingNotWhitespace, countTrailingNotWhitespace, countTrailingSpace, countTrailingSpace, countTrailingSpace, countTrailingSpaceTab, countTrailingSpaceTab, countTrailingSpaceTab, countTrailingWhitespace, countTrailingWhitespace, countTrailingWhitespace, delete, endCharAt, endOfDelimitedBy, endOfDelimitedByAny, endOfDelimitedByAnyNot, endOfLine, endOfLineAnyEOL, endSequence, endSequence, endsWith, endsWith, endsWith, endsWithAnyEOL, endsWithEOL, endsWithIgnoreCase, endsWithSpace, endsWithSpaceTab, endsWithWhitespace, eolEndLength, eolEndLength, eolEndRange, eolLength, eolStartLength, eolStartLength, eolStartRange, equals, equals, equalsIgnoreCase, extractRanges, extractRanges, firstChar, getColumnAtIndex, getLineColumnAtIndex, hashCode, ifNull, ifNullEmptyAfter, ifNullEmptyBefore, indexOf, indexOf, indexOf, indexOf, indexOf, indexOf, indexOfAll, indexOfAny, indexOfAny, indexOfAny, indexOfAnyNot, indexOfAnyNot, indexOfAnyNot, indexOfNot, indexOfNot, indexOfNot, insert, insert, isBlank, isCharAt, isEmpty, isIn, isIn, isNotBlank, isNotEmpty, isNotNull, isNull, lastChar, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOfAny, lastIndexOfAny, lastIndexOfAny, lastIndexOfAnyNot, lastIndexOfAnyNot, lastIndexOfAnyNot, lastIndexOfNot, lastIndexOfNot, lastIndexOfNot, leadingBlankLinesRange, leadingBlankLinesRange, leadingBlankLinesRange, leadingBlankLinesRange, lineAt, lineAtAnyEOL, lineColumnAtIndex, lineRangeAt, lineRangeAtAnyEOL, matchChars, matchChars, matchChars, matchChars, matchCharsIgnoreCase, matchCharsIgnoreCase, matchCharsReversed, matchCharsReversed, matchCharsReversedIgnoreCase, matchedCharCount, matchedCharCount, matchedCharCount, matchedCharCount, matchedCharCount, matchedCharCountIgnoreCase, matchedCharCountIgnoreCase, matchedCharCountReversed, matchedCharCountReversed, matchedCharCountReversed, matchedCharCountReversed, matchedCharCountReversedIgnoreCase, matchedCharCountReversedIgnoreCase, matches, matches, matchesIgnoreCase, midCharAt, midSequence, midSequence, normalizeEndWithEOL, normalizeEOL, nullIf, nullIf, nullIf, nullIf, nullIfBlank, nullIfEmpty, nullIfEndsWith, nullIfEndsWith, nullIfEndsWithIgnoreCase, nullIfEndsWithNot, nullIfNot, nullIfNot, nullIfNot, nullIfNotEndsWith, nullIfNotEndsWith, nullIfNotEndsWithIgnoreCase, nullIfNotStartsWith, nullIfNotStartsWith, nullIfNotStartsWithIgnoreCase, nullIfStartsWith, nullIfStartsWith, nullIfStartsWithIgnoreCase, nullIfStartsWithNot, padding, padding, padEnd, padEnd, padStart, padStart, prefixOnceWith, prefixOnceWithEOL, prefixOnceWithSpace, prefixWithEOL, prefixWithSpace, prefixWithSpaces, removePrefix, removePrefix, removePrefixIgnoreCase, removeProperPrefix, removeProperPrefix, removeProperPrefixIgnoreCase, removeProperSuffix, removeProperSuffix, removeProperSuffixIgnoreCase, removeSuffix, removeSuffix, removeSuffixIgnoreCase, replace, replace, safeSubSequence, safeSubSequence, sequenceOf, sequenceOf, split, split, split, split, split, split, split, split, splitEOL, splitEOL, splitList, splitList, splitList, splitList, splitList, splitListEOL, splitListEOL, splitListEOL, startOfDelimitedBy, startOfDelimitedByAny, startOfDelimitedByAnyNot, startOfLine, startOfLineAnyEOL, startsWith, startsWith, startsWith, startsWithAnyEOL, startsWithEOL, startsWithIgnoreCase, startsWithSpace, startsWithSpaceTab, startsWithWhitespace, subSequence, subSequence, subSequenceAfter, subSequenceBefore, suffixOnceWith, suffixOnceWithEOL, suffixOnceWithSpace, suffixWith, suffixWithEOL, suffixWithSpace, suffixWithSpaces, toLowerCase, toNbSp, toSpc, toUpperCase, toVisibleWhitespaceString, trailingBlankLinesRange, trailingBlankLinesRange, trailingBlankLinesRange, trailingBlankLinesRange, trim, trim, trim, trim, trimEnd, trimEnd, trimEnd, trimEnd, trimEndRange, trimEndRange, trimEndRange, trimEndRange, trimEOL, trimLeadBlankLines, trimmed, trimmed, trimmed, trimmed, trimmedEnd, trimmedEnd, trimmedEnd, trimmedEnd, trimmedEOL, trimmedStart, trimmedStart, trimmedStart, trimmedStart, trimRange, trimRange, trimRange, trimRange, trimStart, trimStart, trimStart, trimStart, trimStartRange, trimStartRange, trimStartRange, trimStartRange, trimTailBlankLines, trimToEndOfLine, trimToEndOfLine, trimToEndOfLine, trimToEndOfLine, trimToEndOfLine, trimToStartOfLine, trimToStartOfLine, trimToStartOfLine, trimToStartOfLine, trimToStartOfLine
-
-
-
-
Method Detail
-
firstNonNull
public static BasedSequence firstNonNull(BasedSequence... sequences)
-
emptyArray
@NotNull public BasedSequence[] emptyArray()
- Specified by:
emptyArray
in interfaceIRichSequence<BasedSequence>
-
nullSequence
@NotNull public BasedSequence nullSequence()
- Specified by:
nullSequence
in interfaceIRichSequence<BasedSequence>
-
sequenceOf
@NotNull public BasedSequence sequenceOf(@Nullable java.lang.CharSequence charSequence, int startIndex, int endIndex)
Description copied from interface:IRichSequence
Factory function- Specified by:
sequenceOf
in interfaceIRichSequence<BasedSequence>
- Parameters:
charSequence
- char sequence from which to construct a rich char sequencestartIndex
- start index of the sequence to useendIndex
- end index of the sequence to use- Returns:
- rich char sequence from given inputs
-
getBuilder
@NotNull public SequenceBuilder getBuilder()
Description copied from interface:IRichSequence
Get a sequence builder for this sequence type- Specified by:
getBuilder
in interfaceBasedSequence
- Specified by:
getBuilder
in interfaceIRichSequence<BasedSequence>
- Returns:
- builder which can build this type of sequence
-
addSegments
public void addSegments(@NotNull IBasedSegmentBuilder<?> builder)
Description copied from interface:BasedSequence
Add segments for this sequence, replacing out of base characters with strings- Specified by:
addSegments
in interfaceBasedSequence
- Parameters:
builder
- builder
-
getSegmentTree
@NotNull public SegmentTree getSegmentTree()
Get the segment tree for this sequence or null if sequence is contiguous from startOffset to endOffset- Specified by:
getSegmentTree
in interfaceBasedSequence
- Returns:
- null for contiguous sequences, else segment tree for this sequence
-
toMapped
@NotNull public BasedSequence toMapped(CharMapper mapper)
- Specified by:
toMapped
in interfaceIRichSequence<BasedSequence>
-
baseSubSequence
@NotNull public final BasedSequence baseSubSequence(int startIndex)
Description copied from interface:BasedSequence
Get a portion of the original sequence that this sequence is based on- Specified by:
baseSubSequence
in interfaceBasedSequence
- Parameters:
startIndex
- offset from 0 of original sequence- Returns:
- based sequence from startIndex to the endIndex
-
baseSubSequence
@NotNull public BasedSequence baseSubSequence(int startIndex, int endIndex)
Description copied from interface:BasedSequence
Get a portion of this sequence's base sequenceNOTE: 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
andSubSequence
others use inherited implementation ofBasedSequenceImpl
- Specified by:
baseSubSequence
in interfaceBasedSequence
- Parameters:
startIndex
- offset from 0 of original sequenceendIndex
- offset from 0 of original sequence- Returns:
- based sequence whose contents reflect the selected portion
-
safeCharAt
public char safeCharAt(int index)
Description copied from interface:IRichSequence
return char at index or '\0' if index <0 or >=length()- Specified by:
safeCharAt
in interfaceIRichSequence<BasedSequence>
- Overrides:
safeCharAt
in classIRichSequenceBase<BasedSequence>
- Parameters:
index
- index- Returns:
- char or '\0'
-
safeBaseCharAt
public char safeBaseCharAt(int index)
Description copied from interface:BasedSequence
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
- Specified by:
safeBaseCharAt
in interfaceBasedSequence
- Parameters:
index
- index in string- Returns:
- character or '\0' if index out of base sequence
-
isBaseCharAt
public boolean isBaseCharAt(int index, @NotNull CharPredicate predicate)
Description copied from interface:BasedSequence
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
- Specified by:
isBaseCharAt
in interfaceBasedSequence
- Parameters:
index
- index in stringpredicate
- character set predicate- Returns:
- true if character at index tests true
-
getEmptyPrefix
@NotNull public BasedSequence getEmptyPrefix()
Description copied from interface:BasedSequence
Get empty prefix to this sequence- Specified by:
getEmptyPrefix
in interfaceBasedSequence
- Returns:
- same as subSequence(0,0)
-
getEmptySuffix
@NotNull public BasedSequence getEmptySuffix()
Description copied from interface:BasedSequence
Get empty suffix to this sequence- Specified by:
getEmptySuffix
in interfaceBasedSequence
- Returns:
- same as subSequence(length())
-
toStringOrNull
@Nullable public java.lang.String toStringOrNull()
Description copied from interface:IRichSequence
Return string or null if BaseSequence.NULL- Specified by:
toStringOrNull
in interfaceIRichSequence<BasedSequence>
- Overrides:
toStringOrNull
in classIRichSequenceBase<BasedSequence>
- Returns:
- string or null if BaseSequence.NULL
-
unescape
@NotNull public java.lang.String unescape()
Description copied from interface:BasedSequence
Get the unescaped string of this sequence content- Specified by:
unescape
in interfaceBasedSequence
- Returns:
- unescaped text
-
unescapeNoEntities
@NotNull public java.lang.String unescapeNoEntities()
Description copied from interface:BasedSequence
Get the unescaped string of this sequence content without unescaping entities- Specified by:
unescapeNoEntities
in interfaceBasedSequence
- Returns:
- unescaped text
-
unescape
@NotNull public BasedSequence unescape(@NotNull ReplacedTextMapper textMapper)
Description copied from interface:BasedSequence
Get the unescaped string of this sequence content- Specified by:
unescape
in interfaceBasedSequence
- Parameters:
textMapper
- replaced text mapper which will be uses to map unescaped index to original source index- Returns:
- unescaped text in based sequence
-
normalizeEOL
@NotNull public BasedSequence normalizeEOL(@NotNull ReplacedTextMapper textMapper)
Description copied from interface:BasedSequence
replace any \r\n and \r by \n- Specified by:
normalizeEOL
in interfaceBasedSequence
- Parameters:
textMapper
- replaced text mapper which will be uses to map unescaped index to original source index- Returns:
- based sequence with only \n for line separators
-
normalizeEndWithEOL
@NotNull public BasedSequence normalizeEndWithEOL(@NotNull ReplacedTextMapper textMapper)
Description copied from interface:BasedSequence
replace any \r\n and \r by \n, append terminating EOL if one is not present- Specified by:
normalizeEndWithEOL
in interfaceBasedSequence
- Parameters:
textMapper
- replaced text mapper which will be uses to map unescaped index to original source index- Returns:
- based sequence with only \n for line separators and terminated by \n
-
isContinuedBy
public boolean isContinuedBy(@NotNull BasedSequence other)
Description copied from interface:BasedSequence
Test if the given sequence is a continuation of this sequence in original source text- Specified by:
isContinuedBy
in interfaceBasedSequence
- Parameters:
other
- sequence to test- Returns:
- true if the given sequence is a continuation of this one in the original text
-
isContinuationOf
public boolean isContinuationOf(@NotNull BasedSequence other)
Description copied from interface:BasedSequence
Test if this sequence is a continuation of the given sequence in original source text- Specified by:
isContinuationOf
in interfaceBasedSequence
- Parameters:
other
- sequence to test- Returns:
- true if this sequence is a continuation of the given sequence in original source text
-
spliceAtEnd
@NotNull public BasedSequence spliceAtEnd(@NotNull BasedSequence other)
Description copied from interface:BasedSequence
Splice the given sequence to the end of this one and return a BasedSequence of the result. Does not copy anything, creates a new based sequence of the original text but one that spans characters of this sequence and other- Specified by:
spliceAtEnd
in interfaceBasedSequence
- Parameters:
other
- sequence to append to end of this one- 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
-
containsAllOf
public boolean containsAllOf(@NotNull BasedSequence other)
Description copied from interface:BasedSequence
start/end offset based containment, not textual- Specified by:
containsAllOf
in interfaceBasedSequence
- Parameters:
other
- based sequence from the same base- Returns:
- true if other is contained in this
-
containsSomeOf
public boolean containsSomeOf(@NotNull BasedSequence other)
Description copied from interface:BasedSequence
start/end offset based containment, not textual- Specified by:
containsSomeOf
in interfaceBasedSequence
- Parameters:
other
- based sequence from the same base- Returns:
- true if other is contained in this
-
intersect
@NotNull public BasedSequence intersect(@NotNull BasedSequence other)
Description copied from interface:BasedSequence
start/end offset based intersection, not textual- Specified by:
intersect
in interfaceBasedSequence
- Parameters:
other
- based sequence from the same parent- Returns:
- sequence which is the intersection of the range of this and other
-
containsSomeIn
public boolean containsSomeIn(@NotNull CharPredicate charSet)
Description copied from interface:BasedSequence
Test for line containing some of the characters in the set- Specified by:
containsSomeIn
in interfaceBasedSequence
- Parameters:
charSet
- set of characters to be tested- Returns:
- true if line contains some characters in the set
-
containsSomeNotIn
public boolean containsSomeNotIn(@NotNull CharPredicate charSet)
Description copied from interface:BasedSequence
Test for line containing some characters not in the set- Specified by:
containsSomeNotIn
in interfaceBasedSequence
- Parameters:
charSet
- set of characters to be tested- Returns:
- true if line contains some characters not in the set
-
containsOnlyIn
public boolean containsOnlyIn(@NotNull CharPredicate charSet)
Description copied from interface:BasedSequence
Test for line contains only characters from the set- Specified by:
containsOnlyIn
in interfaceBasedSequence
- Parameters:
charSet
- set of characters to be tested- Returns:
- true if line contains some characters from the set
-
containsOnlyNotIn
public boolean containsOnlyNotIn(@NotNull CharPredicate charSet)
Description copied from interface:BasedSequence
Test for line containing only characters not in the set- Specified by:
containsOnlyNotIn
in interfaceBasedSequence
- Parameters:
charSet
- set of characters to be tested- Returns:
- true if line contains some characters from the set
-
extendByAny
@NotNull public BasedSequence extendByAny(@NotNull CharPredicate charSet)
- Specified by:
extendByAny
in interfaceBasedSequence
-
extendByOneOfAny
@NotNull public BasedSequence extendByOneOfAny(@NotNull CharPredicate charSet)
- Specified by:
extendByOneOfAny
in interfaceBasedSequence
-
extendByAny
@NotNull public BasedSequence extendByAny(@NotNull CharPredicate charSet, int maxCount)
Description copied from interface:BasedSequence
Extend this based sequence to include characters from underlying based sequence- Specified by:
extendByAny
in interfaceBasedSequence
- Parameters:
charSet
- set of characters to includemaxCount
- maximum extra characters to include- Returns:
- sequence which
-
extendByAnyNot
@NotNull public BasedSequence extendByAnyNot(@NotNull CharPredicate charSet)
- Specified by:
extendByAnyNot
in interfaceBasedSequence
-
extendByOneOfAnyNot
@NotNull public BasedSequence extendByOneOfAnyNot(@NotNull CharPredicate charSet)
- Specified by:
extendByOneOfAnyNot
in interfaceBasedSequence
-
extendByAnyNot
@NotNull public BasedSequence extendByAnyNot(@NotNull CharPredicate charSet, int maxCount)
Description copied from interface:BasedSequence
Extend this based sequence to include characters from underlying based sequence not in character set- Specified by:
extendByAnyNot
in interfaceBasedSequence
- Parameters:
charSet
- set of characters to includemaxCount
- maximum extra characters to include- Returns:
- sequence which
-
extendToEndOfLine
@NotNull public final BasedSequence extendToEndOfLine(@NotNull CharPredicate eolChars)
- Specified by:
extendToEndOfLine
in interfaceBasedSequence
-
extendToEndOfLine
@NotNull public final BasedSequence extendToEndOfLine(boolean includeEol)
- Specified by:
extendToEndOfLine
in interfaceBasedSequence
-
extendToEndOfLine
@NotNull public final BasedSequence extendToEndOfLine()
- Specified by:
extendToEndOfLine
in interfaceBasedSequence
-
extendToStartOfLine
@NotNull public final BasedSequence extendToStartOfLine(@NotNull CharPredicate eolChars)
- Specified by:
extendToStartOfLine
in interfaceBasedSequence
-
extendToStartOfLine
@NotNull public final BasedSequence extendToStartOfLine(boolean includeEol)
- Specified by:
extendToStartOfLine
in interfaceBasedSequence
-
extendToStartOfLine
@NotNull public final BasedSequence extendToStartOfLine()
- Specified by:
extendToStartOfLine
in interfaceBasedSequence
-
extendToEndOfLine
@NotNull public final BasedSequence extendToEndOfLine(@NotNull CharPredicate eolChars, boolean includeEol)
Description copied from interface:BasedSequence
Extend in contained based sequence- Specified by:
extendToEndOfLine
in interfaceBasedSequence
- Parameters:
eolChars
- characters to consider as EOL, noteIRichSequence.eolStartLength(int)
IRichSequence.eolEndLength(int)
should report length of EOL found if length > 1includeEol
- if to include the eol in the string- 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
-
extendToStartOfLine
@NotNull public BasedSequence extendToStartOfLine(@NotNull CharPredicate eolChars, boolean includeEol)
Description copied from interface:BasedSequence
Extend in contained based sequence- Specified by:
extendToStartOfLine
in interfaceBasedSequence
- Parameters:
eolChars
- characters to consider as EOL, noteIRichSequence.eolStartLength(int)
IRichSequence.eolEndLength(int)
should report length of EOL found if length > 1includeEol
- if to include the eol in the string- 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
-
prefixWith
@NotNull public BasedSequence prefixWith(@Nullable java.lang.CharSequence prefix)
Description copied from interface:IRichSequence
Prefix this sequence with a char sequence- Specified by:
prefixWith
in interfaceIRichSequence<BasedSequence>
- Overrides:
prefixWith
in classIRichSequenceBase<BasedSequence>
- Parameters:
prefix
- char sequence- Returns:
- resulting sequence
-
prefixWithIndent
@NotNull public final BasedSequence prefixWithIndent()
- Specified by:
prefixWithIndent
in interfaceBasedSequence
-
prefixWithIndent
@NotNull public BasedSequence prefixWithIndent(int maxColumns)
Description copied from interface:BasedSequence
Extend this based sequence to include characters from underlying based sequence taking tab expansion to 4th spaces into account- Specified by:
prefixWithIndent
in interfaceBasedSequence
- Parameters:
maxColumns
- maximum columns to include, defaultInteger.MAX_VALUE
- Returns:
- sequence which
-
prefixOf
@NotNull public BasedSequence prefixOf(@NotNull BasedSequence other)
Description copied from interface:BasedSequence
Get the prefix part of this from other, start/end offset based containment, not textual- Specified by:
prefixOf
in interfaceBasedSequence
- Parameters:
other
- based sequence from the same base- Returns:
- prefix part of this as compared to other, start/end offset based, not content
-
suffixOf
@NotNull public BasedSequence suffixOf(@NotNull BasedSequence other)
Description copied from interface:BasedSequence
Get the suffix part of this from other, start/end offset based containment, not textual- Specified by:
suffixOf
in interfaceBasedSequence
- Parameters:
other
- based sequence from the same base- Returns:
- suffix part of this as compared to other, start/end offset based, not content
-
baseLineRangeAtIndex
@NotNull public Range baseLineRangeAtIndex(int index)
- Specified by:
baseLineRangeAtIndex
in interfaceBasedSequence
-
baseLineColumnAtIndex
@NotNull public Pair<java.lang.Integer,java.lang.Integer> baseLineColumnAtIndex(int index)
- Specified by:
baseLineColumnAtIndex
in interfaceBasedSequence
-
baseEndOfLine
public int baseEndOfLine(int index)
- Specified by:
baseEndOfLine
in interfaceBasedSequence
-
baseEndOfLineAnyEOL
public int baseEndOfLineAnyEOL(int index)
- Specified by:
baseEndOfLineAnyEOL
in interfaceBasedSequence
-
baseStartOfLine
public int baseStartOfLine(int index)
- Specified by:
baseStartOfLine
in interfaceBasedSequence
-
baseStartOfLineAnyEOL
public int baseStartOfLineAnyEOL(int index)
- Specified by:
baseStartOfLineAnyEOL
in interfaceBasedSequence
-
baseColumnAtIndex
public int baseColumnAtIndex(int index)
- Specified by:
baseColumnAtIndex
in interfaceBasedSequence
-
baseEndOfLine
public int baseEndOfLine()
- Specified by:
baseEndOfLine
in interfaceBasedSequence
-
baseEndOfLineAnyEOL
public int baseEndOfLineAnyEOL()
- Specified by:
baseEndOfLineAnyEOL
in interfaceBasedSequence
-
baseColumnAtEnd
public int baseColumnAtEnd()
- Specified by:
baseColumnAtEnd
in interfaceBasedSequence
-
baseLineRangeAtEnd
@NotNull public Range baseLineRangeAtEnd()
- Specified by:
baseLineRangeAtEnd
in interfaceBasedSequence
-
baseLineColumnAtEnd
@NotNull public Pair<java.lang.Integer,java.lang.Integer> baseLineColumnAtEnd()
- Specified by:
baseLineColumnAtEnd
in interfaceBasedSequence
-
baseStartOfLine
public int baseStartOfLine()
- Specified by:
baseStartOfLine
in interfaceBasedSequence
-
baseStartOfLineAnyEOL
public int baseStartOfLineAnyEOL()
- Specified by:
baseStartOfLineAnyEOL
in interfaceBasedSequence
-
baseColumnAtStart
public int baseColumnAtStart()
- Specified by:
baseColumnAtStart
in interfaceBasedSequence
-
baseLineRangeAtStart
@NotNull public Range baseLineRangeAtStart()
- Specified by:
baseLineRangeAtStart
in interfaceBasedSequence
-
baseLineColumnAtStart
@NotNull public Pair<java.lang.Integer,java.lang.Integer> baseLineColumnAtStart()
- Specified by:
baseLineColumnAtStart
in interfaceBasedSequence
-
-