public void addPosition(int offset,int length,String... ids){
  TextAttribute highlighting=ids.length == 1 ? attributeProvider.getAttribute(ids[0]) : attributeProvider.getMergedAttributes(ids);
  boolean isExisting=false;
  for (int i=0, n=removedPositions.size(); i < n; i++) {
    AttributedPosition position=removedPositions.get(i);
    if (position == null)     continue;
    if (position.isEqual(offset,length,highlighting)) {
      isExisting=true;
      removedPositions.set(i,null);
      removedPositionCount--;
      break;
    }
  }
  if (!isExisting) {
    AttributedPosition position=presenter.createHighlightedPosition(offset,length,highlighting);
    addedPositions.add(position);
  }
}

public void addPosition ( int offset , int length , String ... ids ) { TextAttribute highlighting = ids . length == 1 ? attributeProvider . getAttribute ( ids [ 0 ] ) : attributeProvider . getMergedAttributes ( ids ) ; boolean isExisting = false ; for ( int i = 0 , n = removedPositions . size ( ) ; i < n ; i ++ ) { AttributedPosition position = removedPositions . get ( i ) ; if ( position == null ) continue ; if ( position . isEqual ( offset , length , highlighting ) ) { isExisting = true ; removedPositions . set ( i , null ) ; removedPositionCount -- ; break ; } } if ( ! isExisting ) { AttributedPosition position = presenter . createHighlightedPosition ( offset , length , highlighting ) ; addedPositions . add ( position ) ; } }
add a position with the given range and highlighting if it does not exist already .
