protected void adaptToRemove(){
  int myStart=fPosition.offset;
  int myEnd=fPosition.offset + fPosition.length - 1;
  myEnd=Math.max(myStart,myEnd);
  int yoursStart=fOffset;
  int yoursEnd=fOffset + fLength - 1;
  yoursEnd=Math.max(yoursStart,yoursEnd);
  if (myEnd < yoursStart)   return;
  if (myStart <= yoursStart) {
    if (yoursEnd <= myEnd)     fPosition.length-=fLength;
 else     fPosition.length-=(myEnd - yoursStart + 1);
  }
 else   if (yoursStart < myStart) {
    if (yoursEnd < myStart)     fPosition.offset-=fLength;
 else {
      fPosition.offset-=(myStart - yoursStart);
      fPosition.length-=(yoursEnd - myStart + 1);
    }
  }
  if (fPosition.offset < 0)   fPosition.offset=0;
  if (fPosition.length < 0)   fPosition.length=0;
}

protected void adaptToRemove ( ) { int myStart = fPosition . offset ; int myEnd = fPosition . offset + fPosition . length - 1 ; myEnd = Math . max ( myStart , myEnd ) ; int yoursStart = fOffset ; int yoursEnd = fOffset + fLength - 1 ; yoursEnd = Math . max ( yoursStart , yoursEnd ) ; if ( myEnd < yoursStart ) return ; if ( myStart <= yoursStart ) { if ( yoursEnd <= myEnd ) fPosition . length -= fLength ; else fPosition . length -= ( myEnd - yoursStart + 1 ) ; } else if ( yoursStart < myStart ) { if ( yoursEnd < myStart ) fPosition . offset -= fLength ; else { fPosition . offset -= ( myStart - yoursStart ) ; fPosition . length -= ( yoursEnd - myStart + 1 ) ; } } if ( fPosition . offset < 0 ) fPosition . offset = 0 ; if ( fPosition . length < 0 ) fPosition . length = 0 ; }
adapts the currently investigated position to a deletion .
