public class StringTransformation extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
StringTransformation.EditType |
Constructor and Description |
---|
StringTransformation(String origText)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
applyPendingEdits()
apply any pending edits, update the modified string
|
int |
computeModifiedOffsetFromOriginal(int origOffset)
given a character offset in the original string, find the corresponding offset in the
modified string.
|
IntPair |
getOriginalOffsets(int transformStart,
int transformEnd)
given a pair of offsets into the transformed text, retrieve the corresponding offsets in the original text.
|
String |
getOrigText()
get the original text, before all edits were applied.
|
String |
getTransformedText()
get the updated text, after edits are applied.
|
IntPair |
transformString(int textStart,
int textEnd,
String newStr)
Modify the current version of the transformed text (as returned by getTransformedText()) by replacing the
string between character offsets textStart and textEnd with newStr.
|
public StringTransformation(String origText)
origText
- the original form of the string whose modifications you want to track.public String getOrigText()
public String getTransformedText()
public IntPair transformString(int textStart, int textEnd, String newStr)
textStart
- character offset start of edit in transformed texttextEnd
- character offset end of edit in transformed textnewStr
- string to replace specified character spanpublic void applyPendingEdits()
public int computeModifiedOffsetFromOriginal(int origOffset)
origOffset
- offset in original stringpublic IntPair getOriginalOffsets(int transformStart, int transformEnd)
transformStart
- start of transformed text substringtransformEnd
- end of transformed text substringCopyright © 2017. All rights reserved.