metaRangeProcess | R Documentation |
Creates an metaRangeProcess object in form of an R6 class that stores and handles all the individual parts that define a process.
<metaRangeProcess>
A metaRangeProcess object.
fun
<function>
The processes function.
new()
Creates a new metaRangeProcess object
metaRangeProcess$new( process_name, id = "", process_fun, execution_priority, env, env_label = NULL )
process_name
<string>
name of the process.
id
<string>
optional ID of the process.
process_fun
<function>
The function to be
called when the process is executed. This function will be executed
in the specified environment (see argument: env) and has access to all the
variables in that environment. This function may not have any arguments,
i.e. is.null(formals(process_fun))
must be TRUE
.
execution_priority
<integer>
the priority of the process.
The lower the number the earlier the process is executed.
Note that the priority is only used to sort the processes
in the priority queue. The actual execution order is determined
by the order of the processes in the queue.
env
<environment>
the environment where the process should be executed.
env_label
<string>
optional name of the execution environment.
Just used as a human readable label for debug purposes.
<metaRangeProcess>
A metaRangeProcess object.
# Note: Only for illustration purposes. Use the add_process method of the # simulation object to add processes to a simulation. pr <- metaRangeProcess$new( process_name = "ecological_process", process_fun = function() { cat("Execute ecological process!") }, execution_priority = 1L, env = new.env(), env_label = "a_species_name" ) pr
get_PID()
get the process ID
metaRangeProcess$get_PID()
<string>
The process ID
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env()) pr$get_PID()
get_name()
get the process name
metaRangeProcess$get_name()
<string>
The process name
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env()) pr$get_name()
get_priority()
get the process execution priority
metaRangeProcess$get_priority()
<integer>
The process execution priority
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env()) pr$get_priority()
get_env_label()
get the name of the process execution environment
metaRangeProcess$get_env_label()
<string>
The name of the process execution environment or NULL
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env(), "human_readable_label") pr$get_env_label()
print()
Prints information about the process to the console
metaRangeProcess$print()
<invisible self>
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env()) pr$print()
metaRangePriorityQueue
## ------------------------------------------------
## Method `metaRangeProcess$new`
## ------------------------------------------------
# Note: Only for illustration purposes. Use the add_process method of the
# simulation object to add processes to a simulation.
pr <- metaRangeProcess$new(
process_name = "ecological_process",
process_fun = function() {
cat("Execute ecological process!")
},
execution_priority = 1L,
env = new.env(),
env_label = "a_species_name"
)
pr
## ------------------------------------------------
## Method `metaRangeProcess$get_PID`
## ------------------------------------------------
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env())
pr$get_PID()
## ------------------------------------------------
## Method `metaRangeProcess$get_name`
## ------------------------------------------------
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env())
pr$get_name()
## ------------------------------------------------
## Method `metaRangeProcess$get_priority`
## ------------------------------------------------
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env())
pr$get_priority()
## ------------------------------------------------
## Method `metaRangeProcess$get_env_label`
## ------------------------------------------------
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env(), "human_readable_label")
pr$get_env_label()
## ------------------------------------------------
## Method `metaRangeProcess$print`
## ------------------------------------------------
pr <- metaRangeProcess$new("A", "1", \() {}, 1, new.env())
pr$print()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.