The FullNameInterface class interface
Package: R.filesets
Class FullNameInterface
Interface~~|~~+--FullNameInterface
Directly known subclasses:
ChecksumFile, ChecksumFileSet, GenericDataFile, GenericDataFileSet, GenericDataFileSetList, GenericTabularFile, GenericTabularFileSet, RDataFile, RDataFileSet, RdsFile, RdsFileSet, TabularTextFile, TabularTextFileSet
public abstract class FullNameInterface
extends Interface
FullNameInterface(...)
... |
Not used. |
The full name consists of a name followed by optional comma-separated tags.
For instance, the full name of foo,a.2,b has name foo with
tags a.2 and b.
Methods:
appendFullNameTranslator |
- | |
clearFullNameTranslator |
- | |
getFullName |
Gets the full name. | |
getName |
Gets the name. | |
getTags |
Gets the tags. | |
hasTag |
- | |
hasTags |
Checks whether the fullname contains a given set of tag(s). | |
setFullName |
Sets the full name. | |
setFullNameTranslator |
- | |
setName |
Sets the name part of the fullname. | |
setTags |
Sets the tags. | |
Methods inherited from Interface:
extend, print, uses
Henrik Bengtsson
# Setup a file set
path <- system.file("R", package="R.filesets")
ds <- GenericDataFileSet$byPath(path)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Data set
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cat("Path of data set:\n")
print(getPath(ds))
cat("Fullname of data set:\n")
print(getFullName(ds))
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Data files
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cat("Pathnames:\n")
print(getPathnames(ds))
cat("Filenames:\n")
print(sapply(ds, getFilename))
cat("Default fullnames:\n")
print(getFullNames(ds))
cat("Extensions:\n")
print(sapply(ds, getExtension))
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Translation of data file names
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Translate fullnames to lower case
setFullNamesTranslator(ds, function(names, ...) tolower(names))
cat("Lower-case fullnames:\n")
print(getFullNames(ds))
# Append a translator that reverse the order of the letters
revStr <- function(names, ...) {
names <- strsplit(names, split="", fixed=TRUE)
names <- lapply(names, FUN=rev)
names <- sapply(names, FUN=paste, collapse="")
names
}
appendFullNamesTranslator(ds, revStr)
cat("Reversed lower-case fullnames:\n")
fn3 <- getFullNames(ds)
print(fn3)
# Alternative for setting up a sequence of translators
setFullNamesTranslator(ds, list(function(names, ...) tolower(names), revStr))
cat("Reversed lower-case fullnames:\n")
fn3b <- getFullNames(ds)
print(fn3b)
stopifnot(identical(fn3b, fn3))
# Reset
clearFullNamesTranslator(ds)
cat("Default fullnames (after resetting):\n")
print(getFullNames(ds))Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.