private void insertNewPosition(float position,long time){
  mPositionHistory.add(new TimeBasedPosition(position,time));
  long timeCutoff=time - (mTotalModes - 1) * DELAY_MS;
  while (mPositionHistory.size() > 0) {
    TimeBasedPosition historyPosition=mPositionHistory.getFirst();
    if (historyPosition.getTimeStamp() < timeCutoff) {
      mPositionHistory.removeFirst();
    }
 else {
      break;
    }
  }
}

private void insertNewPosition ( float position , long time ) { mPositionHistory . add ( new TimeBasedPosition ( position , time ) ) ; long timeCutoff = time - ( mTotalModes - 1 ) * DELAY_MS ; while ( mPositionHistory . size ( ) > 0 ) { TimeBasedPosition historyPosition = mPositionHistory . getFirst ( ) ; if ( historyPosition . getTimeStamp ( ) < timeCutoff ) { mPositionHistory . removeFirst ( ) ; } else { break ; } } }
insert new position and time stamp into the history position list , and remove stale position items .
