R/class-Weights.R

#' Class "Weights"
#'
#' @description An S4 class representing weights for AHP calculation. Each value in \code{numeric} vector
#' represents one weight.
#'
#' @slot weights Object of class \code{numeric} containing weights.
#'
#' @export
setClass(
  Class="Weights",

  slots = c(
    weights = "numeric"
  ),

  validity=function(object)
  {
     if(!(all.equal(sum(object@weights),1, tolerance=0.000001))){
       return(paste("Sum of weights is not equal to 1. The sum is ", sum(object@weights), ".", sep=""))
     }

    return(TRUE)
  }
)

Try the FuzzyAHP package in your browser

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

FuzzyAHP documentation built on Dec. 6, 2019, 5:10 p.m.