[Ruler-commits] r29 - in pkg: . ruleR ruleR/.Rd2pdf2384 ruleR/.Rd2pdf2544 ruleR/.Rd2pdf2920 ruleR/.Rd2pdf3212 ruleR/.Rd2pdf4040 ruleR/R ruleR/man ruleR/man/.Rd2pdf2296 ruleR/man/.Rd2pdf4676 ruleR/man/.Rd2pdf5040

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 1 18:29:34 CEST 2012


Author: merysionek
Date: 2012-08-01 18:29:33 +0200 (Wed, 01 Aug 2012)
New Revision: 29

Added:
   pkg/ruleR/.Rd2pdf2384/
   pkg/ruleR/.Rd2pdf2384/Rd2.tex
   pkg/ruleR/.Rd2pdf2544/
   pkg/ruleR/.Rd2pdf2544/Rd2.tex
   pkg/ruleR/.Rd2pdf2920/
   pkg/ruleR/.Rd2pdf2920/Rd2.tex
   pkg/ruleR/.Rd2pdf3212/
   pkg/ruleR/.Rd2pdf3212/Rd2.tex
   pkg/ruleR/.Rd2pdf4040/
   pkg/ruleR/.Rd2pdf4040/Rd2.tex
   pkg/ruleR/man/.Rd2pdf2296/
   pkg/ruleR/man/.Rd2pdf2296/Rd2.tex
   pkg/ruleR/man/.Rd2pdf3052/
   pkg/ruleR/man/.Rd2pdf4676/
   pkg/ruleR/man/.Rd2pdf4676/Rd2.tex
   pkg/ruleR/man/.Rd2pdf5040/
   pkg/ruleR/man/.Rd2pdf5040/Rd2.tex
   pkg/ruleR/man/check.pdf
   pkg/ruleR/man/conCheck.pdf
Modified:
   pkg/New.R
   pkg/ruleR/R/ruleR.R
   pkg/ruleR/man/AddConstSingleRule-class.Rd
   pkg/ruleR/man/AddDoubleRule-class.Rd
   pkg/ruleR/man/AddRule.Rd
   pkg/ruleR/man/automaticTest.Rd
   pkg/ruleR/man/calculate-methods.Rd
   pkg/ruleR/man/calculate.Rd
   pkg/ruleR/man/calculateSpecific-methods.Rd
   pkg/ruleR/man/calculateSpecific.Rd
   pkg/ruleR/man/check.Rd
   pkg/ruleR/man/conCheck.Rd
   pkg/ruleR/man/createDR.Rd
Log:
.

Modified: pkg/New.R
===================================================================
--- pkg/New.R	2012-08-01 15:30:48 UTC (rev 28)
+++ pkg/New.R	2012-08-01 16:29:33 UTC (rev 29)
@@ -314,7 +314,7 @@
       
       if("constantVal"%in%slotNames(singleRules[[a1]])){m<-new(singleRules[[a1]],constantVal=cv1)} else{m<-new(singleRules[[a1]])}
       
-      if(n!=0) {createSR(p[[1]],p[[2]],n-1,p[-c(1,2)]); m at previousRule<-k
+      if(n!=0) {k<-createSR(p[[1]],p[[2]],n-1,p[-c(1,2)]); m at previousRule<-k
       }else{return(m)}
   
       return(m)                                                     
@@ -329,26 +329,27 @@
 #'sr' secondRule argument of an object of class doubleRule
 #'ns' nextSingle argument of an object of class doubleRule
 #'
+
 createDR<-function(a=NULL,fr=NULL,sr=NULL,ns=NULL){
-                              if(!is.null(a) && a>length(doubleRules)) stop (paste("The list of doublrRules is shoreter than ",a, ".Please specify 'a' value, which is smaller than or equal to",length(doubleRules)))
-                              if(!inherits(fr,"singleRule") && !is.null(fr))stop(paste("'fr' argument must inherit from class singleRule"))
-                              if(!inherits(sr,"singleRule") && !is.null(sr))stop(paste("'sr' argument must inherit from class singleRule"))
-                              if(!inherits(ns,"singleRule") && !is.null(ns))stop(paste("'ns' argument must inherit from class singleRule"))
-                              
-                              if(is.null(a)) a<-sample(1:length(doubleRules),1) #generate an index of a doubleRule from the list of doubleRules
-                              a<-doubleRules[[a]]
-                              #print(a)
-                              
-                              if(is.null(fr)) fr<-sample(c(k=createSR(),k=new("IdenSingleRule")),1,prob=c(0.5,0.5))# firstRule is chosen from an automatically generated SingleRule or identical rule returning the input
-                                                            
-                              if(is.null(sr)) sr<-sample(c(k=createSR(),k=new("IdenSingleRule")),1,prob=c(0.3,0.7)) #because adding more and more rules makes the rule very difficult I would generate identical function with greater probability
-                              
-                              if(is.null(ns)) ns<-sample(c(k=createSR(),k=new("IdenSingleRule")),1,prob=c(0.3,0.7))
-                                                           
-                              p<-new(a,firstRule=fr$k, secondRule=sr$k,nextSingle=ns$k)
-                              return(p)
-                              
-                                                        }
+  if(!is.null(a) && a>length(doubleRules)) stop (paste("The list of doublrRules is shoreter than ",a, ".Please specify 'a' value, which is smaller than or equal to",length(doubleRules)))
+  if(!inherits(fr,"SingleRule") && !is.null(fr))stop(paste("'fr' argument must inherit from class singleRule"))
+  if(!inherits(sr,"SingleRule") && !is.null(sr))stop(paste("'sr' argument must inherit from class singleRule"))
+  if(!inherits(ns,"SingleRule") && !is.null(ns))stop(paste("'ns' argument must inherit from class singleRule"))
+  
+  if(is.null(a)) a<-sample(1:length(doubleRules),1) #generate an index of a doubleRule from the list of doubleRules
+  a<-doubleRules[[a]]
+  
+  if(is.null(fr)) fr<-sample(c(createSR(),new("IdenSingleRule")),1,prob=c(0.5,0.5))[[1]]# firstRule is chosen from an automatically generated SingleRule or identical rule returning the input
+  
+  if(is.null(sr)) sr<-sample(c(createSR(),new("IdenSingleRule")),1,prob=c(0.3,0.7))[[1]] #because adding more and more rules makes the rule very difficult I would generate identical function with greater probability
+  
+  if(is.null(ns)) ns<-sample(c(createSR(),new("IdenSingleRule")),1,prob=c(0.3,0.7))[[1]]
+  
+  p<-new(a,firstRule=fr, secondRule=sr,nextSingle=ns)
+  
+  return(p)
+  
+}
  
  
 #A FUNCTION TO GENERATE NUMERIC SEQUENCE OF DECLARED LENGTH
