public abstract class EventScheduler extends SimulationEntity
Modifier and Type | Field and Description |
---|---|
protected java.util.LinkedList<Event> |
scheduledEvents |
associatedSimulationContainer
Constructor and Description |
---|
EventScheduler(SimulationContainer associatedSimulationContainer)
Initiates the list of scheduled events and adds the scripted events to this list.
|
Modifier and Type | Method and Description |
---|---|
boolean |
everScheduledEvent(Event eventToCheck)
Method to check if an event was ever an event scheduled by the EventScheduler.
|
boolean |
existsNextEvent()
Method to check whether a next event is present (whether the list is not empty).
|
Event |
popNextEvent()
pops (removes and returns) the event scheduled next.
|
void |
pushEvent(Event eventToSchedule)
Schedules a new event.
|
void |
scheduleEvent(Event eventToSchedule)
Schedules a new event.
|
protected abstract void |
scheduleValidEvent(Event evenToSchedule)
Pushes a (valid) event (i.e.
|
Event |
topNextEvent()
Method to retrieve the next event is scheduled.
|
getAssociatedSimulationContainer
protected java.util.LinkedList<Event> scheduledEvents
public EventScheduler(SimulationContainer associatedSimulationContainer)
associatedSimulationContainer
- The simulation container in which the simulation takes placepublic void scheduleEvent(Event eventToSchedule) throws java.lang.IllegalArgumentException
eventToSchedule
- The event that is to be scheduledjava.lang.IllegalArgumentException
- Will be thrown when event has been scheduled before or is scheduled for the pastpublic void pushEvent(Event eventToSchedule) throws java.lang.IllegalArgumentException
eventToSchedule
- The event that is to be scheduledjava.lang.IllegalArgumentException
- Will be thrown when event has been scheduled before or is scheduled for the pastprotected abstract void scheduleValidEvent(Event evenToSchedule)
evenToSchedule
- The event that is to be scheduledpublic Event popNextEvent() throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
- Will be thrown when the list of scheduled events is emptypublic Event topNextEvent()
java.lang.IndexOutOfBoundsException
- Will be thrown when the list of scheduled events is emptypublic boolean existsNextEvent()
public boolean everScheduledEvent(Event eventToCheck)
eventToCheck
- Event to check whether it ever existed (within this EventScheduler in this simulation)