Internal function called from spades
.
doEvent(sim, debug = FALSE, notOlderThan)
Character string for the simList
simulation object.
Optional logical flag or character vector indicating what to print to
console at each event. See details.
Default is to use the value in getOption("spades.debug")
.
Date or time. Passed to reproducible::Cache
to update the cache.
Default is NULL
, meaning don't update the cache.
If Sys.time()
is provided, then it will force a recache,
i.e., remove old value and replace with new value.
Ignored if cache
is FALSE
.
Returns the modified simList
object.
Calls the module corresponding to the event call, and executes the event.
Here, we implement a simulation in a more modular fashion so it's easier to add submodules to the simulation. We use S4 classes and methods, and use `data.table` instead of `data.frame` to implement the event queue (because it is much faster).
Matloff, N. (2011). The Art of R Programming (ch. 7.8.3). San Francisco, CA: No Starch Press, Inc.. Retrieved from https://www.nostarch.com/artofr.htm