R/ModelMetricsInner.r

# Dkube api server
#
# No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
#
# OpenAPI spec version: 2.2.1.11
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' ModelMetricsInner Class
#'
#' @field class 
#' @field name 
#' @field curve 
#' @field table 
#' @field scalar 
#' @field confusion_matrix 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
ModelMetricsInner <- R6::R6Class(
  'ModelMetricsInner',
  public = list(
    `class` = NULL,
    `name` = NULL,
    `curve` = NULL,
    `table` = NULL,
    `scalar` = NULL,
    `confusion_matrix` = NULL,
    initialize = function(`class`, `name`, `curve`, `table`, `scalar`, `confusion_matrix`){
      if (!missing(`class`)) {
        stopifnot(is.character(`class`), length(`class`) == 1)
        self$`class` <- `class`
      }
      if (!missing(`name`)) {
        stopifnot(is.character(`name`), length(`name`) == 1)
        self$`name` <- `name`
      }
      if (!missing(`curve`)) {
        stopifnot(R6::is.R6(`curve`))
        self$`curve` <- `curve`
      }
      if (!missing(`table`)) {
        stopifnot(R6::is.R6(`table`))
        self$`table` <- `table`
      }
      if (!missing(`scalar`)) {
        stopifnot(is.character(`scalar`), length(`scalar`) == 1)
        self$`scalar` <- `scalar`
      }
      if (!missing(`confusion_matrix`)) {
        stopifnot(R6::is.R6(`confusion_matrix`))
        self$`confusion_matrix` <- `confusion_matrix`
      }
    },
    toJSON = function() {
      ModelMetricsInnerObject <- list()
      if (!is.null(self$`class`)) {
        ModelMetricsInnerObject[['class']] <- self$`class`
      }
      if (!is.null(self$`name`)) {
        ModelMetricsInnerObject[['name']] <- self$`name`
      }
      if (!is.null(self$`curve`)) {
        ModelMetricsInnerObject[['curve']] <- self$`curve`$toJSON()
      }
      if (!is.null(self$`table`)) {
        ModelMetricsInnerObject[['table']] <- self$`table`$toJSON()
      }
      if (!is.null(self$`scalar`)) {
        ModelMetricsInnerObject[['scalar']] <- self$`scalar`
      }
      if (!is.null(self$`confusion_matrix`)) {
        ModelMetricsInnerObject[['confusion_matrix']] <- self$`confusion_matrix`$toJSON()
      }

      ModelMetricsInnerObject
    },
    fromJSON = function(ModelMetricsInnerJson) {
      ModelMetricsInnerObject <- jsonlite::fromJSON(ModelMetricsInnerJson)
      if (!is.null(ModelMetricsInnerObject$`class`)) {
        self$`class` <- ModelMetricsInnerObject$`class`
      }
      if (!is.null(ModelMetricsInnerObject$`name`)) {
        self$`name` <- ModelMetricsInnerObject$`name`
      }
      if (!is.null(ModelMetricsInnerObject$`curve`)) {
        curveObject <- ModelMetricsInnerCurve$new()
        curveObject$fromJSON(jsonlite::toJSON(ModelMetricsInnerObject$curve, auto_unbox = TRUE))
        self$`curve` <- curveObject
      }
      if (!is.null(ModelMetricsInnerObject$`table`)) {
        tableObject <- ModelMetricsInnerCurve$new()
        tableObject$fromJSON(jsonlite::toJSON(ModelMetricsInnerObject$table, auto_unbox = TRUE))
        self$`table` <- tableObject
      }
      if (!is.null(ModelMetricsInnerObject$`scalar`)) {
        self$`scalar` <- ModelMetricsInnerObject$`scalar`
      }
      if (!is.null(ModelMetricsInnerObject$`confusion_matrix`)) {
        confusion_matrixObject <- ModelMetricsInnerCurve$new()
        confusion_matrixObject$fromJSON(jsonlite::toJSON(ModelMetricsInnerObject$confusion_matrix, auto_unbox = TRUE))
        self$`confusion_matrix` <- confusion_matrixObject
      }
    },
    toJSONString = function() {
       sprintf(
        '{
           "class": %s,
           "name": %s,
           "curve": %s,
           "table": %s,
           "scalar": %s,
           "confusion_matrix": %s
        }',
        self$`class`,
        self$`name`,
        self$`curve`$toJSON(),
        self$`table`$toJSON(),
        self$`scalar`,
        self$`confusion_matrix`$toJSON()
      )
    },
    fromJSONString = function(ModelMetricsInnerJson) {
      ModelMetricsInnerObject <- jsonlite::fromJSON(ModelMetricsInnerJson)
      self$`class` <- ModelMetricsInnerObject$`class`
      self$`name` <- ModelMetricsInnerObject$`name`
      ModelMetricsInnerCurveObject <- ModelMetricsInnerCurve$new()
      self$`curve` <- ModelMetricsInnerCurveObject$fromJSON(jsonlite::toJSON(ModelMetricsInnerObject$curve, auto_unbox = TRUE))
      ModelMetricsInnerCurveObject <- ModelMetricsInnerCurve$new()
      self$`table` <- ModelMetricsInnerCurveObject$fromJSON(jsonlite::toJSON(ModelMetricsInnerObject$table, auto_unbox = TRUE))
      self$`scalar` <- ModelMetricsInnerObject$`scalar`
      ModelMetricsInnerCurveObject <- ModelMetricsInnerCurve$new()
      self$`confusion_matrix` <- ModelMetricsInnerCurveObject$fromJSON(jsonlite::toJSON(ModelMetricsInnerObject$confusion_matrix, auto_unbox = TRUE))
    }
  )
)
riteshkarvaloc/dkubeR documentation built on Feb. 25, 2021, 9:28 p.m.