R/features.R

Defines functions is.features features

#' Features
#'
#' Defines a category for the different kinds of non-model dsprotos
#' @keywords internal
#' @param f1 dsproto of type feature
#' @param f2 dsproto of type feature
#' @export
features <- function(f1,f2){
    dsproto(
      "features", NULL,
      features = c(f1,f2),
      addFeature = function(self, obj) {
        if (is.features(obj))
          self$features <- append(self$features, obj$features)
        else
          self$features <- append(self$features, obj)
        self
        }
      )
}

#' Checks if object is a collection of dsproto objects.
# @rdname features
#' @param obj An object to test
#' @keywords internal
#' @export
is.features <- function(obj) {
  inherits(obj,"features")
}
Trinity-Automata-Research/dsmodels documentation built on May 18, 2024, 1:20 p.m.