R/methods-container.R

# ==========================================================================
setMethod("content", "container", function(object) object@content)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
setMethod("locked", "container", function(object) object@locked)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
setMethod("[", "container",
   def = function(x, i, j, ..., drop = F) {
      .container(content = content(x), x = x@x[i], locked = locked(x))
   }
)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
setMethod("[[", "container",
   function(x, i, j, ...) {
      x@x[[i]]
   }
)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
setReplaceMethod("[[", "container",
   function(x, i, j,..., value) {
      if( locked(x) )
         stop("cannot assign into a locked container")
      cv <- class(value)
      cont <- content(x)
      if( !extends(cv, cont) )
         stop("the container is class '", cont,
              "' the object is class '", cv, "' cannot assign")
      x@x[[i]] <- value
      x
   }
)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
setMethod("length", "container", function(x) length(x@x))
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
setMethod("show", "container",
   function(object) {
      cat("Container of ", content(object), "\n", sep="")
      print(object@x)
   }
)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Try the Biobase package in your browser

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

Biobase documentation built on Nov. 8, 2020, 6:52 p.m.