void calculateUpdateIndexes(DocumentEvent e){
  int pos=e.getOffset();
  firstUpdateIndex=getViewIndex(pos,Position.Bias.Forward);
  if (firstUpdateIndex == -1 && e.getType() == DocumentEvent.EventType.REMOVE && pos >= getEndOffset()) {
    firstUpdateIndex=getViewCount() - 1;
  }
  lastUpdateIndex=firstUpdateIndex;
  View v=(firstUpdateIndex >= 0) ? getView(firstUpdateIndex) : null;
  if (v != null) {
    if ((v.getStartOffset() == pos) && (pos > 0)) {
      firstUpdateIndex=Math.max(firstUpdateIndex - 1,0);
    }
  }
  if (e.getType() != DocumentEvent.EventType.REMOVE) {
    lastUpdateIndex=getViewIndex(pos + e.getLength(),Position.Bias.Forward);
    if (lastUpdateIndex < 0) {
      lastUpdateIndex=getViewCount() - 1;
    }
  }
  firstUpdateIndex=Math.max(firstUpdateIndex,0);
}

void calculateUpdateIndexes ( DocumentEvent e ) { int pos = e . getOffset ( ) ; firstUpdateIndex = getViewIndex ( pos , Position . Bias . Forward ) ; if ( firstUpdateIndex == - 1 && e . getType ( ) == DocumentEvent . EventType . REMOVE && pos >= getEndOffset ( ) ) { firstUpdateIndex = getViewCount ( ) - 1 ; } lastUpdateIndex = firstUpdateIndex ; View v = ( firstUpdateIndex >= 0 ) ? getView ( firstUpdateIndex ) : null ; if ( v != null ) { if ( ( v . getStartOffset ( ) == pos ) && ( pos > 0 ) ) { firstUpdateIndex = Math . max ( firstUpdateIndex - 1 , 0 ) ; } } if ( e . getType ( ) != DocumentEvent . EventType . REMOVE ) { lastUpdateIndex = getViewIndex ( pos + e . getLength ( ) , Position . Bias . Forward ) ; if ( lastUpdateIndex < 0 ) { lastUpdateIndex = getViewCount ( ) - 1 ; } } firstUpdateIndex = Math . max ( firstUpdateIndex , 0 ) ; }
calculates the first and the last indexes of the child views that need to be notified of the change to the model .
