### The RleViews class is the basic container for storing a set of views
### (start/end locations) on the same Rle object, called the "subject"
### The 2 helper functions below convert a given view on an Rle object
### Both assume that 'start' <= 'end' (so they don't check it) and
### padd the result with spaces to produce the "margin effect"
### if 'start' or 'end' are out of limits.

function(subject, start=NULL, end=NULL, width=NULL, names=NULL)
to <- Views(as(unlist(from, use.names = FALSE), "Rle"),
RleViews.show_vframe_header <- function(iW, startW, endW, widthW)
format("start", width=startW, justify="right"), " ",
format("end", width=endW, justify="right"), " ",
RleViews.show_vframe_line <- function(x, i, iW, startW, endW, widthW)
snippetWidth <- getOption("width") - 10 - iW - startW - endW - widthW
if (width > 0 && lsx > 0 && start <= lsx && end >= 1) {
snippetEnd <- max(min(end,lsx,start + snippetWidth),1)
snippet <- snippet[cumsum(nchar(snippet) + 1L) < snippetWidth]
snippet <- paste(snippet, collapse = " ")
cat(format(paste("[", i,"]", sep=""), width=iW, justify="right"), " ",
format(start, width=startW, justify="right"), " ",
format(end, width=endW, justify="right"), " ",
format(width, width=widthW, justify="right"), " ",
iW <- nchar(as.character(lx)) + 2 # 2 for the brackets
RleViews.show_vframe_line(x, i, iW, startW, endW, widthW)
cat("Views on a ", length(subject(object)), "-length Rle subject\n", sep="")

### The "viewApply", "viewMins", "viewMaxs", and "viewSums" generics and
"missing values present, set 'na.rm = TRUE'"

function(X, FUN, ..., simplify = TRUE) {
aggregate(subject(X), start = structure(start(X), names = names(X)),
end = end(X), FUN = FUN, ..., simplify = simplify)
ans <- newList("SimpleList", ans, metadata=metadata(X),
maxs <- viewWhichMaxs(trim(x), na.rm = na.rm)
stop("missing values present, set 'na.rm = TRUE'")
mins <- viewWhichMins(trim(x), na.rm = na.rm)

"'...' must be empty when 'rleList' and 'rangesList' are specified"
"'rangesList' must be a RangesList object"
"cannot specify 'rleList' or 'rangesList' when specifying '...'"
"all elements in '...' must be RleViews objects"