@@ -426,11 +427,12 @@
                       {z<-sample(2:length(MyRules),1); rule<-MyRules[[z]]  }# if m=1 create singleRule else create doubleRulr
   
         result<-sequence(x1,x2,rule,n=seqlen)[[1]]
+        print(result)
         
         fun<-sequence(x1,x2,rule,n=seqlen)[[2]]
        
           
-        if(conCheck(result)==0 || result[length(result)]>1000 || result[length(result)]< -1000||duplicate(mx=items,vec=unlist(result[[1]])))
+        if(conCheck(result)==0 ||is.na(result[length(result)])|| result[length(result)]>1000 || result[length(result)]< -1000||duplicate(mx=items,vec=unlist(result[[1]])))
            {check(seqlen,items,type)} else{return(list(result,fun))}
   
                   }

Added: pkg/ruleR/.Rd2pdf2384/Rd2.tex
===================================================================
--- pkg/ruleR/.Rd2pdf2384/Rd2.tex	                        (rev 0)
+++ pkg/ruleR/.Rd2pdf2384/Rd2.tex	2012-08-01 16:29:33 UTC (rev 29)
@@ -0,0 +1,12 @@
+\documentclass[a4paper]{book}
+\usepackage[times,inconsolata,hyper]{Rd}
+\usepackage{makeidx}
+\usepackage[latin1]{inputenc} % @SET ENCODING@
+% \usepackage{graphicx} % @USE GRAPHICX@
+\makeindex{}
+\begin{document}
+\chapter*{}
+\begin{center}
+{\textbf{\huge \R{} documentation}} \par\bigskip{{\Large of \file{AddConstSingleRule-class.Rd}}}
+\par\bigskip{\large \today}
+\end{center}

Added: pkg/ruleR/.Rd2pdf2544/Rd2.tex
===================================================================
--- pkg/ruleR/.Rd2pdf2544/Rd2.tex	                        (rev 0)
+++ pkg/ruleR/.Rd2pdf2544/Rd2.tex	2012-08-01 16:29:33 UTC (rev 29)
@@ -0,0 +1,12 @@
+\documentclass[a4paper]{book}
+\usepackage[times,inconsolata,hyper]{Rd}
+\usepackage{makeidx}
+\usepackage[latin1]{inputenc} % @SET ENCODING@
+% \usepackage{graphicx} % @USE GRAPHICX@
+\makeindex{}
+\begin{document}
+\chapter*{}
+\begin{center}
+{\textbf{\huge \R{} documentation}} \par\bigskip{{\Large of \file{help}}}
+\par\bigskip{\large \today}
+\end{center}

Added: pkg/ruleR/.Rd2pdf2920/Rd2.tex
===================================================================
--- pkg/ruleR/.Rd2pdf2920/Rd2.tex	                        (rev 0)
+++ pkg/ruleR/.Rd2pdf2920/Rd2.tex	2012-08-01 16:29:33 UTC (rev 29)
@@ -0,0 +1,12 @@
+\documentclass[a4paper]{book}
+\usepackage[times,inconsolata,hyper]{Rd}
+\usepackage{makeidx}
+\usepackage[latin1]{inputenc} % @SET ENCODING@
+% \usepackage{graphicx} % @USE GRAPHICX@
+\makeindex{}
+\begin{document}
+\chapter*{}
+\begin{center}
+{\textbf{\huge \R{} documentation}} \par\bigskip{{\Large of \file{AddConstSingleRule-class.Rd}}}
+\par\bigskip{\large \today}
+\end{center}

