Listeners | R Documentation |
Create a class of listener. A listener monitors the trial while checking condition of pre-defined milestones. Actions are triggered and executed automatically.
new()
initialize a listener
Listeners$new(silent = FALSE)
silent
logical. TRUE
to mute messages.
add_milestones()
register milestones with listener. Order in ...
matter
as they are scanned in that order. It is user's responsibility
to use reasonable order when calling this function, otherwise,
the result of Listener$monitor()
can be problematic.
Listeners$add_milestones(...)
...
milestones
get_milestones()
return registered milestones
Listeners$get_milestones(milestone_name = NULL)
milestone_name
return Milestone
object with given name(s).
If NULL
, all registered milestones are returned.
get_milestone_names()
return names of registered milestones
Listeners$get_milestone_names()
monitor()
scan, check, and trigger registered milestones.
Milestones are triggered in the order when calling
Listener$add_milestones
.
Listeners$monitor(trial, dry_run)
trial
a Trial
object.
dry_run
logical. See Controller::run
for more information.
mute()
mute all messages (not including warnings)
Listeners$mute(silent)
silent
logical.
reset()
reset all milestones registered to the listener. Usually, this is called before a controller can run additional replicates of simulation.
Listeners$reset()
clone()
The objects of this class are cloneable with this method.
Listeners$clone(deep = FALSE)
deep
Whether to make a deep clone.
##
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.