Provides methods for evaluating event occurrences. The event mechanism should only be evaluated by the simulator.
Object of R6Class
Event, with methods to get/set the internal parameter values and to evaluate the event mechanism.
description
A character string giving a more descriptive overview of the event's role.
new()
Create a new Event object.
Event$new( name, description = "", parameters = list(), derived = list(), allocated = list(), mechanism )
name
A character string giving the name of the event. Must be unique.
description
A character string giving a more descriptive overview of the event's role.
parameters
A named list giving the initial parameter values of the event.
derived
A list of expression that define additional parameters based on those in parameters
.
If given, then parameters
should be named, so its elements can be referenced by elements of derived
.
allocated
A named list of expression that define objects that persist between iterations,
for example to avoid memory reallocation. The initial status
of the simulator can be referenced by these expressions, a
s well as any parameters
or derived
parameters of the event itself.
mechanism
An expression that defines the event functionality.
apply()
Apply an event. Not defined for the superclass.
Event$apply()
allocate()
Allocates persistent objects for the event.
Event$allocate(status)
status
The initial status of the Simulator
.
set_parameters()
Set the parameter values of the event. Derived parameters are computed again based on the new values.
Event$set_parameters(pars)
pars
A named list where where the names correspond to the names of the parameters of whose values are to be set.
get_parameters()
Get the current parameter values.
Event$get_parameters(derived = TRUE)
derived
A logical value. If TRUE
(the default), the derived parameters are also returned.
A list of the current parameter values.
set_id()
Assing an identifier for the event. Should not be called by the user directly.
Event$set_id(id)
id
An integer identifier to set.
get_id()
Get the event identifier
Event$get_id()
get_name()
Get the name of the event
Event$get_name()
clone()
The objects of this class are cloneable with this method.
Event$clone(deep = FALSE)
deep
Whether to make a deep clone.