class ReversedCharSequence extends ReverseIndexMapperBase implements ReverseCharSequence {

    @Override
    public ReversedCharSequence subSequence(int start, int end) {
        if (start < 0 || end > length())
            throw new IndexOutOfBoundsException("[" + start + ", " + end + ") not in [0," + length() + "]");
        final int startIndex = mapBoundary(end);
        final int endIndex = startIndex + end - start;
        return startIndex == myStartIndex && endIndex == myEndIndex ? this : new ReversedCharSequence(myChars, startIndex, endIndex);
    }

    @SuppressWarnings("WeakerAccess") private  ReversedCharSequence(CharSequence chars, int start, int end);

}