Versioned
Class "Versioned"
Use this class as a `superclass' for classes requiring information about versions.
- Keywords
- classes
Methods
The following are defined; package developers may write additional methods.
new("Versioned", ..., versions=list())
- Create a new
Versioned-class
instance, perhaps with additional named version elements (the contents ofversions
) added. Named elements ofversions
are character strings that can be coerced usingpackage_version
, orpackage_version
instances. classVersion(object)
- Obtain version information about instance
object
. SeeclassVersion
. classVersion(object) <- value
- Set version information on instance
object
tovalue
; useful whenobject
is an instance of a class that containsVersionClass
. SeeclassVersion
. classVersion(object)["id"] <- value
- Create or update version information
"id"
on instanceobject
tovalue
; useful whenobject
is an instance of a class that containsVersionClass
. SeeclassVersion
. show(object)
- Default method returns
invisible
, to avoid printing confusing information when your own class does not have ashow
method defined. UseclassVersion(object)
to get or set version information.
See Also
Examples
obj <- new("Versioned", versions=list(A="1.0.0"))
obj
classVersion(obj)
A <- setClass("A", contains="Versioned")
classVersion("A")
a <- A()
a # 'show' nothing by default
classVersion(a)
B <- setClass("B", contains="Versioned",
prototype=prototype(new("Versioned",versions=list(B="1.0.0"))))
classVersion("B")
b <- B()
classVersion(b)
classVersion(b)["B"] <- "1.0.1"
classVersion(b)
classVersion("B")
classVersion("B") < classVersion(b)
classVersion(b) == "1.0.1"
C <- setClass("C",
representation(x="numeric"),
contains=("VersionedBiobase"),
prototype=prototype(new("VersionedBiobase", versions=c(C="1.0.1"))))
setMethod("show", signature(object="C"),
function(object) print(object@x))
c <- C(x=1:10)
c
classVersion(c)
Community examples
Looks like there are no examples yet.