Provides methods for evaluating event occurrences. The event mechanism should only be evaluated by the simulator.

Value

Object of R6Class Event, with methods to get/set the internal parameter values and to evaluate the event mechanism.

Public fields

description

A character string giving a more descriptive overview of the event's role.

Methods

Public methods


Method new()

Create a new Event object.

Usage

Event$new(
  name,
  description = "",
  parameters = list(),
  derived = list(),
  allocated = list(),
  mechanism
)

Arguments

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.


Method apply()

Apply an event. Not defined for the superclass.

Usage

Event$apply()


Method allocate()

Allocates persistent objects for the event.

Usage

Event$allocate(status)

Arguments

status

The initial status of the Simulator.


Method set_parameters()

Set the parameter values of the event. Derived parameters are computed again based on the new values.

Usage

Event$set_parameters(pars)

Arguments

pars

A named list where where the names correspond to the names of the parameters of whose values are to be set.


Method get_parameters()

Get the current parameter values.

Usage

Event$get_parameters(derived = TRUE)

Arguments

derived

A logical value. If TRUE (the default), the derived parameters are also returned.

Returns

A list of the current parameter values.


Method set_id()

Assing an identifier for the event. Should not be called by the user directly.

Usage

Event$set_id(id)

Arguments

id

An integer identifier to set.


Method get_id()

Get the event identifier

Usage

Event$get_id()


Method get_name()

Get the name of the event

Usage

Event$get_name()


Method clone()

The objects of this class are cloneable with this method.

Usage

Event$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.