public Timeline(int initCapacity)
{
events = new PriorityQueue<InnerEvent>(initCapacity, (a, b) -> {
- //Is this really necessary? If only ints are allowed as relative timing, the difference should always be an int
long difference = a.getTiming() - b.getTiming();
if(difference == 0)
return 0;
currentTime = first.getTiming();
first.run();
}
+
+ public void executeAll()
+ {
+ while (hasNext())
+ executeNext();
+ }
public long getSimulationTime()
{
function.handle(event);
}
+ @Override
+ public String toString()
+ {
+ return event.toString();
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return "simulation time: " + currentTime + ", " + events.toString();
}
}
\ No newline at end of file