File: metadata.R

package info (click to toggle)
r-cran-triebeard 0.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 392 kB
  • sloc: cpp: 1,095; sh: 13; makefile: 2; ansic: 1
file content (46 lines) | stat: -rw-r--r-- 919 bytes parent folder | download | duplicates (3)
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")
}