## Selecting the 1st element guarantees that we return a single string
## (e.g. on an ordered factor, class(x) returns a character vector of

### Basic manipulation of a "compact bit vector" i.e. a bit vector stored in

stop("'length.out' must be a single number")

### when calling this from another package.
## FIXME: workaround to support CompressedNormalIRangesList
"the 'unlistData' slot must be of class"
### Not exported. 'x' *must* be an unnamed list of length >= 1 (not checked).
## NOTE: while the 'c' function does not have an 'x', the generic does.
## c() is a primitive, so 'x' can be missing; dispatch is by position,
## although sometimes this does not work so well, so it's best to keep
## names off the parameters whenever feasible.
"\"c\" method for CompressedList objects "
"does not support the 'recursive' argument"
"all arguments in '...' must be CompressedList objects"
"all arguments in '...' must have an element class "
"that extends that of the first argument"
"for Ranges 'by', 'length(x) != length(by)'"
### S3/S4 combo for as.list.CompressedList
"\"unlist\" method for CompressedList objects "
## If 'use.names' is FALSE or 'x' has no *outer* names, then we don't
## do anything to 'ans' i.e. we just keep whatever names/rownames are
## on it (which are the *inner* names/rownames of 'x'). Note that this
## behavior is NOT consistent with unlist,List or base::unlist as
## both of them will return a vector with no names/rownames when
## FIXME: Make unlist,CompressedList and unlist,List behave
## Otherwise (i.e. if 'use.names' is TRUE and 'x' has *outer* names),
## we make up new names/rownames for 'ans' by prepending the *outer*
## names of 'x' to its *inner* names/rownames. Note that this differs
## from what base::unlist does but THIS IS A FEATURE and is consistent

newCompressedList0 <- function(Class, unlistData, partitioning)
paste("the 'unlistData' slot must be of class", elementTypeX)
function(X, INDEX, USE.NAMES = TRUE, COMPRESS = missing(FUN), FUN = identity,
nonZeroLength <- elementLengths(X)[INDEX] > 0L
zeroLengthElt <- FUN(extractROWS(X@unlistData, integer(0)), ...)
useFastSubset <- (is.vector(X@unlistData) || is(X@unlistData, "Vector"))
} else if(COMPRESS && missing(FUN) && useFastSubset) {
if (isS4(obj) && !isTRUE(validObject(obj, test = TRUE)))
stop("invalid output element of class \"", class(obj), "\"")
i <- normalizeDoubleBracketSubscript(i, x, exact=exact,
nameValue <- if (is.character(i)) i else ""
if (i <= length(x)) # if name did not exist, could be +1
value <- try(as(value, elementType(x)), silent = TRUE)
stop("cannot coerce 'value' to a ", elementType(x),
listData <- as.list(x, use.names = FALSE)
(!is.null(names(x)) || nchar(nameValue) > 0)) {
ans_unlistData <- do.call(.bindROWS, lapply(x, slot, "unlistData"))
stop("\"c\" method for CompressedList objects ",
"does not support the 'recursive' argument")
stop("all arguments in '...' must be CompressedList objects")
stop("all arguments in '...' must have an element class ",
"that extends that of the first argument")
function(x, by, FUN, start = NULL, end = NULL, width = NULL,
frequency = NULL, delta = NULL, ..., simplify = TRUE)
if (!missing(by) && is(by, "RangesList")) {
stop("for Ranges 'by', 'length(x) != length(by)'")
aggregate(y[[i]], by = by[[i]], FUN = FUN,
ans <- try(SimpleAtomicList(result), silent = TRUE)
.updateCompressedList <- function(X, listData) {
stop("'FUN' must return elements of class ", elementTypeX)
end <- cumsum(unlist(lapply(listData, NROW), use.names = FALSE))
new2("PartitioningByEnd", end = end, NAMES = names(X),
ii <- fancy_mseq(elt_lens, offset=offset, rev=rev)
.as.list.CompressedList <- function(x, use.names = TRUE)
as.list.CompressedList <- function(x, ...) .as.list.CompressedList(x, ...)
stop("\"unlist\" method for CompressedList objects ",
stop("'use.names' must be TRUE or FALSE")
if (use.names && !is.null(x_names <- names(x))) {
res <- try(names(ans) <- ans_ROWNAMES, silent=TRUE)
res <- try(rownames(ans) <- ans_ROWNAMES, silent=TRUE)
warning("failed to set ", what, " on the result ",
coerceToCompressedList <- function(from, element.type = NULL, ...) {
if (is.list(from) || is(from, "List")) {