Skip to contents

See new_variable_collection for construction

Value

Formatted characters

Self

The removed variable

TRUE if found, otherwise FALSE

Self

The variable value if variable if found and get_definition is false; or the variable definition if variable is found and is RAVEVariable or RAVEVariableCollection; or ifnotfound if the variable does not exist

The variable values in list

Nothing

TRUE if valid, or raises errors by default

TRUE if valid, otherwise returns the error message

A list of constraint data that can be passed into $restore method

RAVEVariableCollection instance

See also

Public fields

explicit

whether getting and setting values should be explicit. If true, then all variables must be defined (see $add_variable) before used.

Active bindings

.wrapper

wrapper instance of current variable collection

generator

class definition

isRAVEVariableCollection

always true

variables

map containing the variable definitions

varnames

variable names

name

descriptive name of the collection

Methods


Method new()

Constructor

Usage

RAVEVariableCollection$new(name = "", explicit = TRUE)

Arguments

name

descriptive name of the collection

explicit

see field explicit


Method format()

Format method

Usage

RAVEVariableCollection$format(...)

Arguments

...

ignored


Method add_variable()

Registers a variable, must run if the collection is explicit

Usage

RAVEVariableCollection$add_variable(id, var)

Arguments

id

variable 'ID'

var

a RAVEVariable or RAVEVariableCollection instance if the variable is bounded, or simply normal R object ( then the variable will have no constraint)


Method remove_variable()

Remove a variable

Usage

RAVEVariableCollection$remove_variable(id)

Arguments

id

variable 'ID'


Method has_variable()

Check whether a variable exists

Usage

RAVEVariableCollection$has_variable(id)

Arguments

id

variable 'ID'


Method set_value()

Set value of a variable

Usage

RAVEVariableCollection$set_value(id, value, env = parent.frame(), ...)

Arguments

id

variable 'ID'

value

the value to be set

env, ...

passed to RAVEVariable$set_value


Method get_value()

Get value of a variable

Usage

RAVEVariableCollection$get_value(
  id,
  env = parent.frame(),
  get_definition = FALSE,
  ifnotfound = NULL
)

Arguments

id

variable 'ID'

env

environment of evaluation

get_definition

whether to return the variable definition instance (RAVEVariable or RAVEVariableCollection) instead of the value; default is false

ifnotfound

default value if not found; default is NULL


Method as_list()

Convert to list

Usage

RAVEVariableCollection$as_list(env = parent.frame())

Arguments

env

environment of evaluation


Method use_constraints()

Set collection validation

Usage

RAVEVariableCollection$use_constraints(x)

Arguments

x

either a NULL or an expression with global variables x, self, private, and defs Mainly used to validate the values of multiple variables (some variables are dependent or bounded by other variables)


Method validate()

Run validation

Usage

RAVEVariableCollection$validate(
  env = parent.frame(),
  on_error = c("error", "warning", "message", "muffle")
)

Arguments

env

environment to evaluate validation expressions

on_error

character, error handler


Method check()

Check if the value is valid with no error raised

Usage

RAVEVariableCollection$check(env = parent.frame())

Arguments

env

environment to evaluate validation expressions


Method store()

Convert constraint to atomic list, used for serializing

Usage

RAVEVariableCollection$store(...)

Arguments

...

ignored


Method restore()

Restores from atomic list generated by $store()

Usage

RAVEVariableCollection$restore(x, env = parent.frame(), clear = FALSE, ...)

Arguments

x

atomic list

env

environment where to query the class definitions

clear

whether to clear the current variables; default is false

...

ignored


Method clone()

The objects of this class are cloneable with this method.

Usage

RAVEVariableCollection$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.