"validMBparams" <- function(object) { if(is.null(object@N) || is.na(object@N) || (object@N < 0) || (object@N != as.integer(object@N))) paste("@N must be a positive integer",sep="") else if(is.null(object@m) || is.na(object@m) || (object@m < 0) || (object@m != as.integer(object@m))) paste("@m must be a positive integer",sep="") else if(!all(c(length(object@Names),ncol(object@Values),length(object@Sim)) %in% object@m)) paste("Incompatible dimensions of some attributes (must all match @m)",sep="") else if((nrow(object@Values) != 2) || !is.numeric(object@Values)) paste("@Values must have 2 rows and be numeric",sep="") else if(length(object@Sim) > 0) { is.ok.type <- is.ok.dim <- TRUE for(i in 1:length(object@Sim)) { if(!is.matrix.csr(object@Sim[[i]]) && (!is.matrix(object@Sim[[i]]) || !is.numeric(object@Sim[[i]]))) { is.ok.type <- FALSE break } if(!all(dim(object@Sim[[i]]) == object@N)) { is.ok.dim <- FALSE break } } if(!is.ok.dim) paste("Incompatible dimensions of some attributes (must all match @N)",sep="") else if(!is.ok.type) paste("Similarities must be composed of some type of numeric matrix",sep="") else TRUE } else if(object@N > 0) paste("@N cannot be > 0 if no parameters have been added",sep="") else TRUE }