diff BiodbObject.R @ 6:f86fec07f392 draft default tip

planemo upload commit c397cd8a93953798d733fd62653f7098caac30ce
author prog
date Fri, 22 Feb 2019 16:04:22 -0500
parents fb9c0409d85c
children
line wrap: on
line diff
--- a/BiodbObject.R	Wed Apr 19 10:00:05 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-##########################
-# CLASS DECLARATION {{{1 #
-##########################
-
-BiodbObject <- methods::setRefClass("BiodbObject", fields = list( .observers = "ANY" ))
-
-########################
-# ABSTRACT METHOD {{{1 #
-########################
-
-BiodbObject$methods( .abstract.method = function() {
-
-	class <- class(.self)
-	method <- sys.call(length(sys.calls()) - 1)
-	method <- sub('^[^$]*\\$([^(]*)\\(.*$', '\\1()', method)
-
-	stop(paste("Method", method, "is not implemented in", class, "class."))
-})
-
-######################
-# ADD OBSERVERS {{{1 #
-######################
-
-BiodbObject$methods( addObservers = function(obs) {
-
-	# Check types of observers
-	if ( ( ! is.list(obs) && ! inherits(obs, "BiodbObserver")) || (is.list(obs) && any( ! vapply(obs, function(o) inherits(o, "BiodbObserver"), FUN.VALUE = TRUE))))
-		stop("Observers must inherit from BiodbObserver class.")
-
-	# Add observers to current list
-	.observers <<- if (is.null(.self$.observers)) c(obs) else c(.self$.observers, obs)
-})