Example Discrete Event Simulation
A traffic light cycles through green, yellow, and red; this can easily be simulated:
public static void
red (PriorityQueue pq, int time) {
turnOff("green");
turnOff("yellow");
turnOn("red");
pq.add(new Event("green", time + 60));
}
This program is typical of Discrete Event Simulation: