trees :: TrieNode :: collect_values
trees :: TrieNode :: defaultinit
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
trees :: TrieNode :: collect_values
core :: Object :: defaultinit
trees :: TrieNode :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).
# TrieNode used to store the Character key of the value
private class TrieNode[E]
var c: nullable Char
var value: nullable E
var children = new HashMap[Char, TrieNode[E]]
var is_leaf: Bool = false
fun collect_values: Array[E] do
var values = new Array[E]
var todo = new List[TrieNode[E]]
todo.add self
while todo.not_empty do
var node = todo.shift
var value = node.value
if value != null then values.add value
for child in node.children.values do
todo.push child
end
end
return values
end
end
lib/trees/trie.nit:183,1--205,3