Added: pkg/ruleR/.Rd2pdf3212/Rd2.tex
===================================================================
--- pkg/ruleR/.Rd2pdf3212/Rd2.tex	                        (rev 0)
+++ pkg/ruleR/.Rd2pdf3212/Rd2.tex	2012-08-01 16:29:33 UTC (rev 29)
@@ -0,0 +1,12 @@
+\documentclass[a4paper]{book}
+\usepackage[times,inconsolata,hyper]{Rd}
+\usepackage{makeidx}
+\usepackage[latin1]{inputenc} % @SET ENCODING@
+% \usepackage{graphicx} % @USE GRAPHICX@
+\makeindex{}
+\begin{document}
+\chapter*{}
+\begin{center}
+{\textbf{\huge \R{} documentation}} \par\bigskip{{\Large of \file{digits.Rd}}}
+\par\bigskip{\large \today}
+\end{center}

Added: pkg/ruleR/.Rd2pdf4040/Rd2.tex
===================================================================
--- pkg/ruleR/.Rd2pdf4040/Rd2.tex	                        (rev 0)
+++ pkg/ruleR/.Rd2pdf4040/Rd2.tex	2012-08-01 16:29:33 UTC (rev 29)
@@ -0,0 +1,12 @@
+\documentclass[a4paper]{book}
+\usepackage[times,inconsolata,hyper]{Rd}
+\usepackage{makeidx}
+\usepackage[latin1]{inputenc} % @SET ENCODING@
+% \usepackage{graphicx} % @USE GRAPHICX@
+\makeindex{}
+\begin{document}
+\chapter*{}
+\begin{center}
+{\textbf{\huge \R{} documentation}} \par\bigskip{{\Large of \file{AddConstSingleRule-class}}}
+\par\bigskip{\large \today}
+\end{center}

Modified: pkg/ruleR/R/ruleR.R
===================================================================
--- pkg/ruleR/R/ruleR.R	2012-08-01 15:30:48 UTC (rev 28)
+++ pkg/ruleR/R/ruleR.R	2012-08-01 16:29:33 UTC (rev 29)
@@ -192,9 +192,7 @@
 
 #EXECUTING RULES OPERATING ON TWO ARGUMENTS
 
-#calculate <- function(x,y,z){stop ("No function to execute this.")} #throw a mistake, because you should execute just single functions contained by cladd DoubleRule
 
-
 setMethod("calculate",signature(x="DoubleRule", y="numeric", z="numeric"),
           function(x, y, z){
             firstArg <- y #first element of the sequence
@@ -252,17 +250,23 @@
                      p<-as.vector(matrix(replicate(n,c(sample(1:length(singleRules),1),sample(1:100,1))),1,2*n))
                      } # generate 'n' if it is set as null with different probabilities
       
+      print(paste("a1",a1))
+      print(paste("cv1",cv1))
+      print(paste("n",n))
+      print(p)
+      print("------------------")
       
       if("constantVal"%in%slotNames(singleRules[[a1]])){m<-new(singleRules[[a1]],constantVal=cv1)} else{m<-new(singleRules[[a1]])}
       
-      if(n!=0) {createSR(p[[1]],p[[2]],n-1,p[-c(1,2)]); m at previousRule<-k
+      
+      if(n+1!=0) {k<-createSR(p[[1]],p[[2]],n-1,p[-c(1,2)]); m at previousRule<-k
       }else{return(m)}
   
       return(m)                                                     
                                                 }
 
+m<-createSR(a1=2,cv1=2,n=3,3,3,4,4,5,5)
 
-
 # A FUNCTION TO COMBINE DOUBLE RULES - it generates all parameters automatically 
 
 # 'a' is index from a list of DoubleRules
@@ -271,25 +275,25 @@
 #'ns' nextSingle argument of an object of class doubleRule
 #'
 createDR<-function(a=NULL,fr=NULL,sr=NULL,ns=NULL){
-                              if(!is.null(a) && a>length(doubleRules)) stop (paste("The list of doublrRules is shoreter than ",a, ".Please specify 'a' value, which is smaller than or equal to",length(doubleRules)))
-                              if(!inherits(fr,"singleRule") && !is.null(fr))stop(paste("'fr' argument must inherit from class singleRule"))
-                              if(!inherits(sr,"singleRule") && !is.null(sr))stop(paste("'sr' argument must inherit from class singleRule"))
-                              if(!inherits(ns,"singleRule") && !is.null(ns))stop(paste("'ns' argument must inherit from class singleRule"))
-                              
-                              if(is.null(a)) a<-sample(1:length(doubleRules),1) #generate an index of a doubleRule from the list of doubleRules
-                              a<-doubleRules[[a]]
-                              #print(a)
-                              
-                              if(is.null(fr)) fr<-sample(c(k=createSR(),k=new("IdenSingleRule")),1,prob=c(0.5,0.5))# firstRule is chosen from an automatically generated SingleRule or identical rule returning the input
+                    if(!is.null(a) && a>length(doubleRules)) stop (paste("The list of doublrRules is shoreter than ",a, ".Please specify 'a' value, which is smaller than or equal to",length(doubleRules)))
+                    if(!inherits(fr,"SingleRule") && !is.null(fr))stop(paste("'fr' argument must inherit from class singleRule"))
+                    if(!inherits(sr,"SingleRule") && !is.null(sr))stop(paste("'sr' argument must inherit from class singleRule"))
+                    if(!inherits(ns,"SingleRule") && !is.null(ns))stop(paste("'ns' argument must inherit from class singleRule"))
+       
+                    if(is.null(a)) a<-sample(1:length(doubleRules),1) #generate an index of a doubleRule from the list of doubleRules
+                    a<-doubleRules[[a]]
+                                       
+                    if(is.null(fr)) fr<-sample(c(createSR(),new("IdenSingleRule")),1,prob=c(0.5,0.5))[[1]]# firstRule is chosen from an automatically generated SingleRule or identical rule returning the input
                                                             
-                              if(is.null(sr)) sr<-sample(c(k=createSR(),k=new("IdenSingleRule")),1,prob=c(0.3,0.7)) #because adding more and more rules makes the rule very difficult I would generate identical function with greater probability
+                    if(is.null(sr)) sr<-sample(c(createSR(),new("IdenSingleRule")),1,prob=c(0.3,0.7))[[1]] #because adding more and more rules makes the rule very difficult I would generate identical function with greater probability
                               
-                              if(is.null(ns)) ns<-sample(c(k=createSR(),k=new("IdenSingleRule")),1,prob=c(0.3,0.7))
+                    if(is.null(ns)) ns<-sample(c(createSR(),new("IdenSingleRule")),1,prob=c(0.3,0.7))[[1]]
                                                            
-                              p<-new(a,firstRule=fr$k, secondRule=sr$k,nextSingle=ns$k)
-                              return(p)
+                    p<-new(a,firstRule=fr, secondRule=sr,nextSingle=ns)
+                    
+                    return(p)
                               
-                                                        }
+                                                  }
  
  
 #A FUNCTION TO GENERATE NUMERIC SEQUENCE OF DECLARED LENGTH
