/**
  * The heart of the event processing loop. This is where the events are actually evaluated.
  *
  * @param next - the event to evaluate.
  * @throws SimulationException - if an exception occurs during the evaluation of the event.
  */
 protected void evaluate(EventImpl next) throws SimulationException {
   currentEvent = next;
   currentTime = currentEvent.getTime();
   Continuation continuation = currentEvent.getContinuation();
   if (continuation != null) {
     returnFrame = continuation.getFrame();
     caller = continuation.getCaller();
   }
   Throwable exception = null;
   Object result = null;
   try {
     if (eventLog != null) {
       eventLog.info(currentEvent.toString());
     }
     result = currentEvent.invoke();
   } catch (SimulationEnd e) {
     throw e;
   } catch (Throwable e) {
     if (caller == null || blockingEvent != null) {
       throw new SimulationException(e);
     }
     exception = e;
   } finally {
     currentEvent = null;
   }
   if (blockingEvent != null) {
     continuingEvent.setContinuation(new Continuation(caller, currentFrame));
     blockingEvent.setContinuation(new Continuation(continuingEvent));
     post(blockingEvent);
     blockingEvent = null;
     continuingEvent = null;
     currentFrame = null;
   } else if (caller != null) {
     post(caller.resume(currentTime, result, exception));
   }
   caller = null;
   returnFrame = null;
 }