SCM

SCM Repository

[tm] Diff of /trunk/R/textmin/R/textrepo.R
ViewVC logotype

Diff of /trunk/R/textmin/R/textrepo.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 52, Sat Aug 12 12:43:39 2006 UTC revision 62, Tue Oct 24 10:08:58 2006 UTC
# Line 2  Line 2 
2    
3  setGeneric("TextRepository", function(object, metaname = "created", meta = date()) standardGeneric("TextRepository"))  setGeneric("TextRepository", function(object, metaname = "created", meta = date()) standardGeneric("TextRepository"))
4  setMethod("TextRepository",  setMethod("TextRepository",
5            c("TextDocCol"),            signature(object = "TextDocCol"),
6            function(object, metaname, meta) {            function(object, metaname, meta) {
7                tr <- new("TextRepository", .Data = list(object), RepresentationMetaData = list(created = meta))                tr <- new("TextRepository", .Data = list(object), RepresentationMetaData = list(created = meta))
8                names(tr@RepresentationMetaData) <- metaname                names(tr@RepresentationMetaData) <- metaname
9                return(tr)                return(tr)
10            })            })
11    
   
12  setMethod("attachData",  setMethod("attachData",
13            c("TextRepository","TextDocCol"),            signature(object = "TextRepository", data = "TextDocCol"),
14            function(object, data) {            function(object, data) {
15                object@.Data <- as(c(object@.Data, data), "TextRepository")                object@.Data <- as(c(object@.Data, data), "TextRepository")
16                return(object)                return(object)
17            })            })
18    
19  setMethod("attachMetaData",  setMethod("attachMetaData",
20            c("TextRepository"),            signature(object = "TextRepository"),
21            function(object, name, metadata) {            function(object, name, metadata) {
22                object@RepresentationMetaData <- c(object@RepresentationMetaData, new = list(metadata))                object@RepresentationMetaData <- c(object@RepresentationMetaData, new = list(metadata))
23                names(object@RepresentationMetaData)[length(names(object@RepresentationMetaData))] <- name                names(object@RepresentationMetaData)[length(names(object@RepresentationMetaData))] <- name
24                return(object)                return(object)
25            })            })
26    
27    setMethod("length",
28              signature(x = "TextRepository"),
29              function(x){
30                  return(length(as(x, "list")))
31        })
32    
33    setMethod("show",
34              signature(object = "TextRepository"),
35              function(object){
36                  cat("A text repository with", length(object), "text document collection")
37                  if (length(object) == 1)
38                      cat("\n")
39                  else
40                      cat("s\n")
41        })
42    
43    setMethod("summary",
44              signature(object = "TextRepository"),
45              function(object){
46                  show(object)
47                  if (length(RepresentationMetaData(object)) > 0) {
48                      cat("\nThe representation metadata consists of", length(RepresentationMetaData(object)), "tag-value pair")
49                      if (length(RepresentationMetaData(object)) == 1)
50                          cat(".\n")
51                      else
52                          cat("s.\n")
53                      cat("Available tags are:\n")
54                      cat(names(RepresentationMetaData(object)), "\n")
55                  }
56        })

Legend:
Removed from v.52  
changed lines
  Added in v.62

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge