Class IRichSequenceBase<T extends IRichSequence<T>>

    • Constructor Detail

      • IRichSequenceBase

        public IRichSequenceBase​(int 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. CharSequence hash code is not specified therefore when in doubt about how it is computed then 0 should be passed to this constructor to compute one that is equal to the string content.

        Parameters:
        hash - hash code for the char sequence.
    • Method Detail

      • equals

        @Contract(pure=true,
                  value="null -> false")
        public final boolean equals​(java.lang.Object o)
        Equality comparison based on character content of this sequence, with quick fail resorting to content comparison only if length and hashCodes are equal
        Specified by:
        equals in interface IRichSequence<T extends IRichSequence<T>>
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - any char sequence
        Returns:
        true if character contents are equal
      • hashCode

        @Contract(pure=true)
        public final int hashCode()
        String hash code computation
        Specified by:
        hashCode in interface IRichSequence<T extends IRichSequence<T>>
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hash code of equivalent string
      • equalsIgnoreCase

        @Contract(pure=true,
                  value="null -> false")
        public final boolean equalsIgnoreCase​(@Nullable
                                              java.lang.Object other)
        Description copied from interface: IRichSequence
        Test the sequence for a match to another CharSequence, ignoring case differences
        Specified by:
        equalsIgnoreCase in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        other - characters to match against
        Returns:
        true if match
      • equals

        @Contract(pure=true,
                  value="null, _ ->false")
        public final boolean equals​(@Nullable
                                    java.lang.Object other,
                                    boolean ignoreCase)
        Description copied from interface: IRichSequence
        Test the sequence for a match to another CharSequence
        Specified by:
        equals in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        other - characters to match against
        ignoreCase - case ignored when true
        Returns:
        true if match
      • compareTo

        public int compareTo​(@NotNull
                             java.lang.CharSequence o)
        Specified by:
        compareTo in interface java.lang.Comparable<T extends IRichSequence<T>>
      • sequenceOf

        @NotNull
        public final T sequenceOf​(@Nullable
                                  java.lang.CharSequence charSequence)
        Description copied from interface: IRichSequence
        Factory function
        Specified by:
        sequenceOf in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        charSequence - char sequence from which to construct a rich char sequence
        Returns:
        rich char sequence from given inputs
      • sequenceOf

        @NotNull
        public final T sequenceOf​(@Nullable
                                  java.lang.CharSequence charSequence,
                                  int startIndex)
        Description copied from interface: IRichSequence
        Factory function
        Specified by:
        sequenceOf in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        charSequence - char sequence from which to construct a rich char sequence
        startIndex - start index of the sequence to use
        Returns:
        rich char sequence from given inputs
      • subSequence

        @NotNull
        public final T subSequence​(int startIndex)
        Description copied from interface: IRichSequence
        Get a portion of this sequence starting from a given offset to endIndex of the sequence
        Specified by:
        subSequence in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        startIndex - offset from startIndex of this sequence
        Returns:
        based sequence whose contents reflect the selected portion
      • subSequence

        @NotNull
        public final T subSequence​(@NotNull
                                   Range range)
        Get a portion of this sequence selected by range
        Specified by:
        subSequence in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        range - range to get, coordinates offset form start of this sequence
        Returns:
        sequence whose contents reflect the selected portion, if range.isNull() then this is returned
      • subSequenceBefore

        @NotNull
        public final T subSequenceBefore​(@NotNull
                                         Range range)
        Get a portion of this sequence before one selected by range
        Specified by:
        subSequenceBefore in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        range - range to get, coordinates offset form start of this sequence
        Returns:
        sequence whose contents come before the selected range, if range.isNull() then IRichSequence.nullSequence()
      • subSequenceAfter

        @NotNull
        public final T subSequenceAfter​(@NotNull
                                        Range range)
        Get a portion of this sequence after one selected by range
        Specified by:
        subSequenceAfter in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        range - range to get, coordinates offset form start of this sequence
        Returns:
        sequence whose contents come after the selected range, if range.isNull() then IRichSequence.nullSequence()
      • subSequenceBeforeAfter

        public final Pair<T,​T> subSequenceBeforeAfter​(Range range)
        Get a portions of this sequence before and after one selected by range
        Parameters:
        range - range to get, coordinates offset form start of this sequence
        Returns:
        sequence whose contents come before and after the selected range, if range.isNull() then IRichSequence.nullSequence()
      • endSequence

        @NotNull
        public final T endSequence​(int startIndex,
                                   int endIndex)
        Description copied from interface: IRichSequence
        Convenience method to get characters offset from endIndex of sequence. no exceptions are thrown, instead a \0 is returned for an invalid index positions
        Specified by:
        endSequence in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        startIndex - offset from endIndex of sequence [ 0..length() )
        endIndex - offset from endIndex of sequence [ 0..length() )
        Returns:
        selected portion spanning length() - startIndex to length() - endIndex of this sequence
      • endSequence

        @NotNull
        public final T endSequence​(int startIndex)
        Description copied from interface: IRichSequence
        Convenience method to get characters offset from endIndex of sequence. no exceptions are thrown, instead a \0 is returned for an invalid index positions
        Specified by:
        endSequence in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        startIndex - offset from endIndex of sequence [ 0..length() )
        Returns:
        selected portion spanning length() - startIndex to length() of this sequence
      • endCharAt

        public final char endCharAt​(int index)
        Description copied from interface: IRichSequence
        Convenience method to get characters offset from end of sequence. no exceptions are thrown, instead a \0 is returned for an invalid index positions
        Specified by:
        endCharAt in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - offset from end of sequence
        Returns:
        character located at length() - index in this sequence
      • midSequence

        @NotNull
        public final T midSequence​(int startIndex,
                                   int endIndex)
        Description copied from interface: IRichSequence
        Convenience method to get characters offset from start or end of sequence. when offset >=0 then it is offset from the start of the sequence, when <0 then from the end

        no exceptions are thrown, instead a \0 is returned for an invalid index positions

        Specified by:
        midSequence in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        startIndex - offset into this sequence
        endIndex - offset into this sequence
        Returns:
        selected portion spanning startIndex to endIndex of this sequence. If offset is <0 then it is taken as relative to length()
      • midSequence

        @NotNull
        public final T midSequence​(int startIndex)
        Description copied from interface: IRichSequence
        Convenience method to get characters offset from start or end of sequence. when offset >= then it is offset from the start of the sequence, when <0 then from the end

        no exceptions are thrown, instead a \0 is returned for an invalid index positions

        Specified by:
        midSequence in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        startIndex - offset into this sequence
        Returns:
        selected portion spanning startIndex to length() of this sequence. If offset is <0 then it is taken as relative to length()
      • midCharAt

        public final char midCharAt​(int index)
        Description copied from interface: IRichSequence
        Convenience method to get characters offset from start or end of sequence. when index >= then it is offset from the start of the sequence, when <0 then from the end no exceptions are thrown, instead a \0 is returned for an invalid index positions
        Specified by:
        midCharAt in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - of character to get
        Returns:
        character at index or \0 if index is outside valid range for this sequence
      • lastChar

        public final char lastChar()
        Specified by:
        lastChar in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        the last character of the sequence or '\0' if empty
      • firstChar

        public final char firstChar()
        Specified by:
        firstChar in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        the first character of the sequence or '\0' if empty
      • validateIndex

        public final void validateIndex​(int index)
      • validateIndexInclusiveEnd

        public final void validateIndexInclusiveEnd​(int index)
      • validateStartEnd

        public final void validateStartEnd​(int startIndex,
                                           int endIndex)
      • 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 interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - index
        Returns:
        char or '\0'
      • safeSubSequence

        @NotNull
        public T safeSubSequence​(int startIndex,
                                 int endIndex)
        Description copied from interface: IRichSequence
        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. If a subsequence of this sequence with matching start/end should equal (using equals()) all such subsequences of this sequence.

        Specified by:
        safeSubSequence in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        startIndex - offset from startIndex of this sequence
        endIndex - offset from startIndex of this sequence
        Returns:
        based sequence whose contents reflect the selected portion
      • safeSubSequence

        @NotNull
        public T safeSubSequence​(int startIndex)
        Description copied from interface: IRichSequence
        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. If a subsequence of this sequence with matching start/end should equal (using equals()) all such subsequences of this sequence.

        Specified by:
        safeSubSequence in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        startIndex - offset from startIndex of this sequence
        Returns:
        based sequence whose contents reflect the selected portion
      • isCharAt

        public boolean isCharAt​(int index,
                                @NotNull
                                CharPredicate predicate)
        Description copied from interface: IRichSequence
        Safe, if index out of range returns '\0'
        Specified by:
        isCharAt in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - index in string
        predicate - character set predicate
        Returns:
        true if character at index tests true
      • toStringOrNull

        @Nullable
        public java.lang.String toStringOrNull()
        Description copied from interface: IRichSequence
        Return string or null if BaseSequence.NULL
        Specified by:
        toStringOrNull in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        string or null if BaseSequence.NULL
      • indexOf

        public final int indexOf​(@NotNull
                                 java.lang.CharSequence s)
        Description copied from interface: IRichSequence
        All index methods return the position or -1 if not found of the given character, characters or string.

        The basic methods have overloads for 1, 2, or 3 characters and CharSequence parameters. If fromIndex is not given then for forward searching methods 0 is taken as the value, for reverse searching methods length() is taken as the value

        For forward searching methods fromIndex is the minimum start position for search and endIndex is the maximum end position, if not given the length() of string is assumed.

        For reverse searching methods fromIndex is the maximum start position for search and startIndex is the minimum end position, if not given then 0 is assumed.

        Specified by:
        indexOf in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        s - character pre whose occurrence to find
        Returns:
        index where found or -1
      • indexOf

        public final int indexOf​(@NotNull
                                 java.lang.CharSequence s,
                                 int fromIndex,
                                 int endIndex)
        Specified by:
        indexOf in interface IRichSequence<T extends IRichSequence<T>>
      • lastIndexOf

        public final int lastIndexOf​(@NotNull
                                     java.lang.CharSequence s,
                                     int startIndex,
                                     int fromIndex)
        Specified by:
        lastIndexOf in interface IRichSequence<T extends IRichSequence<T>>
      • countLeading

        public final int countLeading​(@NotNull
                                      CharPredicate chars)
        Description copied from interface: IRichSequence
        Count leading/trailing characters of this sequence

        Parameters can be CharPredicate, counts any contiguous leading/trailing characters in the sequence which are contained in the given char set.

        All functions have overloads: with no fromIndex then 0 is taken for leading and length() for trailing methods with fromIndex then this is taken as the start for leading and end for trailing methods with fromIndex and endIndex, counting will start at fromIndex and stop at endIndex

        countLeading(CharPredicate): count contiguous leading characters from set in this sequence countLeadingNot(CharPredicate): count contiguous leading characters not from set in this sequence countTrailing(CharPredicate): count contiguous leading characters from set in this sequence countTrailingNot(CharPredicate): count contiguous leading characters not from set in this sequence

        Specified by:
        countLeading in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        chars - predicate for set of contiguous characters which should be counted
        Returns:
        number of chars in contiguous span at start of sequence
      • countLeadingColumns

        public final int countLeadingColumns​(int startColumn,
                                             @NotNull
                                             CharPredicate chars)
        Description copied from interface: IRichSequence
        Count column of indent given by chars in the set in this sequence, expanding tabs to 4th column
        Specified by:
        countLeadingColumns in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        startColumn - column of where this sequence starts
        chars - whitespace characters
        Returns:
        column of first non-whitespace as given by chars
      • trimStart

        @NotNull
        public final T trimStart​(int keep,
                                 @NotNull
                                 CharPredicate chars)
        Description copied from interface: IRichSequence
        Trim, Trim start/end of this sequence, characters to trim are passed in the sequence argument

        returns trimmed sequence or if nothing matched the original sequence

        If character set in the form of character sequence is not passed in the SequenceUtils.WHITESPACE are assumed.

        Specified by:
        trimStart in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        keep - minimum length of would be trimmed characters to keep. ie. keep 4, will leave 0..4 as is but remove any >4
        chars - set of characters to trim from start of line
        Returns:
        sequence after it is trimmed
      • trimmedStart

        @NotNull
        public final T trimmedStart​(int keep,
                                    @NotNull
                                    CharPredicate chars)
        Description copied from interface: IRichSequence
        Get the characters Trimmed, Trimmed from start/end of this sequence, characters to trim are passed in the sequence argument

        returns trimmed sequence or if nothing matched the original sequence

        The pair returning functions return before and after sequence

        Specified by:
        trimmedStart in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        keep - minimum length of would be trimmed characters to keep. ie. keep 4, will leave 0..4 as is but remove any >4
        chars - set of characters to trim from start of line
        Returns:
        part of the sequence that was trimmed from the start
      • trimStartRange

        @NotNull
        public final Range trimStartRange​(int keep,
                                          @NotNull
                                          CharPredicate chars)
        Description copied from interface: IRichSequence
        Range of kept sequence when trim start/end of this sequence is performed, characters to trim are passed in the sequence argument

        returns range of kept sequence or if nothing matched then Range.NULL is returned, meaning keep all

        If character set in the form of character sequence is not passed in the SequenceUtils.WHITESPACE are assumed.

        Specified by:
        trimStartRange in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        keep - minimum length of would be trimmed characters to keep. ie. keep 4, will leave 0..4 as is but remove any >4
        chars - set of characters to trim from start of line
        Returns:
        range in this sequence to keep or Range.NULL if to keep all
      • padding

        @NotNull
        public final T padding​(int length,
                               char pad)
        Description copied from interface: IRichSequence
        Get the chars needed for padding to length
        Specified by:
        padding in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        length - length
        pad - char to use for padding
        Returns:
        padding chars
      • padStart

        @NotNull
        public T padStart​(int length,
                          char pad)
        Description copied from interface: IRichSequence
        Pad this sequence to given length
        Specified by:
        padStart in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        length - length to pad
        pad - char to use for padding
        Returns:
        sequence padded
      • eolEndLength

        public final int eolEndLength()
        Description copied from interface: IRichSequence
        Get the length of EOL character at the end of this sequence, if present.

        \n - 1 \r - 1 \r\n - 2

        Specified by:
        eolEndLength in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        0 if no EOL, 1, or 2 depending on the EOL suffix of this sequence
      • eolEndLength

        public final int eolEndLength​(int eolEnd)
        Description copied from interface: IRichSequence
        Get the length of EOL character at the given index of this sequence, if present.

        \n - 1 \r - 1 \r\n - 2

        Specified by:
        eolEndLength in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        eolEnd - 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.
        Returns:
        0 if no EOL, 1, or 2 depending on the EOL suffix of this sequence
      • eolStartLength

        public final int eolStartLength​(int eolStart)
        Description copied from interface: IRichSequence
        Get the length of EOL character at the given index of this sequence, if present.

        \n - 1 \r - 1 \r\n - 2

        Specified by:
        eolStartLength in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        eolStart - 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
        Returns:
        0 if no EOL, 1, or 2 depending on the EOL suffix of this sequence
      • endOfLine

        public final int endOfLine​(int index)
        Description copied from interface: IRichSequence
        Get the offset of the end of line at given index, end of line delimited by \n
        Specified by:
        endOfLine in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - index where to start searching for end of line
        Returns:
        index of end of line delimited by \n
      • endOfLineAnyEOL

        public final int endOfLineAnyEOL​(int index)
        Description copied from interface: IRichSequence
        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.
        Specified by:
        endOfLineAnyEOL in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - index where to start searching for end of line
        Returns:
        index of end of line delimited by \n
      • startOfLine

        public final int startOfLine​(int index)
        Description copied from interface: IRichSequence
        Get the offset of the start of line at given index, start of line delimited by \n
        Specified by:
        startOfLine in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - index where to start searching for end of line
        Returns:
        index of end of line delimited by \n
      • startOfLineAnyEOL

        public final int startOfLineAnyEOL​(int index)
        Description copied from interface: IRichSequence
        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.
        Specified by:
        startOfLineAnyEOL in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - index where to start searching for end of line
        Returns:
        index of end of line delimited by \n
      • endOfDelimitedBy

        public final int endOfDelimitedBy​(@NotNull
                                          java.lang.CharSequence s,
                                          int index)
        Description copied from interface: IRichSequence
        Find start/end region in this sequence delimited by any characters in argument or the CharSequence

        For Any and AnyNot methods uses the CharSequence argument as a character set of possible delimiting characters

        Specified by:
        endOfDelimitedBy in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        s - character sequence delimiting the region
        index - from which to start looking for end of region
        Returns:
        index of end of region delimited by s
      • lineRangeAt

        @NotNull
        public final Range lineRangeAt​(int index)
        Description copied from interface: IRichSequence
        Get the line characters at given index, line delimited by \n
        Specified by:
        lineRangeAt in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - index at which to get the line
        Returns:
        range in sequence for the line delimited by '\n', containing index
      • lineRangeAtAnyEOL

        @NotNull
        public final Range lineRangeAtAnyEOL​(int index)
        Description copied from interface: IRichSequence
        Get the line characters at given index, line delimited by \n, \r or \r\n
        Specified by:
        lineRangeAtAnyEOL in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - index at which to get the line
        Returns:
        range in sequence for the line delimited by end of line, containing index
      • lineAt

        @NotNull
        public final T lineAt​(int index)
        Description copied from interface: IRichSequence
        Get the line characters at given index, line delimited by \n
        Specified by:
        lineAt in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - index at which to get the line
        Returns:
        sub-sequence for the line containing index
      • lineAtAnyEOL

        @NotNull
        public final T lineAtAnyEOL​(int index)
        Description copied from interface: IRichSequence
        Get the line characters at given index, line delimited by \n, \r or \r\n
        Specified by:
        lineAtAnyEOL in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - index at which to get the line
        Returns:
        sub-sequence for the line containing index
      • eolEndRange

        @NotNull
        public final Range eolEndRange​(int eolEnd)
        Description copied from interface: IRichSequence
        Return Range of eol at given index
        Specified by:
        eolEndRange in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        eolEnd - 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.
        Returns:
        range of eol given by index of its end or Range.NULL if no eol ends at index
      • eolStartRange

        @NotNull
        public Range eolStartRange​(int eolStart)
        Description copied from interface: IRichSequence
        Return Range of eol at given index
        Specified by:
        eolStartRange in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        eolStart - 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
        Returns:
        range of eol given by index of its end or Range.NULL if no eol starts at index
      • trimEOL

        @NotNull
        public final T trimEOL()
        Description copied from interface: IRichSequence
        Trim last eol at the end of this sequence,
        Specified by:
        trimEOL in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        sequence with one EOL trimmed off if it had one
      • trimTailBlankLines

        @NotNull
        public final T trimTailBlankLines()
        Description copied from interface: IRichSequence
        Trim leading trailing blank lines in this sequence
        Specified by:
        trimTailBlankLines in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        return sequence with trailing blank lines trimmed off
      • trailingBlankLinesRange

        @NotNull
        public final Range trailingBlankLinesRange​(CharPredicate eolChars,
                                                   int startIndex,
                                                   int fromIndex)
        Description copied from interface: IRichSequence
        Get Range of trailing blank lines at given index offsets in sequence
        Specified by:
        trailingBlankLinesRange in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        eolChars - characters to consider as EOL, note IRichSequence.eolStartLength(int) should report length of EOL found if length > 1
        startIndex - 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()
        fromIndex - 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()
        Returns:
        range of blank lines at or before fromIndex and ranging to minimum of startIndex if the range in sequence contains only whitespace characters then the whole range will be returned even if contains no EOL characters
      • leadingBlankLinesRange

        @NotNull
        public final Range leadingBlankLinesRange​(@NotNull
                                                  CharPredicate eolChars,
                                                  int fromIndex,
                                                  int endIndex)
        Description copied from interface: IRichSequence
        Get Range of leading blank lines at given index offsets in sequence
        Specified by:
        leadingBlankLinesRange in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        eolChars - characters to consider as EOL, note IRichSequence.eolStartLength(int) should report length of EOL found if length > 1
        fromIndex - minimum 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()
        endIndex - 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()
        Returns:
        range of blank lines at or before fromIndex and ranging to minimum of startIndex, Range.NULL if none found if the range in sequence contains only whitespace characters then the whole range will be returned even if contains no EOL characters
      • trimToEndOfLine

        @NotNull
        public T trimToEndOfLine​(@NotNull
                                 CharPredicate eolChars,
                                 boolean includeEol,
                                 int index)
        Description copied from interface: IRichSequence
        Trim end to end of line containing index
        Specified by:
        trimToEndOfLine in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        eolChars - characters to consider as EOL, note IRichSequence.eolStartLength(int) should report length of EOL found if length > 1
        includeEol - true if EOL is to be included in the line
        index - index for offset contained by the line can be any value, if less than 0 it is the same as 0, if greater than length() it is the same as length()
        Returns:
        trimmed version of the sequence to given EOL or the original sequence
      • trimToStartOfLine

        @NotNull
        public T trimToStartOfLine​(@NotNull
                                   CharPredicate eolChars,
                                   boolean includeEol,
                                   int index)
        Description copied from interface: IRichSequence
        Trim start to start of line containing index
        Specified by:
        trimToStartOfLine in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        eolChars - characters to consider as EOL, note IRichSequence.eolStartLength(int) should report length of EOL found if length > 1
        includeEol - true if EOL is to be included in the line
        index - index for offset contained by the line can be any value, if less than 0 it is the same as 0, if greater than length() it is the same as length()
        Returns:
        trimmed version of the sequence to given EOL or the original sequence
      • ifNull

        @NotNull
        public final T ifNull​(@NotNull
                              T other)
        Description copied from interface: IRichSequence
        If this sequence is the nullSequence() instance then returns other, otherwise returns this sequence.
        Specified by:
        ifNull in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        other - based sequence to return if this is nullSequence()
        Returns:
        this or other
      • ifNullEmptyAfter

        @NotNull
        public final T ifNullEmptyAfter​(@NotNull
                                        T other)
        Description copied from interface: IRichSequence
        If this sequence is the nullSequence() instance then returns an empty subSequence from the end of other, otherwise returns this sequence.
        Specified by:
        ifNullEmptyAfter in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        other - based sequence from which to take the empty sequence
        Returns:
        this or other.subSequence(other.length(), other.length())
      • ifNullEmptyBefore

        @NotNull
        public final T ifNullEmptyBefore​(@NotNull
                                         T other)
        Description copied from interface: IRichSequence
        If this sequence is the nullSequence() instance then returns an empty subSequence from the start of other, otherwise returns this sequence.
        Specified by:
        ifNullEmptyBefore in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        other - based sequence from which to take the empty sequence
        Returns:
        this or other.subSequence(0, 0)
      • nullIfEmpty

        @NotNull
        public final T nullIfEmpty()
        Description copied from interface: IRichSequence
        If this sequence is empty return nullSequence() otherwise returns this sequence.
        Specified by:
        nullIfEmpty in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        this or nullSequence()
      • nullIfBlank

        @NotNull
        public final T nullIfBlank()
        Description copied from interface: IRichSequence
        If this sequence is blank return nullSequence() otherwise returns this sequence.
        Specified by:
        nullIfBlank in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        this or nullSequence()
      • nullIf

        @NotNull
        public final T nullIf​(boolean condition)
        Description copied from interface: IRichSequence
        If condition is true return nullSequence() otherwise returns this sequence.
        Specified by:
        nullIf in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        condition - when true return NULL else this
        Returns:
        this or nullSequence()
      • nullIfNot

        @NotNull
        public final T nullIfNot​(@NotNull
                                 java.util.function.BiPredicate<? super T,​? super java.lang.CharSequence> predicate,
                                 java.lang.CharSequence... matches)
        Specified by:
        nullIfNot in interface IRichSequence<T extends IRichSequence<T>>
      • nullIf

        @NotNull
        public final T nullIf​(@NotNull
                              java.util.function.Predicate<? super java.lang.CharSequence> predicate,
                              java.lang.CharSequence... matches)
        Description copied from interface: IRichSequence
        If predicate returns true for one of given sequences return nullSequence() otherwise returns this sequence.
        Specified by:
        nullIf in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        predicate - sequence predicate
        matches - match sequence list
        Returns:
        this or nullSequence()
      • nullIfNot

        @NotNull
        public final T nullIfNot​(@NotNull
                                 java.util.function.Predicate<? super java.lang.CharSequence> predicate,
                                 java.lang.CharSequence... matches)
        Specified by:
        nullIfNot in interface IRichSequence<T extends IRichSequence<T>>
      • nullIf

        @NotNull
        public final T nullIf​(java.lang.CharSequence... matches)
        Description copied from interface: IRichSequence
        If this sequence matches one of given sequences return nullSequence() otherwise returns this sequence.
        Specified by:
        nullIf in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        matches - match sequence list
        Returns:
        this or nullSequence()
      • nullIf

        @NotNull
        public final T nullIf​(@NotNull
                              java.util.function.BiPredicate<? super T,​? super java.lang.CharSequence> predicate,
                              java.lang.CharSequence... matches)
        Description copied from interface: IRichSequence
        If predicate returns true for this sequence and one of given sequences return nullSequence() otherwise returns this sequence.
        Specified by:
        nullIf in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        predicate - bi predicate for test, first argument is always this, second is one of the match sequences
        matches - match sequence list
        Returns:
        this or nullSequence()
      • endsWith

        public final boolean endsWith​(@NotNull
                                      java.lang.CharSequence suffix)
        Description copied from interface: IRichSequence
        test if this sequence ends with given characters
        Specified by:
        endsWith in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        suffix - characters to test
        Returns:
        true if ends with suffix
      • endsWith

        public final boolean endsWith​(@NotNull
                                      java.lang.CharSequence suffix,
                                      boolean ignoreCase)
        Description copied from interface: IRichSequence
        test if this sequence ends with given characters
        Specified by:
        endsWith in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        suffix - characters to test
        ignoreCase - case ignored when true
        Returns:
        true if ends with suffix
      • startsWith

        public final boolean startsWith​(@NotNull
                                        java.lang.CharSequence prefix)
        Description copied from interface: IRichSequence
        test if this sequence starts with given characters
        Specified by:
        startsWith in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        prefix - characters to test
        Returns:
        true if starts with prefix
      • startsWith

        public final boolean startsWith​(@NotNull
                                        java.lang.CharSequence prefix,
                                        boolean ignoreCase)
        Description copied from interface: IRichSequence
        test if this sequence starts with given characters
        Specified by:
        startsWith in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        prefix - characters to test
        ignoreCase - case ignored when true
        Returns:
        true if starts with prefix
      • removeSuffix

        @NotNull
        public final T removeSuffix​(@NotNull
                                    java.lang.CharSequence suffix)
        Description copied from interface: IRichSequence
        Remove suffix if present
        Specified by:
        removeSuffix in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        suffix - characters to remove
        Returns:
        sequence with suffix removed, or same sequence if no suffix was present
      • removePrefix

        @NotNull
        public final T removePrefix​(@NotNull
                                    java.lang.CharSequence prefix)
        Description copied from interface: IRichSequence
        Remove prefix if present
        Specified by:
        removePrefix in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        prefix - characters to remove
        Returns:
        sequence with prefix removed, or same sequence if no prefix was present
      • removeProperSuffix

        @NotNull
        public final T removeProperSuffix​(@NotNull
                                          java.lang.CharSequence suffix)
        Description copied from interface: IRichSequence
        Remove suffix if present but only if this sequence is longer than the suffix
        Specified by:
        removeProperSuffix in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        suffix - characters to remove
        Returns:
        sequence with suffix removed, or same sequence if no suffix was present
      • removeProperPrefix

        @NotNull
        public final T removeProperPrefix​(@NotNull
                                          java.lang.CharSequence prefix)
        Description copied from interface: IRichSequence
        Remove prefix if present but only if this sequence is longer than the suffix
        Specified by:
        removeProperPrefix in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        prefix - characters to remove
        Returns:
        sequence with prefix removed, or same sequence if no prefix was present
      • endsWithIgnoreCase

        public final boolean endsWithIgnoreCase​(@NotNull
                                                java.lang.CharSequence suffix)
        Description copied from interface: IRichSequence
        test if this sequence ends with given characters, ignoring case differences
        Specified by:
        endsWithIgnoreCase in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        suffix - characters to test
        Returns:
        true if ends with suffix
      • startsWithIgnoreCase

        public final boolean startsWithIgnoreCase​(@NotNull
                                                  java.lang.CharSequence prefix)
        Description copied from interface: IRichSequence
        test if this sequence starts with given characters, ignoring case differences
        Specified by:
        startsWithIgnoreCase in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        prefix - characters to test
        Returns:
        true if starts with prefix
      • removeSuffixIgnoreCase

        @NotNull
        public final T removeSuffixIgnoreCase​(@NotNull
                                              java.lang.CharSequence suffix)
        Description copied from interface: IRichSequence
        Remove suffix if present, ignoring case differences
        Specified by:
        removeSuffixIgnoreCase in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        suffix - characters to remove
        Returns:
        sequence with suffix removed, or same sequence if no suffix was present
      • removePrefixIgnoreCase

        @NotNull
        public final T removePrefixIgnoreCase​(@NotNull
                                              java.lang.CharSequence prefix)
        Description copied from interface: IRichSequence
        Remove prefix if present, ignoring case differences
        Specified by:
        removePrefixIgnoreCase in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        prefix - characters to remove
        Returns:
        sequence with prefix removed, or same sequence if no prefix was present
      • removeProperSuffixIgnoreCase

        @NotNull
        public final T removeProperSuffixIgnoreCase​(@NotNull
                                                    java.lang.CharSequence suffix)
        Description copied from interface: IRichSequence
        Remove suffix if present but only if this sequence is longer than the suffix, ignoring case differences
        Specified by:
        removeProperSuffixIgnoreCase in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        suffix - characters to remove
        Returns:
        sequence with suffix removed, or same sequence if no suffix was present
      • removeProperPrefixIgnoreCase

        @NotNull
        public final T removeProperPrefixIgnoreCase​(@NotNull
                                                    java.lang.CharSequence prefix)
        Description copied from interface: IRichSequence
        Remove prefix if present but only if this sequence is longer than the suffix, ignoring case differences
        Specified by:
        removeProperPrefixIgnoreCase in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        prefix - characters to remove
        Returns:
        sequence with prefix removed, or same sequence if no prefix was present
      • removeSuffix

        @NotNull
        public final T removeSuffix​(@NotNull
                                    java.lang.CharSequence suffix,
                                    boolean ignoreCase)
        Description copied from interface: IRichSequence
        Remove suffix if present
        Specified by:
        removeSuffix in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        suffix - characters to remove
        ignoreCase - case ignored when true
        Returns:
        sequence with suffix removed, or same sequence if no suffix was present
      • removePrefix

        @NotNull
        public final T removePrefix​(@NotNull
                                    java.lang.CharSequence prefix,
                                    boolean ignoreCase)
        Description copied from interface: IRichSequence
        Remove prefix if present
        Specified by:
        removePrefix in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        prefix - characters to remove
        ignoreCase - case ignored when true
        Returns:
        sequence with prefix removed, or same sequence if no prefix was present
      • removeProperSuffix

        @NotNull
        public final T removeProperSuffix​(@NotNull
                                          java.lang.CharSequence suffix,
                                          boolean ignoreCase)
        Description copied from interface: IRichSequence
        Remove suffix if present but only if this sequence is longer than the suffix
        Specified by:
        removeProperSuffix in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        suffix - characters to remove
        ignoreCase - case ignored when true
        Returns:
        sequence with suffix removed, or same sequence if no suffix was present
      • removeProperPrefix

        @NotNull
        public final T removeProperPrefix​(@NotNull
                                          java.lang.CharSequence prefix,
                                          boolean ignoreCase)
        Description copied from interface: IRichSequence
        Remove prefix if present but only if this sequence is longer than the suffix
        Specified by:
        removeProperPrefix in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        prefix - characters to remove
        ignoreCase - case ignored when true
        Returns:
        sequence with prefix removed, or same sequence if no prefix was present
      • insert

        @NotNull
        public T insert​(int index,
                        @NotNull
                        java.lang.CharSequence chars)
        Description copied from interface: IRichSequence
        Insert char sequence at given index
        Specified by:
        insert in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - index of insertion. if >length of this sequence then same as length, if <0 then same as 0
        chars - char sequence to insert
        Returns:
        resulting sequence based sequence implementation may throw an IllegalArgumentException if inserting another based sequence out of order based on offsets
      • delete

        @NotNull
        public T delete​(int startIndex,
                        int endIndex)
        Description copied from interface: IRichSequence
        Delete range in sequence
        Specified by:
        delete in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        startIndex - start index of deletion
        endIndex - end index, not inclusive, of insertion
        Returns:
        resulting sequence
      • toLowerCase

        @NotNull
        public final T toLowerCase()
        Description copied from interface: IRichSequence
        Map characters of this sequence to: Uppercase, Lowercase or use custom mapping
        Specified by:
        toLowerCase in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        lowercase version of sequence
      • toNbSp

        @NotNull
        public final T toNbSp()
        Description copied from interface: IRichSequence
        Map spaces to non break spaces
        Specified by:
        toNbSp in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        mapped sequence with spc changed to NbSp
      • toSpc

        @NotNull
        public final T toSpc()
        Description copied from interface: IRichSequence
        Map non break spaces to spaces
        Specified by:
        toSpc in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        mapped sequence with NbSp changed to spc
      • matches

        public final boolean matches​(@NotNull
                                     java.lang.CharSequence chars,
                                     boolean ignoreCase)
        Specified by:
        matches in interface IRichSequence<T extends IRichSequence<T>>
      • matches

        public final boolean matches​(@NotNull
                                     java.lang.CharSequence chars)
        Description copied from interface: IRichSequence
        Test the sequence for a match to another CharSequence
        Specified by:
        matches in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        chars - characters to match against
        Returns:
        true if match
      • matchChars

        public final boolean matchChars​(@NotNull
                                        java.lang.CharSequence chars,
                                        int startIndex,
                                        boolean ignoreCase)
        Description copied from interface: IRichSequence
        Test the sequence portion for a match to another CharSequence
        Specified by:
        matchChars in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        chars - characters to match against
        startIndex - index from which to start the match
        ignoreCase - if true match ignoring case differences
        Returns:
        true if characters at the start index of this sequence match
      • matchChars

        public final boolean matchChars​(@NotNull
                                        java.lang.CharSequence chars,
                                        boolean ignoreCase)
        Specified by:
        matchChars in interface IRichSequence<T extends IRichSequence<T>>
      • matchChars

        public final boolean matchChars​(@NotNull
                                        java.lang.CharSequence chars)
        Description copied from interface: IRichSequence
        Test the sequence portion for a match to another CharSequence
        Specified by:
        matchChars in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        chars - characters to match against
        Returns:
        true if characters at the start of this sequence match
      • matchCharsReversed

        public final boolean matchCharsReversed​(@NotNull
                                                java.lang.CharSequence chars,
                                                int endIndex,
                                                boolean ignoreCase)
        Description copied from interface: IRichSequence
        Test the sequence portion for a match to another CharSequence, reverse order
        Specified by:
        matchCharsReversed in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        chars - characters to match against
        endIndex - index from which to start the match and proceed to 0
        ignoreCase - if true match ignoring case differences
        Returns:
        true if characters at the start index of this sequence match
      • matchedCharCount

        public final int matchedCharCount​(@NotNull
                                          java.lang.CharSequence chars,
                                          int startIndex,
                                          int endIndex,
                                          boolean ignoreCase)
        Specified by:
        matchedCharCount in interface IRichSequence<T extends IRichSequence<T>>
      • matchedCharCount

        public final int matchedCharCount​(@NotNull
                                          java.lang.CharSequence chars,
                                          int startIndex,
                                          boolean ignoreCase)
        Specified by:
        matchedCharCount in interface IRichSequence<T extends IRichSequence<T>>
      • matchedCharCount

        public final int matchedCharCount​(@NotNull
                                          java.lang.CharSequence chars,
                                          int startIndex,
                                          int endIndex,
                                          boolean fullMatchOnly,
                                          boolean ignoreCase)
        Description copied from interface: IRichSequence
        Test the sequence portion for a match to another CharSequence
        Specified by:
        matchedCharCount in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        chars - characters to match against
        startIndex - index from which to start the match
        endIndex - index at which to end the matching
        fullMatchOnly - if true will do quick fail if length of chars is longer than characters after startIndex in this sequence
        ignoreCase - if true match ignoring case differences
        Returns:
        count of characters at the start index of this sequence matching corresponding characters in chars
      • matchedCharCountReversed

        public final int matchedCharCountReversed​(@NotNull
                                                  java.lang.CharSequence chars,
                                                  int startIndex,
                                                  int fromIndex,
                                                  boolean ignoreCase)
        Description copied from interface: IRichSequence
        Test the sequence portion for a match to another CharSequence, equivalent to taking this.subSequence(startIndex, fromIndex) and then count matching chars going from end of both sequences
        Specified by:
        matchedCharCountReversed in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        chars - characters to match against
        startIndex - index at which to stop the match
        fromIndex - index from which to start the match, not inclusive, matching starts at fromIndex-1 and proceeds towards 0
        ignoreCase - if true match ignoring case differences
        Returns:
        count of characters at the from index of this sequence matching corresponding characters in chars in reverse order
      • toString

        @NotNull
        public java.lang.String toString()
        Specified by:
        toString in interface java.lang.CharSequence
        Overrides:
        toString in class java.lang.Object
      • normalizeEOL

        @NotNull
        public final java.lang.String normalizeEOL()
        Description copied from interface: IRichSequence
        replace any \r\n and \r by \n
        Specified by:
        normalizeEOL in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        string with only \n for line separators
      • normalizeEndWithEOL

        @NotNull
        public final java.lang.String normalizeEndWithEOL()
        Description copied from interface: IRichSequence
        replace any \r\n and \r by \n, append terminating EOL if one is not present
        Specified by:
        normalizeEndWithEOL in interface IRichSequence<T extends IRichSequence<T>>
        Returns:
        string with only \n for line separators and terminated by \n
      • splitList

        @NotNull
        public final java.util.List<T> splitList​(@NotNull
                                                 java.lang.CharSequence delimiter)
        Specified by:
        splitList in interface IRichSequence<T extends IRichSequence<T>>
      • splitList

        @NotNull
        public final java.util.List<T> splitList​(@NotNull
                                                 java.lang.CharSequence delimiter,
                                                 int limit,
                                                 boolean includeDelims,
                                                 @Nullable
                                                 CharPredicate trimChars)
        Description copied from interface: IRichSequence
        Split helpers based on delimiter character sets contained in CharPredicate
        Specified by:
        splitList in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        delimiter - sequence of chars on which to split this sequence
        limit - max number of segments to split
        includeDelims - if true include delimiters as part of split item
        trimChars - set of characters that should be used for trimming individual split results
        Returns:
        List of split results
      • splitList

        @NotNull
        public final java.util.List<T> splitList​(@NotNull
                                                 java.lang.CharSequence delimiter,
                                                 int limit,
                                                 int flags)
        Specified by:
        splitList in interface IRichSequence<T extends IRichSequence<T>>
      • splitList

        @NotNull
        public final java.util.List<T> splitList​(@NotNull
                                                 java.lang.CharSequence delimiter,
                                                 int limit,
                                                 int flags,
                                                 @Nullable
                                                 CharPredicate trimChars)
        Description copied from interface: IRichSequence
        Split helpers based on delimiter character sets contained in CharSequence
        Specified by:
        splitList in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        delimiter - delimiter char sequence to use for splitting
        limit - max number of segments to split
        flags - flags for desired options: SPLIT_INCLUDE_DELIMS: include delimiters as part of split item SPLIT_TRIM_PARTS: trim the segments, if trimChars is not null or empty then this flag is turned on automatically SPLIT_SKIP_EMPTY: skip empty segments (or empty after trimming if enabled) SPLIT_INCLUDE_DELIM_PARTS: include delimiters as separate split item of its own SPLIT_TRIM_SKIP_EMPTY: same as SPLIT_TRIM_PARTS | SPLIT_SKIP_EMPTY
        trimChars - set of characters that should be used for trimming individual split results
        Returns:
        List of split results
      • split

        @NotNull
        public final T[] split​(@NotNull
                               java.lang.CharSequence delimiter,
                               int limit,
                               boolean includeDelims,
                               @Nullable
                               CharPredicate trimChars)
        Specified by:
        split in interface IRichSequence<T extends IRichSequence<T>>
      • split

        @NotNull
        public final T[] split​(@NotNull
                               java.lang.CharSequence delimiter,
                               int limit,
                               int flags)
        Specified by:
        split in interface IRichSequence<T extends IRichSequence<T>>
      • appendTo

        @NotNull
        public final T appendTo​(@NotNull
                                java.lang.StringBuilder out,
                                int startIndex,
                                int endIndex)
        Specified by:
        appendTo in interface IRichSequence<T extends IRichSequence<T>>
      • appendTo

        @NotNull
        public final T appendTo​(@NotNull
                                java.lang.StringBuilder out,
                                @Nullable
                                CharMapper charMapper,
                                int startIndex,
                                int endIndex)
        Description copied from interface: IRichSequence
        Append helpers
        Specified by:
        appendTo in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        out - string builder
        charMapper - mapping to use for output or null if none
        startIndex - start index
        endIndex - end index
        Returns:
        this
      • appendRangesTo

        @NotNull
        public final T appendRangesTo​(@NotNull
                                      java.lang.StringBuilder out,
                                      @Nullable
                                      CharMapper charMapper,
                                      Range... ranges)
        Description copied from interface: IRichSequence
        Append given ranges of this sequence to string builder
        Specified by:
        appendRangesTo in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        out - string builder to append to
        charMapper - mapping to use for output or null if none
        ranges - ranges to append, null range or one for which range.isNull() is true ranges are skipped
        Returns:
        this
      • indexOfAll

        @NotNull
        public final int[] indexOfAll​(@NotNull
                                      java.lang.CharSequence s)
        Description copied from interface: IRichSequence
        Get indices of all occurrences of a sequence
        Specified by:
        indexOfAll in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        s - sequence whose indices to find
        Returns:
        array of indices
      • prefixWith

        @NotNull
        public T prefixWith​(@Nullable
                            java.lang.CharSequence prefix)
        Description copied from interface: IRichSequence
        Prefix this sequence with a char sequence
        Specified by:
        prefixWith in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        prefix - char sequence
        Returns:
        resulting sequence
      • suffixWith

        @NotNull
        public T suffixWith​(@Nullable
                            java.lang.CharSequence suffix)
        Description copied from interface: IRichSequence
        Prefix this sequence with a char sequence
        Specified by:
        suffixWith in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        suffix - char sequence
        Returns:
        resulting sequence
      • prefixOnceWith

        @NotNull
        public final T prefixOnceWith​(@Nullable
                                      java.lang.CharSequence prefix)
        Description copied from interface: IRichSequence
        Prefix this sequence with a char sequence if not already starting with prefix
        Specified by:
        prefixOnceWith in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        prefix - char sequence
        Returns:
        resulting sequence
      • suffixOnceWith

        @NotNull
        public final T suffixOnceWith​(@Nullable
                                      java.lang.CharSequence suffix)
        Description copied from interface: IRichSequence
        Suffix this sequence with a char sequence if not already ending with suffix
        Specified by:
        suffixOnceWith in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        suffix - char sequence
        Returns:
        resulting sequence
      • replace

        @NotNull
        public final T replace​(int startIndex,
                               int endIndex,
                               @NotNull
                               java.lang.CharSequence replacement)
        Description copied from interface: IRichSequence
        Replace part of the sequence with a char sequence
        Specified by:
        replace in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        startIndex - start index of replaced part
        endIndex - end index of replaced part
        replacement - char sequence
        Returns:
        resulting sequence
      • replace

        @NotNull
        public final T replace​(@NotNull
                               java.lang.CharSequence find,
                               @NotNull
                               java.lang.CharSequence replace)
        Description copied from interface: IRichSequence
        Replace all occurrences of one sequence with another
        Specified by:
        replace in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        find - sequence to find
        replace - replacement sequence
        Returns:
        array of indices
      • append

        @NotNull
        public final T append​(java.lang.CharSequence... sequences)
        Description copied from interface: IRichSequence
        Concatenate this sequence and list of others, returning sequence of result
        Specified by:
        append in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        sequences - list of char sequences to append to this sequence, null sequences are skipped
        Returns:
        appended sequence
      • append

        @NotNull
        public final T append​(java.lang.Iterable<? extends java.lang.CharSequence> sequences)
        Specified by:
        append in interface IRichSequence<T extends IRichSequence<T>>
      • extractRanges

        @NotNull
        public final T extractRanges​(Range... ranges)
        Description copied from interface: IRichSequence
        Build a sequence of ranges in this sequence

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

        Specified by:
        extractRanges in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        ranges - ranges to extract
        Returns:
        resulting sequence
      • lineColumnAtIndex

        @NotNull
        public final Pair<java.lang.Integer,​java.lang.Integer> lineColumnAtIndex​(int index)
        Description copied from interface: IRichSequence
        Get the line and column information from index into sequence
        Specified by:
        lineColumnAtIndex in interface IRichSequence<T extends IRichSequence<T>>
        Parameters:
        index - index for which to get line information
        Returns:
        Pair(line, column) where line and column are 0 based, throws IllegalArgumentException if index < 0 or > length.
      • isIn

        public boolean isIn​(@NotNull
                            java.util.Collection<? extends java.lang.CharSequence> texts)
        Specified by:
        isIn in interface IRichSequence<T extends IRichSequence<T>>