A node in the prefix trie.

Constructor

inline new (parent:PrefixNode, letter:String, depth:UInt)

Creates a new trie node.

Parameters:

parent

The parent of this node. Null if the node is the root node.

letter

The letter this node represents.

depth

The depth of the node in the trie.

Variables

read onlychildren:Array<PrefixNode>

The children of this node. Empty if there are no children, never null.

read onlydepth:UInt

The depth of the node in the trie.

frequency:UInt

The number of times this node is used in the trie. i.e. a trie containing the word "AS" and "AD" would have A -> 2, S -> 1, D -> 1.

read onlyletter:String

The letter contained in this node.

read onlyparent:PrefixNode

The parent of the current node. Null if the node is a root node.

word:Bool

Whether this node is the end of a word. This includes all the terminal nodes, but may also include intermediate nodes. i.e. for "LAD" and LADS", the "D" node would be a "word" node, despite "D" not being a terminal node.