[Stacomir-commits] r321 - pkg/stacomir/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 18 21:55:38 CET 2017


Author: briand
Date: 2017-03-18 21:55:38 +0100 (Sat, 18 Mar 2017)
New Revision: 321

Modified:
   pkg/stacomir/R/BilanConditionEnv.r
Log:
Halfway developped class connect choice charge method working

Modified: pkg/stacomir/R/BilanConditionEnv.r
===================================================================
--- pkg/stacomir/R/BilanConditionEnv.r	2017-03-18 20:55:08 UTC (rev 320)
+++ pkg/stacomir/R/BilanConditionEnv.r	2017-03-18 20:55:38 UTC (rev 321)
@@ -1,3 +1,4 @@
+#TODO add link to example in Roxygen, develop plot and summary methods
 #' class BilanConditionEnv simple output of one or several environmental
 #' conditions...
 #' 
@@ -24,14 +25,15 @@
 #' @keywords classes
 #' @export 
 setClass(Class="BilanConditionEnv",
-		representation=representation(
-				horodate="RefHorodate",
+		representation=representation(			
 				stationMesure="RefStationMesure",
-				data="data.frame",
-				datedebut="POSIXt",
-				datefin="POSIXt"),
+				horodatedebut="RefHorodate",
+				horodatefin="RefHorodate",
+				data="data.frame"
+				),
 		prototype=prototype(
-				horodate=new("RefHorodate"),
+				horodatedebut=new("RefHorodate"),
+				horodatefin=new("RefHorodate"),
 				stationMesure=new("RefStationMesure"),
 				data=data.frame())
 )
@@ -39,17 +41,15 @@
 
 #' connect method for BilanConditionEnv class
 #' @param object An object of class \link{BilanConditionEnv-class}
-#' @param h A handler
 #' @return an object of BilanConditionEnv class
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}
 #' @export
-setMethod("connect",signature=signature("BilanConditionEnv"),
-		definition=function(object,h) {
-			#  construit une requete ODBCwheredate
+setMethod("connect",signature=signature("BilanConditionEnv"),definition=function(object) {
+			#object<-bil_CE
 			requete=new("RequeteODBCwheredate")
 			requete at baseODBC<-get("baseODBC",envir=envir_stacomi)
-			requete at datedebut=strptime(object at datedebut,format="%Y-%m-%d")
-			requete at datefin=strptime(object at datefin,format="%Y-%m-%d")
+			requete at datedebut=strptime(object at horodatedebut@horodate,format="%Y-%m-%d")
+			requete at datefin=strptime(object at horodatefin@horodate,format="%Y-%m-%d")
 			requete at colonnedebut="env_date_debut"
 			requete at colonnefin="env_date_fin"
 			requete at select=paste("SELECT", 
@@ -88,12 +88,12 @@
 			bil_CE at stationMesure=charge(bil_CE at stationMesure)
 			# loads and verifies the stationmesure (selects the relevant lines in the table
 			bil_CE at stationMesure<-choice_c(object=bil_CE at stationMesure,stationMesure)
-			bil_CE at horodate<-choice_c(object=bil_CE at horodate,
+			bil_CE at horodatedebut<-choice_c(object=bil_CE at horodatedebut,
 					nomassign="bilanConditionEnv_date_debut",
 					funoutlabel=gettext("Beginning date has been chosen\n",domain="R-stacomiR"),
 					horodate=datedebut, 
 					silent=silent)
-			bil_CE at horodate<-choice_c(bil_CE at horodate,
+			bil_CE at horodatefin<-choice_c(bil_CE at horodatefin,
 					nomassign="bilanConditionEnv_date_fin",
 					funoutlabel=gettext("Ending date has been chosen\n",domain="R-stacomiR"),
 					horodate=datefin,
@@ -114,13 +114,13 @@
 			}     
 			
 			if (exists("bilanConditionEnv_date_debut",envir_stacomi)) {
-				object at datedebut<-get("bilanConditionEnv_date_debut",envir_stacomi)@horodate
+				object at horodatedebut@horodate<-get("bilanConditionEnv_date_debut",envir_stacomi)
 			} else {
 				funout(gettext("You need to choose the starting date\n",domain="R-stacomiR"),arret=TRUE)
 			}
 			
 			if (exists("bilanConditionEnv_date_fin",envir_stacomi))  {
-				object at datefin<-get("bilanConditionEnv_date_fin",envir_stacomi)@horodate
+				object at horodatefin@horodate<-get("bilanConditionEnv_date_fin",envir_stacomi)
 			}else {
 				funout(gettext("You need to choose the ending date\n",domain="R-stacomiR"),arret=TRUE)
 			}      		
@@ -129,7 +129,8 @@
 		})
 
 
-#' hbilanConditionEnvgraph function called by handler which displays a graphe if environmental conditons are in the database during the selected period
+#' hbilanConditionEnvgraph function called by handler which displays a graphe 
+#' if environmental conditons are in the database during the selected period
 #' @param h a handler
 #' @param ... Additional parameters
 #' @author Cedric Briand \email{cedric.briand"at"eptb-vilaine.fr}



More information about the Stacomir-commits mailing list