|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javatools.parsers.PositionTracker.ForwardPositionTracker
public static class PositionTracker.ForwardPositionTracker
forward position change tracking - keeping track of several rounds of text modifications allowing to trace a position in the original text along the modifications to the corresp. position in the modified text after each round (one round=consecutive changes along the text) you need to call closeRun() before submitting more position changes from a new round, i.e. whenever you passed the string to be modified once call closeRun() before starting to run over the string again with more replacements REMARK: NOT TESTED WITH MORE THAN ONE ROUND! may be ERRORNOUS with multiple rounds -> use with care (works with a single round though)
Constructor Summary | |
---|---|
PositionTracker.ForwardPositionTracker()
|
Method Summary | |
---|---|
void |
addPositionChange(int pos,
int modifier)
|
void |
closeRun()
Closes the current changing run by Merging new position changes into the existing position change map Do this every time you ran once over the text making changes to be tracked |
boolean |
hasBeenCutAway(java.lang.Integer pos)
tells whether a position in the original stream has been cut away by some change operation, such that translating it usually would make not to much sense |
java.lang.Integer |
translatePosition(java.lang.Integer pos)
|
java.lang.Integer |
translatePositionExactly(java.lang.Integer pos)
also handles positions inside text parts that have been cut out properly TODO: current version ONLY WORKS SECURELY WHEN THERE IS ONLY ONE POSITION CHANGE RUN WITHOUT OVERLAPPING CHANGES! as soon as there are more than one change runs, or changes that overlap, we would need to check all following changes instead of only the next one |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PositionTracker.ForwardPositionTracker()
Method Detail |
---|
public void addPositionChange(int pos, int modifier)
public void closeRun()
public boolean hasBeenCutAway(java.lang.Integer pos)
public java.lang.Integer translatePosition(java.lang.Integer pos)
public java.lang.Integer translatePositionExactly(java.lang.Integer pos)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |