on the way to R6 class + remove truncated days (simplifications)
[talweg.git] / pkg / R / Data.R
index d4609f2..4e16805 100644 (file)
@@ -1,30 +1,27 @@
-#' @title Data
+#' Data
 #'
-#' @description Data encapsulation
+#' Data encapsulation
 #'
 #' @field data List of
 #' \itemize{
 #'   \item time: vector of times
 #'   \item serie: centered series
 #'   \item level: corresponding levels
+#'   \item exo: exogenous variables
 #'   \item exo_hat: predicted exogenous variables
-#'   \item exo_Dm1: List of measured exogenous variables at day minus 1
 #' }
 #'
-#' @exportClass Data
-#' @export Data
-Data = setRefClass(
-       Class = "Data",
-
-       fields = list(
-               data = "list"
-       ),
-
-       methods = list(
+#' @docType class
+#' @importFrom R6 R6Class
+#'
+#' @export
+Data = R6Class("Data",
+       public = list(
+               data = "list",
                initialize = function(...)
                {
                        "Initialize empty Data object"
-
+#TODO: continue from here
                        callSuper(...)
                },
                getSize = function()
@@ -37,12 +34,7 @@ Data = setRefClass(
                {
                        "'Standard' horizon, from t+1 to midnight"
 
-                       L1 = length(data[[1]]$serie)
-                       L2 = length(data[[2]]$serie)
-                       if (L1 < L2)
-                               L2 - L1
-                       else
-                               L1
+                       24 - as.POSIXlt( data[[1]]$time[1] )$hour + 1
                },
                append = function(new_time, new_serie, new_level, new_exo_hat, new_exo)
                {