SCM

SCM Repository

[tm] Diff of /pkg/R/corpus.R
ViewVC logotype

Diff of /pkg/R/corpus.R

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

revision 719, Sun Mar 18 09:24:47 2007 UTC revision 720, Tue Mar 20 10:43:11 2007 UTC
# Line 444  Line 444 
444      return(list(root = set_id(object), left.mapping = left.mapping, right.mapping = mapping))      return(list(root = set_id(object), left.mapping = left.mapping, right.mapping = mapping))
445  }  }
446    
 # TODO  
447  setMethod("c",  setMethod("c",
448            signature(x = "TextDocCol"),            signature(x = "TextDocCol"),
449            function(x, ..., meta = list(merge_date = Sys.time(), merger = Sys.getenv("LOGNAME")), recursive = TRUE) {            function(x, ..., meta = list(merge_date = Sys.time(), merger = Sys.getenv("LOGNAME")), recursive = TRUE) {
# Line 452  Line 451 
451                if(length(args) == 0)                if(length(args) == 0)
452                    return(x)                    return(x)
453    
454                  if (!all(sapply(args, inherits, "TextDocCol")))
455                      stop("not all arguments are text document collections")
456                  if (DBControl(x)$useDb == TRUE || any(unlist(sapply(args, DBControl)["useDb", ])))
457                      stop("concatenating text document collections with activated database is not supported")
458    
459                result <- x                result <- x
460                for (c in args) {                for (c in args) {
                   if (!inherits(c, "TextDocCol"))  
                       stop("invalid argument")  
461                    result <- c2(result, c)                    result <- c2(result, c)
462                }                }
463                return(result)                return(result)
464            })            })
465    
 # TODO  
466  setGeneric("c2", function(x, y, ..., meta = list(merge_date = Sys.time(), merger = Sys.getenv("LOGNAME")), recursive = TRUE) standardGeneric("c2"))  setGeneric("c2", function(x, y, ..., meta = list(merge_date = Sys.time(), merger = Sys.getenv("LOGNAME")), recursive = TRUE) standardGeneric("c2"))
467  setMethod("c2",  setMethod("c2",
468            signature(x = "TextDocCol", y = "TextDocCol"),            signature(x = "TextDocCol", y = "TextDocCol"),
# Line 470  Line 471 
471                # Concatenate data slots                # Concatenate data slots
472                object@.Data <- c(as(x, "list"), as(y, "list"))                object@.Data <- c(as(x, "list"), as(y, "list"))
473    
474                  # Set the DBControl slot
475                  object@DBControl <- list(useDb = FALSE, dbName = "", dbType = "DB1")
476    
477                # Update the CMetaData tree                # Update the CMetaData tree
478                cmeta <- new("MetaDataNode", NodeID = 0, MetaData = meta, children = list(CMetaData(x), CMetaData(y)))                cmeta <- new("MetaDataNode", NodeID = 0, MetaData = meta, children = list(CMetaData(x), CMetaData(y)))
479                update.struct <- update_id(cmeta)                update.struct <- update_id(cmeta)
# Line 515  Line 519 
519                return(object)                return(object)
520            })            })
521    
 # TODO  
522  setMethod("c",  setMethod("c",
523            signature(x = "TextDocument"),            signature(x = "TextDocument"),
524            function(x, ..., recursive = TRUE){            function(x, ..., recursive = TRUE){
# Line 529  Line 532 
532                              MetaData = list(create_date = Sys.time(), creator = Sys.getenv("LOGNAME")),                              MetaData = list(create_date = Sys.time(), creator = Sys.getenv("LOGNAME")),
533                              children = list())                              children = list())
534    
535                return(new("TextDocCol", .Data = list(x, ...), DMetaData = dmeta.df, CMetaData = cmeta.node))                return(new("TextDocCol",
536                             .Data = list(x, ...),
537                             DMetaData = dmeta.df,
538                             CMetaData = cmeta.node,
539                             DBControl = list(useDb = FALSE, dbName = "", dbType = "DB1")))
540            })            })
541    
542  setMethod("length",  setMethod("length",

Legend:
Removed from v.719  
changed lines
  Added in v.720

R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge