public interface BasicEventList
Modifier and Type | Method and Description |
---|---|
void |
addIgnoreOnDump(java.lang.String eventName)
Events of this name will not be printed in verbose mode.
|
void |
addRerun(ReRunnable simEntity)
Add the SimEntity to the reRun list.
|
void |
clearRerun()
Empty the reRun list
|
void |
coldReset()
Resets instance to pristine condition, as if it were freshly
instantiated.
|
void |
dump()
Dumps current event list to the stream set by
setOutputStream() . |
void |
dump(java.lang.String reason)
Dumps current event list to the stream set by
setOutputStream() . |
SimEvent |
getCurrentSimEvent() |
java.lang.String |
getEventListAsString(java.lang.String reason)
For debugging purposes - returns a String depicting the current event and
state of the event list.
|
int |
getID() |
java.util.Set<java.lang.String> |
getIgnoredEvents()
For debugging purposes - returns a copy of the ignored events
|
int |
getNumberStopEvents() |
java.io.PrintStream |
getOutputStream() |
java.util.Set<ReRunnable> |
getRerun()
For debugging purposes - gets a copy of the current reRun list.
|
double |
getSimTime() |
java.lang.String |
getStopEventName() |
double |
getStopTime() |
void |
interrupt(SimEventScheduler simEntity,
java.lang.String eventName)
Cancel next event of given name (regardless of signature) owned by the
given SimEntity
|
void |
interrupt(SimEventScheduler simEntity,
java.lang.String eventName,
java.lang.Object... parameters)
Cancel next event of given name matching the parameter list owned by the
given SimEntity
|
void |
interruptAll(SimEventScheduler scheduler)
Cancel the all events scheduled by the given scheduler
|
void |
interruptAll(SimEventScheduler simEntity,
java.lang.String eventName)
Cancel all events with the given name which were scheduled by the given
SimEventScheduler regardless of signature.
|
void |
interruptAll(SimEventScheduler simEntity,
java.lang.String eventName,
java.lang.Object... parameters)
Cancel all events with the given name which were scheduled by the given
SimEventScheduler and whos parameters exactly match the given array.
|
void |
interruptAllWithArg(java.lang.Object parameter)
Interrupt all events having this parameter in its argument list,
regardless of event name and who scheduled it.
|
void |
interruptAllWithArg(SimEventScheduler simEntity,
java.lang.Object parameter)
Interrupt all events scheduled by this simEntity containing at least one
of the given parameter in its arguments.
|
void |
interruptAllWithArg(SimEventScheduler simEntity,
java.lang.String eventName,
java.lang.Object parameter)
Interrupt all events scheduled by this simEntity having the given
eventName and containing at least one of the given parameter in its
arguments.
|
void |
interruptAllWithArg(java.lang.String eventName,
java.lang.Object parameter)
Interrupt all events of the given eventName and having an instance of the
parameter in its arguments regardless of who scheduled it.
|
boolean |
isDumpEventSources() |
boolean |
isFinished() |
boolean |
isPauseAfterEachEvent() |
boolean |
isPrintEventSources() |
boolean |
isReallyVerbose() |
boolean |
isRunning() |
boolean |
isSingleStep() |
boolean |
isStopAtTime() |
boolean |
isStopOnEvent() |
boolean |
isVerbose() |
void |
pause()
Cause pending event processing to stop after completing processing of the
current event.
|
void |
removeIgnoreOnDump(java.lang.String eventName)
Events of this name now will be printed in verbose mode.
|
void |
removeRerun(ReRunnable simEntity)
Remove the given SimEntity from the reRun list
|
void |
reset()
Performs (at least) the following: Empty the pending event
list Sets simulation time to 0.0
|
void |
scheduleEvent(SimEvent event)
Place an event on the event list.
|
void |
setDumpEventSources(boolean b)
If true, then the SimEntity toString() is dumped with verbose mode for
each event.
|
void |
setFastInterrupts(boolean value)
If true, then pending SimEvents will be stored in a secondary hash table
to make them easier to find when interrupting (defaults to true).
|
void |
setFormat(java.lang.String format) |
void |
setOutputStream(java.io.PrintStream outputStream) |
void |
setPauseAfterEachEvent(boolean b)
If true, then simulation will pause after each event and resume only on
another call to
startSimulation() |
void |
setPrintEventSources(boolean b) |
void |
setReallyVerbose(boolean b)
For debugging, gives more detailed output
|
void |
setSingleStep(boolean b) |
void |
setUserDefinedStop() |
void |
setVerbose(boolean b)
If true, then contents of the event list are printed after each event is
processed.
|
void |
startSimulation()
Starts event list algorithm.
|
void |
step()
Process one event
|
void |
stopAtTime(double time)
Cause the schedule to stop processing pending events when simulation time
reaches the given value.
|
void |
stopOnEvent(int numberEvents,
java.lang.String eventName,
java.lang.Class<?>... signature)
Cause event processing to stop when the given number of events with this
signature have occurred.
|
void |
stopSimulation()
Stop processing pending events.
|
SimEvent getCurrentSimEvent()
java.lang.String getEventListAsString(java.lang.String reason)
reason
- User message to be appended to event listint getID()
double getSimTime()
java.lang.String getStopEventName()
double getStopTime()
stopAtTime
is setvoid interrupt(SimEventScheduler simEntity, java.lang.String eventName)
simEntity
- SimEventScheduler to have event cancelledeventName
- Name of event to cancelvoid interrupt(SimEventScheduler simEntity, java.lang.String eventName, java.lang.Object... parameters)
simEntity
- SimEventScheduler to have event cancelledeventName
- Name of event to cancelparameters
- edge parameters of cancelled eventvoid interruptAll(SimEventScheduler scheduler)
scheduler
- SimEventScheduler whose events will be interrupted.void interruptAll(SimEventScheduler simEntity, java.lang.String eventName)
simEntity
- SimEntity to have event cancelledeventName
- Name of eventvoid interruptAll(SimEventScheduler simEntity, java.lang.String eventName, java.lang.Object... parameters)
simEntity
- SimEntity to have event cancelledeventName
- Name of event to cancelparameters
- edge parameters that must matchvoid interruptAllWithArg(SimEventScheduler simEntity, java.lang.String eventName, java.lang.Object parameter)
simEntity
- Scheduling SimEntityeventName
- Name of events to be canceledparameter
- argument to be matchedvoid interruptAllWithArg(SimEventScheduler simEntity, java.lang.Object parameter)
simEntity
- Scheduling SimEntityparameter
- argument to be matchedvoid interruptAllWithArg(java.lang.String eventName, java.lang.Object parameter)
eventName
- Name of events to be canceledparameter
- argument to be matchedvoid interruptAllWithArg(java.lang.Object parameter)
parameter
- argument to be matchedboolean isFinished()
boolean isRunning()
void pause()
It is legal to subsequently call step
or startSimulation
.
isRunning
will return false after this is called.
void stopSimulation()
Unlike pause
resumption of the simulation is not supported. After
this call there is no guarantee that previously pending events or any
other external references will remain accessable. It is not legal to
subsequently call startSimulation
or step
void reset()
void scheduleEvent(SimEvent event) throws InvalidSchedulingException
event
- Event to be scheduledInvalidSchedulingException
- If scheduled time is less than current
simTime.void startSimulation()
handleSimEvent
method. Then have the owner
of the event notify its listeners of the event.void step()
Advance time to next event time and handle it.
An event is "handled" by making a callback to the scheduler of the event,
invoking its handleSimEvent
method.
Then have the owner of the event notify its listeners of the event.
isRunning()
should return true after this is called.
Note: Initiating event notifications from this method is a legacy
implementation detail. Newer implementations of this interface will
likely not include this action since it should be the responsibility of
the listened-to object to notify its listeners. That is, an object should
not have to be a SimEventListener in order to schedule and respond to its
own events. Conversely, a SimEventListener
should not have to be
a SimEventScheduler
.
void stopAtTime(double time)
Calling this method should cause any other stop method previously called to be ineffective. That is, the last stop_xxx method invoked should be the definitive one.
time
- Time to stop simulationvoid stopOnEvent(int numberEvents, java.lang.String eventName, java.lang.Class<?>... signature)
Calling this method should cause any other stop method previously called to be ineffective. That is, the last stop_xxx method invoked should be the definitive one.
numberEvents
- Number of events to occureventName
- Name of stop eventsignature
- Signature of stop eventvoid setVerbose(boolean b)
b
- whether verbose mode is onboolean isVerbose()
void setSingleStep(boolean b)
b
- Whether single step mode is onboolean isSingleStep()
void setUserDefinedStop()
void setPrintEventSources(boolean b)
b
- Whether the event source is printed on a dump()boolean isPrintEventSources()
void addRerun(ReRunnable simEntity)
BasicEventList.reset
the SimEntity's reset()
method is invoked and its Run event
(if it has one) is scheduled at time 0.0. This happens only if the
SimEntity is persistant.simEntity
- SimEntity to be added as a reRunvoid removeRerun(ReRunnable simEntity)
simEntity
- SimEntity to be removed from reRun listvoid clearRerun()
java.util.Set<ReRunnable> getRerun()
void addIgnoreOnDump(java.lang.String eventName)
eventName
- Name of event to be ignoredvoid removeIgnoreOnDump(java.lang.String eventName)
eventName
- Event Namejava.util.Set<java.lang.String> getIgnoredEvents()
void setReallyVerbose(boolean b)
b
- Whether reallyVerbose is onboolean isReallyVerbose()
void setPauseAfterEachEvent(boolean b)
startSimulation()
b
- Whether this mode is onboolean isPauseAfterEachEvent()
void coldReset()
false
).void setOutputStream(java.io.PrintStream outputStream)
java.io.PrintStream getOutputStream()
void dump()
setOutputStream()
.void dump(java.lang.String reason)
setOutputStream()
.reason
- Short message to add to dumpvoid setDumpEventSources(boolean b)
b
- Whether this mode is onboolean isDumpEventSources()
boolean isStopOnEvent()
void setFastInterrupts(boolean value)
value
- Given valuevoid setFormat(java.lang.String format)
format
- String for DecimalFormat
of time stringsint getNumberStopEvents()
boolean isStopAtTime()