Class ReplacedTextMapper
- java.lang.Object
-
- com.vladsch.flexmark.util.sequence.ReplacedTextMapper
-
public class ReplacedTextMapper extends java.lang.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 void
addOriginalText(int startIndex, int endIndex)
void
addReplacedText(int startIndex, int endIndex, BasedSequence replacedSequence)
ReplacedTextMapper
getParent()
java.util.ArrayList<ReplacedTextRegion>
getRegions()
int
getReplacedLength()
java.util.ArrayList<BasedSequence>
getReplacedSegments()
BasedSequence
getReplacedSequence()
boolean
isFinalized()
boolean
isModified()
int
originalOffset(int replacedIndex)
void
startNestedReplacement(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 java.util.ArrayList<ReplacedTextRegion> getRegions()
-
getReplacedSegments
public java.util.ArrayList<BasedSequence> getReplacedSegments()
-
getReplacedSequence
public BasedSequence getReplacedSequence()
-
getReplacedLength
public int getReplacedLength()
-
originalOffset
public int originalOffset(int replacedIndex)
-
-