/** Simulates a single step in the simulation. */ private static void simulateOneStep() { // prevent rendering while AI processes synchronized (Simulation.class) { // core simulation step progress. IJunction junc = (IJunction) getOption(Simulation.JUNCTION_TYPE); // FIXME: fix this when junctions are migrated completely to IJunction int carsRatio = (Integer) getOption(Simulation.CAR_RATIO); int trucksRatio = (Integer) getOption(Simulation.TRUCK_RATIO); junc.distributeNewCars(carsRatio, trucksRatio); junc .manageJunction(); // goes through all lanes contained in the junction, and tells each car // within each lane to "act" junc.updateDeletions(); // when cars go outof the end of the junction, they get "deleted" and statistics are // incremented. setOption(TIME_STEP, ((int) getOption(TIME_STEP) + 1)); } }