public void addEvent(SimEvent newEvent){
  double eventTime=newEvent.eventTime();
  if (eventTime >= maxTime) {
    list.add(newEvent);
    maxTime=eventTime;
    return;
  }
  ListIterator<SimEvent> iterator=list.listIterator();
  SimEvent event;
  while (iterator.hasNext()) {
    event=iterator.next();
    if (event.eventTime() > eventTime) {
      iterator.previous();
      iterator.add(newEvent);
      return;
    }
  }
  list.add(newEvent);
}

public void addEvent ( SimEvent newEvent ) { double eventTime = newEvent . eventTime ( ) ; if ( eventTime >= maxTime ) { list . add ( newEvent ) ; maxTime = eventTime ; return ; } ListIterator < SimEvent > iterator = list . listIterator ( ) ; SimEvent event ; while ( iterator . hasNext ( ) ) { event = iterator . next ( ) ; if ( event . eventTime ( ) > eventTime ) { iterator . previous ( ) ; iterator . add ( newEvent ) ; return ; } } list . add ( newEvent ) ; }
adds a new event to the queue . adding a new event to the queue preserves the temporal order of the events .
