--- /dev/null
+#' @title Forecast
+#'
+#' @description Forecast encapsulation
+#'
+#' @field pred List with
+#' \itemize{
+#' \item serie: forecasted serie
+#' \item params: corresponding list of parameters (weights, neighbors...)
+#' \item index: corresponding index in data object
+#' }
+#'
+#' @exportClass Forecast
+#' @export Forecast
+Forecast = setRefClass(
+ Class = "Forecast",
+
+ fields = list(
+ pred = "list"
+ ),
+
+ methods = list(
+ initialize = function(...)
+ {
+ "Initialize empty Forecast object"
+
+ callSuper(...)
+ },
+ append = function(new_serie, new_params, new_index)
+ {
+ "Obtain a new pair (serie, params)"
+
+ pred[[length(pred)+1]] <<- list("serie"=new_serie, "params"=new_params, "index"=new_index)
+ },
+ getSize = function()
+ {
+ length(pred)
+ },
+ getSerie = function(index)
+ {
+ "Get serie values at specified index"
+
+ pred[[index]]$serie
+ },
+ getParams = function(index)
+ {
+ "Get params at specified index"
+
+ pred[[index]]$params
+ },
+ getIndexInData = function(index)
+ {
+ "Get (day) index in data where prediction took place"
+
+ pred[[index]]$index
+ }
+ )
+)