while ((e = scenarioQueue.peek()) != null && e.time <= timeLapse.getTime()) {
scenarioQueue.poll();
if (status == null) {
LOGGER.info("scenario started at virtual time:" + timeLapse.getTime());
status = EventType.SCENARIO_STARTED;
disp.dispatchEvent(new Event(status, this));
}
disp.dispatchEvent(e);
}
if (e == null && status != EventType.SCENARIO_FINISHED) {
status = EventType.SCENARIO_FINISHED;
disp.dispatchEvent(new Event(status, this));
}
if (ticks == 0 && status == EventType.SCENARIO_FINISHED) {
LOGGER.info("scenario finished at virtual time:" + timeLapse.getTime()
+ "[stopping simulation]");
simulator.stop();