public void addReplacedText(int startIndex, int endIndex, BasedSequence replacedSequence) { if (isFinalized()) throw new IllegalStateException("Cannot modify finalized ReplacedTextMapper"); regions.add(new ReplacedTextRegion(original.subSequence(startIndex, endIndex).getSourceRange(), new Range(startIndex, endIndex), new Range(replacedLength, replacedLength + replacedSequence.length()))); replacedLength += replacedSequence.length(); replacedSegments.add(replacedSequence); }
public void addOriginalText(int startIndex, int endIndex) { if (isFinalized()) throw new IllegalStateException("Cannot modify finalized ReplacedTextMapper"); if (startIndex < endIndex) { BasedSequence originalSegment = original.subSequence(startIndex, endIndex); regions.add(new ReplacedTextRegion(originalSegment.getSourceRange(), new Range(startIndex, endIndex), new Range(replacedLength, replacedLength + originalSegment.length()))); replacedLength += originalSegment.length(); replacedSegments.add(originalSegment); } }
public void addOriginalText(int startIndex, int endIndex) { if (isFinalized()) throw new IllegalStateException("Cannot modify finalized ReplacedTextMapper"); if (startIndex < endIndex) { BasedSequence originalSegment = original.subSequence(startIndex, endIndex); regions.add(new ReplacedTextRegion(originalSegment.getSourceRange(), new Range(startIndex, endIndex), new Range(replacedLength, replacedLength + originalSegment.length()))); replacedLength += originalSegment.length(); replacedSegments.add(originalSegment); } }
public void addReplacedText(int startIndex, int endIndex, BasedSequence replacedSequence) { if (isFinalized()) throw new IllegalStateException("Cannot modify finalized ReplacedTextMapper"); regions.add(new ReplacedTextRegion(original.subSequence(startIndex, endIndex).getSourceRange(), new Range(startIndex, endIndex), new Range(replacedLength, replacedLength + replacedSequence.length()))); replacedLength += replacedSequence.length(); replacedSegments.add(replacedSequence); }