R/AllGeneric.R

################################
##
## All generic methods
##
################################
# Time series generic
if(!isGeneric("duration")){
  setGeneric("duration")
}
setMethod(duration, signature=c("TimeSeries"), 
          definition=function(object) {
            return(object@times[length(times)] -object@times[1])
          }
)
###############################
# Periodogram generic 
if(!isGeneric("getExtrema")){
setGeneric("getExtrema", 
           function(x, ...) standardGeneric("getExtrema"))
}
if(!isGeneric("frequencies")){
setGeneric("frequencies", 
           function(x, ...) standardGeneric("frequencies"))
}
if(!isGeneric("amplitudes")){
setGeneric("amplitudes", 
           function(x, ...) standardGeneric("amplitudes"))
}
###############################
# Period method generic 
setMethod("show", "PeriodMethod",
          function(object) { 
            cat("Periodogram computation of ")
            str(object)
          })
setGeneric("isWeighted")
setMethod(isWeighted, signature=c("PeriodMethod"), 
          definition=function(object) {
            return(object@weighted)
          })

# Create a new generic solve method with no default method
if(!isGeneric("solve")){
  setGeneric(name="solve", signature="object",
             # No default method for solve 
             def=function(object, ...) {
               standardGeneric("solve")
             }
  )}
leannep/rperiodogram documentation built on May 21, 2017, 10:34 a.m.