1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#'@export
length.string_trie <- function(x){
return(radix_len_string(x))
}
#'@export
length.integer_trie <- function(x){
return(radix_len_integer(x))
}
#'@export
length.numeric_trie <- function(x){
return(radix_len_numeric(x))
}
#'@export
length.logical_trie <- function(x){
return(radix_len_logical(x))
}
#'@export
dim.trie <- function(x){
return(length(x))
}
#'@export
str.trie <- function(object, ...){
type <- class(object)[3]
cat(paste0(type, "\n"))
switch(type,
"string_trie" = {trie_str_string(object)},
"integer_trie" = {trie_str_integer(object)},
"numeric_trie" = {trie_str_numeric(object)},
"logical_trie" = {trie_str_logical(object)}
)
return(invisible())
}
#'@export
print.trie <- function(x, ...){
len <- length(x)
entry_word <- ifelse(len != 1, "entries", "entry")
cat("A", class(x)[3], "object with", len, entry_word, "\n")
}
|