1
#' @include RcppExports.R raptr-internal.R misc.R
2
NULL
3

4
#' RapUnreliableOpts: An S4 class to represent parameters for the unreliable
5
#' RAP problem
6
#'
7
#' This class is used to store input parameters for the unreliable RAP problem
8
#' formulation.
9
#'
10
#' @slot BLM `numeric` boundary length modifier. Defaults to 0.
11
#'
12
#' @name RapUnreliableOpts-class
13
#'
14
#' @rdname RapUnreliableOpts-class
15
#'
16
#' @exportClass RapUnreliableOpts
17
methods::setClass("RapUnreliableOpts", contains = "RapOpts",
18
  validity = function(object) {
19
    assertthat::assert_that(
20
        assertthat::is.scalar(object@BLM),
21
        msg = "argument to BLM is not a scalar number")
22
    assertthat::assert_that(
23
        all(is.finite(object@BLM)),
24
        msg = "argument to BLM is is NA or non-finite value")
25
    return(TRUE)
26
  }
27
)
28

29
#' Create RapUnreliableOpts object
30
#'
31
#' This function creates a new RapUnreliableOpts object.
32
#'
33
#' @param BLM `numeric` boundary length modifier. Defaults to 0.
34
#'
35
#' @return [RapUnreliableOpts()] object
36
#'
37
#' @seealso [RapUnreliableOpts-class].
38
#'
39
#' @examples
40
#' # create RapUnreliableOpts using defaults
41
#' RapUnreliableOpts(BLM = 0)
42
#'
43
#' @export
44
RapUnreliableOpts <- function(BLM = 0) {
45
  ro <- methods::new("RapUnreliableOpts", BLM = BLM)
46
  methods::validObject(ro, test = FALSE)
47
  return(ro)
48
}
49

50
#' @method print RapUnreliableOpts
51
#'
52
#' @rdname print
53
#'
54
#' @export
55
print.RapUnreliableOpts <- function(x, ..., header = TRUE) {
56
  assertthat::assert_that(assertthat::is.flag(header))
57
  if (header)
58
    message("RapUnreliableOpts object.")
59
  message("  BLM: ", x@BLM)
60
  invisible()
61
}
62

63
#' @rdname show
64
#'
65
#' @usage \S4method{show}{RapUnreliableOpts}(object)
66
#'
67
#' @name show
68
#'
69
#' @aliases show,RapUnreliableOpts-method
70
methods::setMethod("show", "RapUnreliableOpts",
71
                   function(object) print.RapUnreliableOpts(object))
72

73
#' @rdname update
74
#'
75
#' @method update RapUnreliableOpts
76
#'
77
#' @export
78
update.RapUnreliableOpts <- function(object, BLM = NULL, ...) {
79
  if (!is.null(BLM))
80
    object@BLM <- BLM
81
  # check object for validity
82
  methods::validObject(object, test = FALSE)
83
  # return object
84
  return(object)
85
}

Read our documentation on viewing source code .

Loading