R/print.R

Defines functions print.rscalaType toString.rscalaType toString.rscalaSub print.rscalaSub toString.rscalaReference print.rscalaReference toString.rscalaBridge print.rscalaBridge

#' @export
#' 
print.rscalaBridge <- function(x, ...) {
  cat(toString(x, ...),"\n",sep="")
}

#' @export
#
toString.rscalaBridge <- function(x, ...) {
  if ( is.function(x) ) "Scala bridge"
  else "Scala bridge with a parameter list"
}

#' @export
#' 
print.rscalaReference <- function(x, ...) {
  env <- attr(x,"rscalaReferenceEnvironment")
  if ( exists("original",envir=env) ) {
    func <- get("original",envir=env)
    if ( ! is.null(func) ) print(func)
  }
  cat(toString(x, ...),"\n",sep="")
}

#' @export
#
toString.rscalaReference <- function(x, ...) {
  env <- attr(x,"rscalaReferenceEnvironment")
  paste0("rscala reference of type ",env[["type"]])
}

#' @export
#' 
print.rscalaSub <- function(x, ...) {
  cat(toString(x, ...),"\n",sep="")
}

#' @export
#
toString.rscalaSub <- function(x, ...) {
  "rscala stub"
}

#' @export
#' 
toString.rscalaType <- function(x, ...) {
  paste0(unclass(x))
}

#' @export
#' 
print.rscalaType <- function(x, ...) {
  cat(toString(x, ...),"\n",sep="")
}

Try the rscala package in your browser

Any scripts or data that you put into this service are public.

rscala documentation built on Aug. 15, 2023, 9:07 a.m.