javatools.parsers
Class PositionTracker

java.lang.Object
  extended by javatools.parsers.PositionTracker

public class PositionTracker
extends java.lang.Object

This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga). This class implements position change trackers that keep track of position changes within a String, e.g. caused through normalization etc. This allows for instance, given a position int the normalized string to get the corresponding position in the original non-normalized string backward position tracker - tracking several replacement/text changes allowing to trace a position in the modified text back to the corresp. position in the original text for the other direction see ForwardPositionTracker

Author:
smetzger

Nested Class Summary
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.
 
Constructor Summary
PositionTracker()
           
 
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 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.
 java.lang.Integer translatePosition(java.lang.Integer pos)
          Merges new position changes (given with the inversed old2new mapping) into the existing position change map
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PositionTracker

public PositionTracker()
Method Detail

addPositionChange

public void addPositionChange(int pos,
                              int modifier)

closeRun

public void closeRun()
Closes the current changing run by Merging new position changes into the existing position change map 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 Do this every time you ran once over the text making changes to be tracked


translatePosition

public java.lang.Integer translatePosition(java.lang.Integer pos)
Merges new position changes (given with the inversed old2new mapping) into the existing position change map