From 35eb1443d0ae161c730e371e08e576754ec0084d Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Sat, 25 Feb 2017 14:40:25 +0100
Subject: [PATCH] 'update'

---
 pkg/R/Data.R | 44 ++++++++++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/pkg/R/Data.R b/pkg/R/Data.R
index 4e16805..18c67dd 100644
--- a/pkg/R/Data.R
+++ b/pkg/R/Data.R
@@ -16,29 +16,21 @@
 #'
 #' @export
 Data = R6Class("Data",
+	private = list(
+		.data = "list"
+	),
 	public = list(
-		data = "list",
 		initialize = function(...)
-		{
-			"Initialize empty Data object"
-#TODO: continue from here
-			callSuper(...)
-		},
+			initialize(self, private, ...)
+		,
 		getSize = function()
-		{
-			"Number of series in the dataset"
-
-			length(data)
-		},
+			getSize()
+		,
 		getStdHorizon = function()
-		{
-			"'Standard' horizon, from t+1 to midnight"
-
-			24 - as.POSIXlt( data[[1]]$time[1] )$hour + 1
-		},
+			getStdHorizon(self, private)
+		,
 		append = function(new_time, new_serie, new_level, new_exo_hat, new_exo)
-		{
-			"Acquire a new vector of lists (time, serie, level, exo_hat, exo)"
+			append(self, private, 
 
 			data[[length(data)+1]] <<- list("time"=new_time,"serie"=new_serie,"level"=new_level,
 				"exo_hat"=new_exo_hat,"exo"=new_exo)
@@ -87,3 +79,19 @@ Data = R6Class("Data",
 		}
 	)
 )
+
+#' Initialize empty Data object
+initialize = function(self, private, ...)
+{
+	invisible(self)
+}
+
+#' Number of series in the dataset
+getSize = function(self, private)
+	length(private$.data)
+
+#' 'Standard' horizon, from t+1 to midnight
+getStdHorizon = function(self, private)
+	24 - as.POSIXlt( private$.data[[1]]$time[1] )$hour + 1
+
+#' Acquire a new vector of lists (time, centered_serie, level, exo, exo_hat)
-- 
2.44.0