class.Versioned: Class "Versioned"

Description Methods Author(s) See Also Examples

Description

Use this class as a ‘superclass’ for classes requiring information about versions.

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 of versions) added. Named elements of versions are character strings that can be coerced using package_version, or package_version instances.

classVersion(object)

Obtain version information about instance object. See classVersion.

classVersion(object) <- value

Set version information on instance object to value; useful when object is an instance of a class that contains VersionClass. See classVersion.

classVersion(object)["id"] <- value

Create or update version information "id" on instance object to value; useful when object is an instance of a class that contains VersionClass. See classVersion.

show(object)

Default method returns invisible, to avoid printing confusing information when your own class does not have a show method defined. Use classVersion(object) to get or set version information.

Author(s)

Biocore

See Also

Versions-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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)

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