public class UnitTestEventList extends EventList
This EventList implementation is for Unit Testing purposes only. Specifically, it only stores scheduled events and returns a copy of them, the first scheduled SimEvent of a given name, or an array of SimEvents of a given name. Since no SimEvents are passed to the superclass scheduleEvent() method, nothing will ever be run.
Instantiation should be left to Schedule, and all SimEntities to be tested should have their simEventListID set to the id that is given it by Schedule.
Usage:
int id = Schedule.addNewEventList(UnitTestEventList.class); ... SimEntity aSimEntity = new ASimEntity(...); aSimEntity.setEventListID(id);
After each test, a call to coldReset() on the UnitTestEventList instance should be made. Note that Schedule.coldReset() only resets its default EventList instance.
DEFAULT_FAST_INTERRUPTS, entityEventMap, entryCounter, entryCounterMutex, eventList, hashEventMap, LOGGER, simTime, stoppingSimulation
Constructor and Description |
---|
UnitTestEventList(int id)
Instantiate a UnitTestEventList with the given id number.
|
Modifier and Type | Method and Description |
---|---|
SimEvent |
getScheduledEvent(java.lang.String eventName)
Gets the SimEvent of the given name that would occur first in the
current event list's state.
|
SimEvent |
getScheduledEvent(java.lang.String eventName,
java.lang.Object[] params)
Gets the SimEvent of the given name and parameter list that would occur
first in the current event list's state.
|
java.util.SortedSet<SimEvent> |
getScheduledEvents() |
java.util.SortedSet<SimEvent> |
getScheduledEvents(java.lang.String eventName)
Returns all scheduled events of the given name in increasing scheduled
order.
|
java.util.SortedSet |
getScheduledEvents(java.lang.String eventName,
java.lang.Object[] params)
Returns all scheduled events of the given name and parameter list in
increasing scheduled order.
|
void |
setSimTime(double simTime) |
addIgnoreOnDump, addRerun, addToEntityEventMap, addToHashEventMap, checkStopEvent, cleanUpHashEventMap, clearDeadEvents, clearEventList, clearRerun, coldReset, dump, dump, getCurrentSimEvent, getEventList, getEventListAsString, getID, getIgnoredEvents, getNumberStopEvents, getOutputStream, getPendingEventCount, getRerun, getSimTime, getStopEventName, getStopTime, interrupt, interrupt, interruptAll, interruptAll, interruptAll, interruptAllWithArg, interruptAllWithArg, interruptAllWithArg, interruptAllWithArg, isDumpEventSources, isFastInterrupts, isFinished, isPauseAfterEachEvent, isPrintEventSources, isReallyVerbose, isRunning, isSingleStep, isStopAtTime, isStopOnEvent, isVerbose, pause, removeFromEntityEventMap, removeFromHashEventMap, removeIgnoreOnDump, removeListeners, removeRerun, reset, scheduleEvent, setDumpEventSources, setFastInterrupts, setFormat, setOutputStream, setPauseAfterEachEvent, setPrintEventSources, setReallyVerbose, setSingleStep, setUserDefinedStop, setVerbose, startSimulation, step, stopAtTime, stopOnEvent, stopSimulation, updateEventCounts
public UnitTestEventList(int id)
id
- the id of this UnitTestEventList instancepublic SimEvent getScheduledEvent(java.lang.String eventName)
eventName
- Name of desired SimEventpublic SimEvent getScheduledEvent(java.lang.String eventName, java.lang.Object[] params)
eventName
- Name of desired SimEventparams
- parameters passed to event when scheduledpublic java.util.SortedSet<SimEvent> getScheduledEvents(java.lang.String eventName)
eventName
- Name of the desired SimEventpublic java.util.SortedSet<SimEvent> getScheduledEvents()
public java.util.SortedSet getScheduledEvents(java.lang.String eventName, java.lang.Object[] params)
eventName
- Name of the desired SimEventparams
- Given parameter listpublic void setSimTime(double simTime)
simTime
- the desired simTimeInvalidSchedulingException
- if argument < current simTimeInvalidSchedulingException
- if argument > time of last scheduled event