/
compartment_lag_time.R
61 lines (52 loc) · 2.03 KB
/
compartment_lag_time.R
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#_______________________________________________________________________________
#---- compartment_lag_time class ----
#_______________________________________________________________________________
#'
#' Compartment lag time class.
#'
#' @export
setClass(
"compartment_lag_time",
representation(
),
contains = "compartment_property",
validity=function(object) {
return(TRUE)
}
)
#'
#' Create a lag time for the specified compartment.
#'
#' @param compartment compartment index
#' @param rhs right-hand side part of the equation
#' @return a lag time property
#' @export
LagTime <- function(compartment, rhs="") {
return(new("compartment_lag_time", compartment=as.integer(compartment), rhs=rhs))
}
#_______________________________________________________________________________
#---- getName ----
#_______________________________________________________________________________
#' @rdname getName
setMethod("getName", signature = c("compartment_lag_time"), definition = function(x) {
return(paste0("LAG_TIME (", "CMT=", x@compartment, ")"))
})
#_______________________________________________________________________________
#---- getPrefix ----
#_______________________________________________________________________________
#' @rdname getPrefix
setMethod("getPrefix", signature = c("compartment_lag_time"), definition = function(object, ...) {
dest <- processExtraArg(args=list(...), name="dest", default="RxODE")
if (dest=="mrgsolve") {
return("ALAG")
} else {
return("lag")
}
})
#_______________________________________________________________________________
#---- getRecordName ----
#_______________________________________________________________________________
#' @rdname getRecordName
setMethod("getRecordName", signature = c("compartment_lag_time"), definition = function(object) {
return("LAG")
})