Class ReplacedTextMapper
- java.lang.Object
-
- com.vladsch.flexmark.util.sequence.ReplacedTextMapper
-
public class ReplacedTextMapper extends Object
Class which tracks text replacements to provide original offset from modified offset.This is needed when the original based sequence needs to be un-escaped but offsets to original escaped text are needed.
These replacements can be nested so that you can track replacements of replaced text. To add nested replacements use startNestedReplacement()
when isModified() returns true then the text mapper is already used and nested replacements need to be applied
-
-
Constructor Summary
Constructors Constructor Description ReplacedTextMapper(BasedSequence original)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddOriginalText(int startIndex, int endIndex)voidaddReplacedText(int startIndex, int endIndex, BasedSequence replacedSequence)ReplacedTextMappergetParent()ArrayList<ReplacedTextRegion>getRegions()intgetReplacedLength()ArrayList<BasedSequence>getReplacedSegments()BasedSequencegetReplacedSequence()booleanisFinalized()booleanisModified()intoriginalOffset(int replacedIndex)voidstartNestedReplacement(BasedSequence sequence)
-
-
-
Constructor Detail
-
ReplacedTextMapper
public ReplacedTextMapper(BasedSequence original)
-
-
Method Detail
-
startNestedReplacement
public void startNestedReplacement(BasedSequence sequence)
-
isModified
public boolean isModified()
-
isFinalized
public boolean isFinalized()
-
getParent
public ReplacedTextMapper getParent()
-
addReplacedText
public void addReplacedText(int startIndex, int endIndex, BasedSequence replacedSequence)
-
addOriginalText
public void addOriginalText(int startIndex, int endIndex)
-
getRegions
public ArrayList<ReplacedTextRegion> getRegions()
-
getReplacedSegments
public ArrayList<BasedSequence> getReplacedSegments()
-
getReplacedSequence
public BasedSequence getReplacedSequence()
-
getReplacedLength
public int getReplacedLength()
-
originalOffset
public int originalOffset(int replacedIndex)
-
-