@@ -371,8 +375,8 @@
         fun<-sequence(x1,x2,rule,n=seqlen)[[2]]
        
           
-        if(conCheck(result)==0 || result[length(result)]>1000 || result[length(result)]< -1000||duplicate(mx=items,vec=unlist(result[[1]])))
-           {check(seqlen,items,type)} else{return(list(result,fun))}
+        if(conCheck(result)==0 ||is.na(result[length(result)])|| result[length(result)]>1000 || result[length(result)]< -1000||duplicate(mx=items,vec=unlist(result[[1]])))
+           {check(seqlen,items,type)} else{return(list(result=result,fun=fun))}
   
                   }
 

Added: pkg/ruleR/man/.Rd2pdf2296/Rd2.tex
===================================================================
--- pkg/ruleR/man/.Rd2pdf2296/Rd2.tex	                        (rev 0)
+++ pkg/ruleR/man/.Rd2pdf2296/Rd2.tex	2012-08-01 16:29:33 UTC (rev 29)
@@ -0,0 +1,12 @@
+\documentclass[a4paper]{book}
+\usepackage[times,inconsolata,hyper]{Rd}
+\usepackage{makeidx}
+\usepackage[latin1]{inputenc} % @SET ENCODING@
+% \usepackage{graphicx} % @USE GRAPHICX@
+\makeindex{}
+\begin{document}
+\chapter*{}
+\begin{center}
+{\textbf{\huge \R{} documentation}} \par\bigskip{{\Large of \file{calculateSpecific.Rd}}}
+\par\bigskip{\large \today}
+\end{center}

Added: pkg/ruleR/man/.Rd2pdf4676/Rd2.tex
===================================================================
--- pkg/ruleR/man/.Rd2pdf4676/Rd2.tex	                        (rev 0)
+++ pkg/ruleR/man/.Rd2pdf4676/Rd2.tex	2012-08-01 16:29:33 UTC (rev 29)
@@ -0,0 +1,12 @@
+\documentclass[a4paper]{book}
+\usepackage[times,inconsolata,hyper]{Rd}
+\usepackage{makeidx}
+\usepackage[latin1]{inputenc} % @SET ENCODING@
+% \usepackage{graphicx} % @USE GRAPHICX@
+\makeindex{}
+\begin{document}
+\chapter*{}
+\begin{center}
+{\textbf{\huge \R{} documentation}} \par\bigskip{{\Large of \file{calculateSpecyfic-methods.Rd}}}
+\par\bigskip{\large \today}
+\end{center}

Added: pkg/ruleR/man/.Rd2pdf5040/Rd2.tex
===================================================================
--- pkg/ruleR/man/.Rd2pdf5040/Rd2.tex	                        (rev 0)
+++ pkg/ruleR/man/.Rd2pdf5040/Rd2.tex	2012-08-01 16:29:33 UTC (rev 29)
@@ -0,0 +1,12 @@
+\documentclass[a4paper]{book}
+\usepackage[times,inconsolata,hyper]{Rd}
+\usepackage{makeidx}
+\usepackage[latin1]{inputenc} % @SET ENCODING@
+% \usepackage{graphicx} % @USE GRAPHICX@
+\makeindex{}
+\begin{document}
+\chapter*{}
+\begin{center}
+{\textbf{\huge \R{} documentation}} \par\bigskip{{\Large of \file{calculateSpecific.Rd}}}
+\par\bigskip{\large \today}
+\end{center}

Modified: pkg/ruleR/man/AddConstSingleRule-class.Rd
===================================================================
--- pkg/ruleR/man/AddConstSingleRule-class.Rd	2012-08-01 15:30:48 UTC (rev 28)
+++ pkg/ruleR/man/AddConstSingleRule-class.Rd	2012-08-01 16:29:33 UTC (rev 29)
@@ -6,17 +6,17 @@
 
 \title{Class \code{"AddConstSingleRule"}}
 \description{
- A class for rule adding a constant value to the previous element of numeric sequence
+ A class for rules which add a constant value to the previous element of numeric sequence.
 }
 \section{Objects from the Class}{
-Objects can be created by calls of the form \code{new("AddConstSingleRule", ...)}.
+Objects can be created by calls of the form \code{new("AddConstSingleRule", constantVal)}.
 %%  ~~ describe objects here ~~ 
 }
 \section{Slots}{
   \describe{
-    \item{\code{constantVal}:}{Object of class \code{"numeric"} ~~ }
-    \item{\code{previousRule}:}{Object of class \code{"SingleRule"} ~~ }
-    \item{\code{.S3Class}:}{Object of class \code{"character"} ~~ }
+    \item{\code{constantVal}:}{Object of class \code{"numeric"} - a constant that will be added to the previous element of numeric sequence }
+    \item{\code{previousRule}:}{Object of class \code{"SingleRule"} -  a rule that will be executed before AddConstSingleRule (this is an argument used to combine different rules together)}
+    \item{\code{.S3Class}:}{Object of class \code{"character"} -  S3 methods apply to this object }
   }
 }
 \section{Extends}{
@@ -40,10 +40,36 @@
 %% ~Make other sections like Warning with \section{Warning }{....} ~
 
 \seealso{
-%%  ~~objects to See Also as \code{\link{~~fun~~}}, ~~~
-%%  ~~or \code{\linkS4class{CLASSNAME}} for links to other classes ~~~
+\code{\link{calculate}}, a functions to execute the rule
+\code{\linkS4class{SingleRule}}
 }
 \examples{
-showClass("AddConstSingleRule")
+##[1]A rule that adds 4 to the previous element of numeric sequence
+
+m<-new("AddConstSingleRule",constantVal=4) 
+calculate(m,16) #16+4=20
+
+
+
+
+##[2]combining rules
+
+p<-new("DigSumSingleRule") 
+# a rule that calculates digitsum of a given element
+
+m<-new("AddConstSingleRule",constantVal=5, previousRule=p)
+
+calculate(m,40) #9
+
+## How is rule 'g' executed ?
+## rule 'p' (previousRule) is executed on element 40 (4+0=4)
+## rule 'm' is executed on the result of previousRule (4+5=9)
+
+## You can combine many different rules i.e. rule 'm' can be a 
+## previousRule argument of another rule etc.
+
+
+
 }
 \keyword{classes}
+\keyword{AddConstSingleRule}

Modified: pkg/ruleR/man/AddDoubleRule-class.Rd
===================================================================
--- pkg/ruleR/man/AddDoubleRule-class.Rd	2012-08-01 15:30:48 UTC (rev 28)
+++ pkg/ruleR/man/AddDoubleRule-class.Rd	2012-08-01 16:29:33 UTC (rev 29)
@@ -6,18 +6,18 @@
 
 \title{Class \code{"AddDoubleRule"}}
 \description{
-%%  ~~ A concise (1-5 lines) description of what the class is. ~~
+ A class for rule which adds two prevous elements of numeric sequence.
 }
 \section{Objects from the Class}{
-Objects can be created by calls of the form \code{new("AddDoubleRule", ...)}.
+Objects can be created by calls of the form \code{new("AddDoubleRule",... )}.
 %%  ~~ describe objects here ~~ 
 }
 \section{Slots}{
   \describe{
-    \item{\code{firstRule}:}{Object of class \code{"SingleRule"} ~~ }
-    \item{\code{secondRule}:}{Object of class \code{"SingleRule"} ~~ }
-    \item{\code{nextSingle}:}{Object of class \code{"SingleRule"} ~~ }
-    \item{\code{.S3Class}:}{Object of class \code{"character"} ~~ }
+    \item{\code{firstRule}:}{Object of class \code{"SingleRule"} - a rule to be executed on the first element of numeric sequence, before executing DoubleRule (doesn't need to be specyfied)}
+    \item{\code{secondRule}:}{Object of class \code{"SingleRule"} - a rule to be executed on the second element of numeric sequence, before executing DoubleRule (doesn't need to be specyfied) }
+    \item{\code{nextSingle}:}{Object of class \code{"SingleRule"} - a rule to be executed on the result of DoubleRule (doesn't need to be specyfied) }
+    \item{\code{.S3Class}:}{Object of class \code{"character"}  - S3 methods apply for these objects }
   }
 }
 \section{Extends}{
@@ -41,10 +41,44 @@
 %% ~Make other sections like Warning with \section{Warning }{....} ~
 
 \seealso{
-%%  ~~objects to See Also as \code{\link{~~fun~~}}, ~~~
-%%  ~~or \code{\linkS4class{CLASSNAME}} for links to other classes ~~~
+\code{\link{calculate}}, 
+\code{\linkS4class{DoubleRule}},
+\code{\linkS4class{SingleRule}}
+
+
+
 }
 \examples{
-showClass("AddDoubleRule")
+
+#[1] simple DoubleRule
+
+p<-new("AddDoubleRule")
+calculate(p,12,5) #12+5=17
+
+
+
+#[2] combining rules
+
+m<-new("DigSumSingleRule") 
+# SingleRule that calculates digitsum of an element of numeric sequence
+
+r<-new("AddConstSingleRule", constantVal=6)
+#a SingleRule that adds constant value '6' to the element of numeric sequence 
+
+f<-new("MultConstSingleRule", constantVal=2)
+#a SingleRule that muliplies an element of a sequence by constant value '4'
+
+g<-new("AddDoubleRule", firstRule=r, secondRule=f, nextSingle=m)
+calculate(g,12,5) #10
+
+## How is rule 'g' executed ?
+## Starting elements are '12' and '5'
+## Rule 'r'(firstRule) is applied to the first element of numeric sequence (12+6=18)
+## Rule 'f'(secondRule) is applied to the second element of numeric sequence (5*2=10)
+## "AddDoubleRule" is executed on the results of firstRule and secondRule (18+10=28)
+## Rule 'm' is applies to the result of DoubleRule (2+8=10)
+
+
 }
 \keyword{classes}
+\keyword{AddDoubleRule}

Modified: pkg/ruleR/man/AddRule.Rd
===================================================================
--- pkg/ruleR/man/AddRule.Rd	2012-08-01 15:30:48 UTC (rev 28)
+++ pkg/ruleR/man/AddRule.Rd	2012-08-01 16:29:33 UTC (rev 29)
@@ -5,7 +5,11 @@
 %%  ~~function to do ... ~~
 }
 \description{
-%%  ~~ A concise (1-5 lines) description of what the function does. ~~
+
+When creating test items test rules can be either combined automatically or
+be generated from the set of rules defined by user (stored on \code{MyRule} list).
+\code{AddRule} is a function to add a rule defined by a user to \code{MyRule} list.
+
 }
 \usage{
 AddRule(rule)
@@ -13,7 +17,7 @@
 %- maybe also 'usage' for other objects documented here.
 \arguments{
   \item{rule}{
-%%     ~~Describe \code{rule} here~~
+ argument \code{rule} must inherit either form class \code{"SingleRule"} or \code{"DoubleRule"}.
 }
 }
 \details{
@@ -39,31 +43,24 @@
 %% ~Make other sections like Warning with \section{Warning }{....} ~
 
 \seealso{
-%% ~~objects to See Also as \code{\link{help}}, ~~~
+\code{\link{automaticTest}},
+\code{\link{MyRules}},
+\code{\link{automaticTest}}
+
 }
 \examples{
-##---- Should be DIRECTLY executable !! ----
-##-- ==>  Define data, use random,
-##--	or do  help(data=index)  for the standard data sets.
 
-## The function is currently defined as
-function (rule) 
-{
-    if (!inherits(rule, "SingleRule") && !inherits(rule, "DoubleRule")) 
-        stop(paste("new Rule must be an object of class 'SingleRule' od 'DoubleRule'. It cannot be of class", 
-            class(rule)))
-    s <- sequence(x1 = 10, x2 = 20, rule, n = 6)
-    if (duplicate(VerifTable, unlist(s[[1]])) == TRUE) {
-        stop("There already is a rule that gives the same result.")
-    }
-    else {
-        VerifTable <<- rbind(unlist(s[[1]]), VerifTable)
-        MyRules[length(MyRules) + 1] <<- rule
-        print("Your rule succesfully added tp 'MyRule' list")
-    }
-  }
+# 'MyRules' list by default consists only of one element, which is NA.
+
+
+# creating sample rules (this should be done by user)
+n<-new("SubsDoubleRule")
+p<-new("AddConstSingleRule", constantVal=6)
+
+AddRule(n) #"Your rule succesfully added tp 'MyRule' list"
+AddRule(p) #"Your rule succesfully added tp 'MyRule' list"
+AddRule(n)# Error in AddRule(n) : There already is a rule that gives the same result.
+
 }
-% Add one or more standard keywords, see file 'KEYWORDS' in the
-% R documentation directory.
-\keyword{ ~kwd1 }
-\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
+
+\keyword{AddRule}

Modified: pkg/ruleR/man/automaticTest.Rd
===================================================================
--- pkg/ruleR/man/automaticTest.Rd	2012-08-01 15:30:48 UTC (rev 28)
+++ pkg/ruleR/man/automaticTest.Rd	2012-08-01 16:29:33 UTC (rev 29)
@@ -5,7 +5,13 @@
 %%  ~~function to do ... ~~
 }
 \description{
-%%  ~~ A concise (1-5 lines) description of what the function does. ~~
+Function to generate desired amount of test items (numeric sequence of specyfied length).
+Items can be created using automatically combined rules, or using only the
+rules specyfied by the user (stored on \code{MyRules} list).
+Function /code{automaticTest}is also checking the uniqueness of generated sequences and prevents constat sequences
+to be generated.
+For every numeric sequence \code{automaticTest} returns the list of rules used to create it
+as well as 'noise' answers (in case muliple choice is needed in the test)
 }
 \usage{
 automaticTest(testlen, type = 1, seqlen = 6)
@@ -13,24 +19,27 @@
 %- maybe also 'usage' for other objects documented here.
 \arguments{
   \item{testlen}{
-%%     ~~Describe \code{testlen} here~~
+- how many numeric sequences (test items) are to be generated
 }
   \item{type}{
-%%     ~~Describe \code{type} here~~
+- which rules to be applied. \code{type=1} means that the rules are generated automatically,
+\code{type=2} means that ony rules defined by user (stored on \code{MyRules} list) should be used
+ to create a sequence. By default \code{type=1}.
 }
   \item{seqlen}{
-%%     ~~Describe \code{seqlen} here~~
+ - desired length of numeric sequence (by default \code{seqlen=6})
 }
 }
 \details{
 %%  ~~ If necessary, more details than the description above ~~
 }
 \value{
-%%  ~Describe the value returned
-%%  If it is a LIST, use
-%%  \item{comp1 }{Description of 'comp1'}
-%%  \item{comp2 }{Description of 'comp2'}
-%% ...
+\code{automaticTest} function returns a list containing the following:
+
+\item{$items}{generated numeric sequences (in case multiple answer format is needed in a test)}
+\item{$noise }{noise 'answers' }
+\item{$rules}{a list of rules used to generate numeric sequences}
+
 }
 \references{
 %% ~put references to the literature/web site here ~
@@ -48,29 +57,26 @@
 %% ~~objects to See Also as \code{\link{help}}, ~~~
 }
 \examples{
-##---- Should be DIRECTLY executable !! ----
-##-- ==>  Define data, use random,
-##--	or do  help(data=index)  for the standard data sets.
 
-## The function is currently defined as
-function (testlen, type = 1, seqlen = 6) 
-{
-    if (class(type) != "numeric") 
-        stop("argument 'type' must be of class 'numeric'")
-    items <- matrix(NA, testlen, seqlen)
-    rules <- list()
-    noise <- matrix(NA, testlen, 5)
-    for (i in 1:testlen) {
-        b <- check(seqlen, items, type)
-        items[i, ] <- unlist(b[[1]])
-        rules[i] <- b[2]
-        noise[i, ] <- sample(c((items[i, seqlen] - 6):(items[i, 
-            seqlen] + 6))[-(seqlen + 1)], 5)
-    }
-    return(list(items = items, noise = noise, rules = rules))
-  }
+#[1] everything generated automatically
+m<-automaticTest(10) # type=1, seqlen=6
+m$items # generated numeric sequences
+m$noise # sample noise answers
+m$rules # list of rules used to create items 
+
+
+#[2] items generated only with the rules supplied by user
+m<-new("AddConstSingleRule", constantVal=6) #single rule adding 6 to an element of sequence
+r<-new("AddConstSingleRule", constantVal=10)#single rule adding 10 to an element of sequence
+AddRule(m) #adding rule 'm' to 'MyRules' list
+AddRule(r) # adding rule 'r' to 'MyRules' list
+m<-automaticTest(10,type=2 # generating a test consisting of 10 items, with rules 'm' and 'r' only
+m$items # generated numeric sequences
+m$rules # list of rules used to create items
+m$noise # sample noise answers
+
 }
 % Add one or more standard keywords, see file 'KEYWORDS' in the
 % R documentation directory.
-\keyword{ ~kwd1 }
-\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
+\keyword{ automaticTest }
+

Modified: pkg/ruleR/man/calculate-methods.Rd
===================================================================
--- pkg/ruleR/man/calculate-methods.Rd	2012-08-01 15:30:48 UTC (rev 28)
+++ pkg/ruleR/man/calculate-methods.Rd	2012-08-01 16:29:33 UTC (rev 29)
@@ -5,7 +5,7 @@
 \alias{calculate,SingleRule,numeric,ANY-method}
 \title{ ~~ Methods for Function \code{calculate}  ~~}
 \description{
- ~~ Methods for function \code{calculate}  ~~
+ Methods to execute rules on specyfied numeric arguments.
 }
 \section{Methods}{
 \describe{
@@ -15,8 +15,15 @@
 }
 
 \item{\code{signature(x = "SingleRule", y = "numeric", z = "ANY")}}{
-%%  ~~describe this method here~~
+'z' argument is ignored for objects of class "SingleRule"
 }
 }}
+
+
+\seealso{
+\code{\link{calculateSpecyfic-methods}}
+}
+
+
 \keyword{methods}
 \keyword{ ~~ other possible keyword(s) ~~ }

Modified: pkg/ruleR/man/calculate.Rd
===================================================================
--- pkg/ruleR/man/calculate.Rd	2012-08-01 15:30:48 UTC (rev 28)
+++ pkg/ruleR/man/calculate.Rd	2012-08-01 16:29:33 UTC (rev 29)
@@ -1,6 +1,6 @@
 \name{calculate}
 \alias{calculate}
-%- Also NEED an '\alias' for EACH other topic documented here.
+A function 
 \title{
 %%  ~~function to do ... ~~
 }
@@ -13,24 +13,20 @@
 %- maybe also 'usage' for other objects documented here.
 \arguments{
   \item{x}{
-%%     ~~Describe \code{x} here~~
+- an object of class \code{SingleRule} or \code{DoubleRule}
 }
   \item{y}{
-%%     ~~Describe \code{y} here~~
+- first element of numeric sequence
 }
   \item{z}{
-%%     ~~Describe \code{z} here~~
+- second element of numeric sequence 
 }
 }
 \details{
-%%  ~~ If necessary, more details than the description above ~~
+argument \code{z} is ignored if \code{x} inherits from class \code{SingleRule}
 }
 \value{
-%%  ~Describe the value returned
-%%  If it is a LIST, use
-%%  \item{comp1 }{Description of 'comp1'}
-%%  \item{comp2 }{Description of 'comp2'}
-%% ...
+function returs single value of class \code{numeric}
 }
 \references{
 %% ~put references to the literature/web site here ~
@@ -45,18 +41,44 @@
 %% ~Make other sections like Warning with \section{Warning }{....} ~
 
 \seealso{
-%% ~~objects to See Also as \code{\link{help}}, ~~~
+\code{\link{calculateSpecyfic}}
 }
 \examples{
-##---- Should be DIRECTLY executable !! ----
-##-- ==>  Define data, use random,
-##--	or do  help(data=index)  for the standard data sets.
 
-## The function is currently defined as
-function (x, y, z = NULL) 
-{
-    return(y)
-  }
+#[1] for objects of class SingleRule
+
+# a rule adding a constant value '6' to  the element of numeric sequence
+p<-new("AddConstSingleRule", constantVal=6) 
+
+calculate(p,4)# 4+6=10
+
+
+
+#[2]for objects of class DoubleRule
+
+#a rule substracting one element of the sequence from another
+n<-new("SubsDoubleRule")
+
+calculate(n,10,12) #10-12=-2
+
+
+
+#[3] for combined objects
+
+m<-new("DigSumSingleRule")
+r<-new("AddConstSingleRule", constantVal=6)
+g<-new("MultDoubleRule", firstRule=m, secondRule=m, nextSingle=r)
+
+calculate(g,12,34) #27
+
+# rule 'm' (first rule) is executed on the first element of numeric sequence (1+2=3)
+# rule 'm' (secodn rule) is executed on the second element of numeric sequence (3+4=7)
+# rule 'g' is executed on the result of firstRule and secondRule (3*7=21)
+# rule 'r' (nextSingle) is executed on the result of DoubleRule (21+6=27)
+#[(1+2) * (3+4) ]+6 = 27
+
+
+
 }
 % Add one or more standard keywords, see file 'KEYWORDS' in the
 % R documentation directory.

Modified: pkg/ruleR/man/calculateSpecific-methods.Rd
===================================================================
--- pkg/ruleR/man/calculateSpecific-methods.Rd	2012-08-01 15:30:48 UTC (rev 28)
+++ pkg/ruleR/man/calculateSpecific-methods.Rd	2012-08-01 16:29:33 UTC (rev 29)
@@ -16,61 +16,61 @@
 \alias{calculateSpecific,SubsDoubleRule,numeric,numeric-method}
 \title{ ~~ Methods for Function \code{calculateSpecific}  ~~}
 \description{
- ~~ Methods for function \code{calculateSpecific}  ~~
+ Methods for executing specyfied rules dedicated for every basic rule separately.
 }
 \section{Methods}{
 \describe{
 
 \item{\code{signature(x = "AddConstSingleRule", y = "numeric", z = "ANY")}}{
-%%  ~~describe this method here~~
+method to execute rules on objects of class \code{AddConstSingleRule}
 }
 
 \item{\code{signature(x = "AddDoubleRule", y = "numeric", z = "numeric")}}{
-%%  ~~describe this method here~~
+method to execute rules on objects of class \code{AddDoubleRule}
 }
 
 \item{\code{signature(x = "DigSumSingleRule", y = "numeric", z = "ANY")}}{
-%%  ~~describe this method here~~
+method to execute rules on objects of class \code{DigSumSingleRule}
 }
 
 \item{\code{signature(x = "DivDoubleRule", y = "numeric", z = "numeric")}}{
-%%  ~~describe this method here~~
+method to execute rules on objects of class \code{DivDoubleRule}
 }
 
 \item{\code{signature(x = "ExpDoubleRule", y = "numeric", z = "numeric")}}{
-%%  ~~describe this method here~~
+method to execute rules on objects of class \code{ExpDoubleRule}
 }
 
 \item{\code{signature(x = "IdenSingleRule", y = "numeric", z = "ANY")}}{
-%%  ~~describe this method here~~
+method to execute rules on objects of class \code{IdenSingleRule}
 }
 
 \item{\code{signature(x = "ModuloDoubleRule", y = "numeric", z = "numeric")}}{
-%%  ~~describe this method here~~
+method to execute rules on objects of class \code{ModuloDoubleRule}
 }
 
 \item{\code{signature(x = "MultConstSingleRule", y = "numeric", z = "ANY")}}{
-%%  ~~describe this method here~~
+method to execute rules on objects of class \code{MultConstSingleRule}
 }
 
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/ruler -r 29


More information about the Ruler-commits mailing list