public boolean run() { try { preSimulationLoop(); while (true) { Event e = scheduler.dequeue(); if (e != null && scheduler.now < Conf.MAX_SIMULATION_TIME) { preEventExecution(); e.handle(); if (postEventExecution()) { break; } } else { break; // simulationEnded } } postSimulationLoop(); return true; } catch (Throwable t) { prematureTermination(t); return false; } }