@Test public void testMultiReplace() throws InvalidMarkupException, IOException { testMultiReplaceCore(26); testMultiReplaceCore(5); testMultiReplaceCore(1); testMultiReplaceCore(2); }
protected int multiReplace(int start, int length, String newText, int startSearchAt, boolean snapNext) { assert (length + newText.length() > 0); if (start == 0) snapNext = true; int firstTokenIndex = -1; if (this._firstDeletedTokenIndex > -1) { firstTokenIndex = lastItemSmallerLinear(indexes, start, startSearchAt >= 0 ? startSearchAt : 0, count, snapNext); } else { firstTokenIndex = lastItemSmaller(indexes, start, 0, count, snapNext); } if (firstTokenIndex < 0) { assert (firstTokenIndex >= 0); } return replaceCore(start, length, newText, firstTokenIndex); }
VirtualCharSequence implements CharSequence { protected int multiReplace(int start, int length, String newText, int startSearchAt, boolean snapNext) { assert (length + newText.length() > 0); if (start == 0) snapNext = true; int firstTokenIndex = -1; if (this._firstDeletedTokenIndex > -1) { firstTokenIndex = lastItemSmallerLinear(indexes, start, startSearchAt >= 0 ? startSearchAt : 0, count, snapNext); } else { firstTokenIndex = lastItemSmaller(indexes, start, 0, count, snapNext); } if (firstTokenIndex < 0) { assert (firstTokenIndex >= 0); } return replaceCore(start, length, newText, firstTokenIndex); } }
VirtualCharSequence implements CharSequence { protected int multiReplace(int start, int length, String newText, int startSearchAt, boolean snapNext) { assert (length + newText.length() > 0); if (start == 0) snapNext = true; int firstTokenIndex = -1; if (this._firstDeletedTokenIndex > -1) { firstTokenIndex = lastItemSmallerLinear(indexes, start, startSearchAt >= 0 ? startSearchAt : 0, count, snapNext); } else { firstTokenIndex = lastItemSmaller(indexes, start, 0, count, snapNext); } if (firstTokenIndex < 0) { assert (firstTokenIndex >= 0); } return replaceCore(start, length, newText, firstTokenIndex); } VirtualCharSequence(List<ITextToken> textTokens);  VirtualCharSequence(List<ITextToken> textTokens, boolean decodeEntities); }
VirtualCharSequence implements CharSequence { protected int multiReplace(int start, int length, String newText, int startSearchAt, boolean snapNext) { assert (length + newText.length() > 0); if (start == 0) snapNext = true; int firstTokenIndex = -1; if (this._firstDeletedTokenIndex > -1) { firstTokenIndex = lastItemSmallerLinear(indexes, start, startSearchAt >= 0 ? startSearchAt : 0, count, snapNext); } else { firstTokenIndex = lastItemSmaller(indexes, start, 0, count, snapNext); } if (firstTokenIndex < 0) { assert (firstTokenIndex >= 0); } return replaceCore(start, length, newText, firstTokenIndex); } VirtualCharSequence(List<ITextToken> textTokens);  VirtualCharSequence(List<ITextToken> textTokens, boolean decodeEntities); List<String> getComponentStrings(); ITextToken getTokenAt(int index); char charAt(int index); VirtualCharSequence setCharAt(int index, char c); int length(); CharSequence subSequence(int start, int end); int indexOf(String s, int fromIndex); String toString(); void insert(int start, String newText); void delete(int start, int length); VirtualCharSequence replace(int start, int length, String newText); VirtualCharSequence replace(int start, int length, String newText, boolean snapNext); void replaceSmart(int start, int length, String newText); void replaceSmart(int start, int length, String newText, int secondsTimeout, boolean enableLineOptimization); void flattenArea(int start, int length); static String quoteReplacement(String s); VirtualCharSequence replaceAll(Pattern p, String replacement, boolean smartMerging); VirtualCharSequence replaceAll(String regex, String replacement, boolean smartMerging); int replaceMatch(Matcher m, String replacement, boolean smartMerging); VirtualCharSequence trimStart(); VirtualCharSequence trimEnd(); VirtualCharSequence trim(); VirtualCharSequence append(String newText); }
VirtualCharSequence implements CharSequence { protected int multiReplace(int start, int length, String newText, int startSearchAt, boolean snapNext) { assert (length + newText.length() > 0); if (start == 0) snapNext = true; int firstTokenIndex = -1; if (this._firstDeletedTokenIndex > -1) { firstTokenIndex = lastItemSmallerLinear(indexes, start, startSearchAt >= 0 ? startSearchAt : 0, count, snapNext); } else { firstTokenIndex = lastItemSmaller(indexes, start, 0, count, snapNext); } if (firstTokenIndex < 0) { assert (firstTokenIndex >= 0); } return replaceCore(start, length, newText, firstTokenIndex); } VirtualCharSequence(List<ITextToken> textTokens);  VirtualCharSequence(List<ITextToken> textTokens, boolean decodeEntities); List<String> getComponentStrings(); ITextToken getTokenAt(int index); char charAt(int index); VirtualCharSequence setCharAt(int index, char c); int length(); CharSequence subSequence(int start, int end); int indexOf(String s, int fromIndex); String toString(); void insert(int start, String newText); void delete(int start, int length); VirtualCharSequence replace(int start, int length, String newText); VirtualCharSequence replace(int start, int length, String newText, boolean snapNext); void replaceSmart(int start, int length, String newText); void replaceSmart(int start, int length, String newText, int secondsTimeout, boolean enableLineOptimization); void flattenArea(int start, int length); static String quoteReplacement(String s); VirtualCharSequence replaceAll(Pattern p, String replacement, boolean smartMerging); VirtualCharSequence replaceAll(String regex, String replacement, boolean smartMerging); int replaceMatch(Matcher m, String replacement, boolean smartMerging); VirtualCharSequence trimStart(); VirtualCharSequence trimEnd(); VirtualCharSequence trim(); VirtualCharSequence append(String newText); public HashSet<String> deletedText; }