dot-modello.session: R6 class representing the current modello session

Description Details Public fields Methods Author(s)

Description

R6 class representing the current modello session

R6 class representing the current modello session

Details

An object of this class called '.modello' is created when the package is loaded and will do the booking keeping of what happens during the session.

Public fields

.init

stores the init status of the session (TRUE/FALSE)

.n.numbers

number of allocate slot for storing number

.numbers

environment keeping track of the created numbers

.n.nodes

number of slot allocated for storing nodes

.n.graphs

number of slots allocated for storing graphs

.graphs

environement keeping track of the created graphs

.n.opts

number of slots allocated for storing optimisers

.opts

environment keeping track of the created optimisers

Methods

Public methods


Method new()

modello session object initialisation method. It does nothgin, it is just use on package load to create the .modello object containing the session.

Usage
.modello.session$new()

Method init()

Allocates all the arrays necessary to the session

Usage
.modello.session$init(n.numbers, n.nodes, n.graphs, n.opts)
Arguments
n.numbers

number of numbers

n.nodes

number of nodes

n.graphs

number of graphs

n.opts

number of optimisers

Returns

Returns invisible NULL.


Method close()

Deallocates all the session arrays

Usage
.modello.session$close()
Returns

Returns invisible NULL.


Method reset()

Reset the session by deallocating and reallocating all the arrays. The data in the arrays is lost.

Usage
.modello.session$reset()
Returns

Returns invisible NULL.


Method finalize()

Closes the session if its object is destroyed.

Usage
.modello.session$finalize()

Method next.name()

build unique random number ideintifying a number, graph or optimizer.

Usage
.modello.session$next.name(typ)
Arguments
typ

charcter indicating the type of object.


Method new.number()

Creates a new number and return the corresponding reference object of class 'number'

Usage
.modello.session$new.number(id, name = NULL)
Arguments
id

number id

name

number name


Method number.name.exists()

Checks if a number name exists.

Usage
.modello.session$number.name.exists(name)
Arguments
name

number name

Returns

Returns TRUE if the name exists, FALSE otherwise


Method append.number()

Append a number of the given shape to the NUMBER_ array. A link to the number is create the numbers environment within the session object. This method is called each time a new number is created.

Usage
.modello.session$append.number(shp, dx, name = NULL)
Arguments
shp

number shape

dx

if TRUE allocate a derivative array for the number

name

character, number name. Only for loading saved numbers

Returns

Returns an object of class 'number' referring to the appended number


Method get.number()

Given a name (character identifier) for a number creates and returns a reference objects of class 'number'.

Usage
.modello.session$get.number(name)
Arguments
name

number name

Returns

Returns a object of class 'number'


Method pop.number()

Pops (removes) a number fro the NUMBERS_ array according to the provided reference object.

Usage
.modello.session$pop.number(x)
Arguments
x

reference object of class 'number'

Returns

Returns invisible x.


Method number.id()

Given a reference object of class 'number', retrives and returs the id of the associated nummber (i.e. its position in the NUMBERS_ array.

Usage
.modello.session$number.id(x)
Arguments
x

reference object of class 'number'

Returns

Returns the number id


Method number.exists()

Checks that the number associated to a referece object of class 'number' exists.

Usage
.modello.session$number.exists(x)
Arguments
x

reference object of class 'number'

Returns

Returns TRUE if the number exists, FALSE otherwise.


Method number.gc()

Calls the number garbage collector.

Usage
.modello.session$number.gc()
Returns

Returns invisible NULL


Method apply.math_op()

Applies a mathematical operator to its arguments.

Usage
.modello.session$apply.math_op(op, ...)
Arguments
op

operator name

...

operator parameters

name

name of the output number. If NULL is automatically generated

Returns

Returns a number


Method new.graph()

Creates a new graph and return the corresponding reference object of class 'graph'

Usage
.modello.session$new.graph(id)
Arguments
id

graph id

Returns

Returns a reference object of class 'graph'


Method graph.name.exists()

Checks if a graph name exists.

Usage
.modello.session$graph.name.exists(name)
Arguments
name

graph name

Returns

Returns TRUE if the name exists, FALSE otherwise


Method graph.open()

Opens a graph.

if g is NULL a new graph is open and appended to the graph array. If a reference object of class 'graph' is porvided the corresponding graph is open.

Usage
.modello.session$graph.open(g = NULL)
Arguments
g

reference object of class 'graph'

Returns

Returns an reference object of class 'graph'


Method get.graph()

Given a graph name (character identifier) creates and returns a reference object of class 'graph'.

Usage
.modello.session$get.graph(name)
Arguments
name

graph name

Returns

Returns a reference object of class 'graph'.


Method pop.graph()

Pops (removes) a graph from the GRAPHS_ array.

Usage
.modello.session$pop.graph(x)
Arguments
x

reference object of class 'graph'

Returns

Returns invisible x.


Method graph.id()

Given a reference object of class 'graph', retunrs the id (i.e. position in the GRAPHS_ array) of the associated graph.

Usage
.modello.session$graph.id(x)
Arguments
x

reference object of class 'graph'

Returns

Returns the graph id


Method graph.exists()

Checks that the graph associated to a referece object of class 'graph' exists.

Usage
.modello.session$graph.exists(x)
Arguments
x

reference object of class 'graph'

Returns

Returns TRUE if the graph exists, FALSE otherwise.


Method graph.gc()

Calls the graph garbage collector.

Usage
.modello.session$graph.gc()
Returns

Returns invisible NULL


Method new.opt()

Creates a new optimiser and return the corresponding reference object of class 'opt'

Usage
.modello.session$new.opt(id, opt)
Arguments
id

optimiser id

opt

R6 class indentifying the kind of optimiser

Returns

Returns a reference object of class 'opt'


Method opt.name.exists()

Checks if a optimiser name exists.

Usage
.modello.session$opt.name.exists(name)
Arguments
name

optimiser name

Returns

Returns TRUE if the name exists, FALSE otherwise


Method append.opt()

Append an optimiser with the given parameters to the OPTS_ array. A link to the optimiser is created in .opt environment within the session object. This method is called each time a new optimiser is created.

Usage
.modello.session$append.opt(append, opt, ...)
Arguments
append

interface function for appending the optimiser to GOPTS_

opt

character dincating the kind of optimiser

...

optmiser parameters

Returns

Returns an object of class 'opt' referring to the appended optmiser


Method get.opt()

Given a name (character identifier) for an optimiser creates and returns a reference objects of class 'opt'.

Usage
.modello.session$get.opt(name)
Arguments
name

optimiser name

Returns

Returns a object of class 'opt'


Method pop.opt()

Pops (removes) an optmiser from the OPTS_ array according to the provided reference object.

Usage
.modello.session$pop.opt(x)
Arguments
x

reference object of class 'opt'

Returns

Returns invisible x.


Method opt.id()

Given a reference object of class 'opt', retrives and returs the id of the associated optmiser (i.e. its position in the OPTS_ array.

Usage
.modello.session$opt.id(x)
Arguments
x

reference object of class 'opt'

Returns

Returns the optmiser id


Method opt.exists()

Checks that the optmiser associated to a referece object of class 'opt' exists.

Usage
.modello.session$opt.exists(x)
Arguments
x

reference object of class 'opt'

Returns

Returns TRUE if the optmiser exists, FALSE otherwise.


Method clone()

The objects of this class are cloneable with this method.

Usage
.modello.session$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

Filippo Monari


modello documentation built on Feb. 2, 2021, 9:06 a.m.