code: public Integer translatePosition(Integer pos) {
  		SortedMap<Integer,Integer> headMap=positionMap.headMap(pos+1);
  		  Integer modifier=0;    	
  		  for(Iterator<Integer> it=headMap.values().iterator(); it.hasNext(); modifier+=it.next()){}
  /*		  if(headMap.size()>1){      TODO: Possible Optimization if we assume positions are asked in ascending order
  			  headMap.clear();
  			  posMap.put(pos, modifier);
  		  }*/ 
  		  return pos+modifier;		  
  	}
docs: /*	private void addPositionMappings(SortedMap<Integer,Integer> newPosChanges,
  SortedMap<Integer,Integer> old2NewMap) {
  
  
  TreeMap<Integer,Integer> newMap=new TreeMap<Integer,Integer>();
  
  adapt old positions to new mapping
  while(!positionMap.isEmpty()){
  Integer key=positionMap.firstKey();
  Collection<Integer> modifiers=old2NewMap.headMap(key+1).values();
  Integer newposition=key;
  for(Iterator<Integer> it=modifiers.iterator(); it.hasNext(); newposition+=it.next()){}
  Integer value=positionMap.get(key);
  if(newMap.containsKey(newposition))
  value+=newMap.get(newposition);
  newMap.put(newposition, value);
  positionMap.remove(key);
  }
  while(!newPosChanges.isEmpty()){
  Integer key=newPosChanges.firstKey();
  Integer value=newPosChanges.get(key);
  if(newMap.containsKey(key))
  value+=newMap.get(key);
  newMap.put(key, value);
  newPosChanges.remove(key);
  }
  positionMap=newMap;
  old2NewMap.clear();
  return;
  }