get the number of edges to other RadixNodes
Delete an edge label from this RadixNodeEdges. Cannot corrupt the state of the edges list.
A generator over all [edgeLabel, node] pairs.
either the matching edge label or undefined if no matching label
Get the RadixNode associated to an edge label k
Find the edge label sharing a prefix with key, comparing from key[start] onwards.
the key whose first (unconsumed) character selects the edge
the index in key at which the relevant character begins
the [edgeLabel, childNode] pair for the matching edge, or undefined
Check if there is an edge associated to a particular label.
A generator over all edge labels.
Set an association between an edge label k and a RadixNode. Because edges are keyed by first character, any existing edge starting with the same character is transparently replaced -- which is exactly the invariant we want to maintain.
A generator over all child RadixNodes.
Generated using TypeDoc
The set of edges from a RadixNode to its children. Maintains a single invariant:
Because of that invariant, children are indexed by the first character (code) of their edge label, which makes finding the edge that shares a prefix with a given key an O(1) lookup keyed by a single char code -- never a hash of the whole label, and never a scan of the children.
The backing Map is allocated lazily: leaf nodes (the majority in most trees) hold no Map at all. Each slot stores the full edge label alongside its child node, so no second map is needed to recover the label from the first character.