occurrenceByAddress method
- OccurrenceAddress address
Find an occurrence by its OccurrenceAddress. O(depth).
Implementation
HierarchyOccurrence? occurrenceByAddress(OccurrenceAddress address) =>
address.path.fold<HierarchyOccurrence?>(
root,
(node, idx) => node != null && idx >= 0 && idx < node.children.length
? node.children[idx]
: null);