R/AssignmentRule.R

setClass("AssignmentRule", representation(variable = "character", type = "character"), 
  contains = "Rule")

setMethod("describe", "AssignmentRule",
          function(object) paste(variable(object), ":=", math(object)))

setGeneric("type", function(object) standardGeneric("type"))
setMethod("type", "AssignmentRule", function(object) object@type)

setGeneric("type<-", function(object, value) standardGeneric("type<-"))
setReplaceMethod("type", "AssignmentRule", function(object, value) {
  if (!(type %in% c("rate", "scalar")))
    stop("Rule type must be either 'rate' or 'scalar', not ", type)
  object@type <- value
  object
})

setMethod("variable", "AssignmentRule", function(object) object@variable)

setReplaceMethod("variable", "AssignmentRule", function(object, value) {
  object@variable <- value
  object
})

Try the rsbml package in your browser

Any scripts or data that you put into this service are public.

rsbml documentation built on Nov. 8, 2020, 8:09 p.m.