Learn R Programming

mtk (version 1.0)

mtkValue-class: The mtkValue class

Description

The mtkValue class is a virtual class used to manage a triple (name, type, value).

Arguments

Class Hierarchy

Parent classes :
Direct Known Subclasses :
mtkParameter, codemtkFeature

Constructor

mtkValue
signature(name='unknown', type='', val=NULL)

Slots

name:
(character) the name of the variable.
type:
(character) the type of the variable.
val:
(ANY) the value of the variable in the right type. It may be a single value or a vector of values

Methods

getName
signature( this = "mtkValue"): Returns the value of the slot "name".
getValue
signature( this = "mtkValue"): Returns the value of the slot "val".
getType
signature(this = "mtkValue"): Returns the value of the slot "type".
setName
signature(this = "mtkValue", name = "character"): Gives a new value to the slot "name".
setValue
signature(this = "mtkValue", type = "ANY"): Gives a new value to the slot "val".
setType
signature(this = "mtkValue", type = "character"): Gives a new value to the slot "type".
show
signature( object = "mtkValue"): Prints a report of the data managed by the underlying object.
print
signature(x = "mtkValue"): Prints the information managed by the underlying object.

Examples

Run this code
# Create a  new object of 'mtkValue'
d <- mtkValue("a", "double", c(0,1))
getType(d) # gives "double"
getName(d) # gives "a"
getValue(d) # gives (0, 1)

setType(d, 'character')
getValue(d) # gives ("0", "1")

setValue(d, "3.14")
getValue(d) # gives "3.14"

Run the code above in your browser using DataLab