FlatTree
Instance methods
Returns an array [left_child, right_child] with the indexes of this elements children. If this element does not have any children it returns null
Returns how many nodes (including parent nodes) a tree contains
Returns a list of all the full roots (subtrees where all nodes have either 2 or 0 children) < index. For example full_roots(8) returns [3] since the subtree rooted at 3 spans 0 -> 6 and the tree rooted at 7 has a child located at 9 which is >= 8.
Returns an array index for the tree element at the given depth and offset
Create a stateful tree iterator starting at a given index. The iterator exposes the following methods.
Returns only the left child of a node.
Returns the left spanning in index in the tree index spans.
Returns the relative offset of an element
Returns the index of the parent element in tree
Returns only the right child of a node.
Returns the right spanning in index in the tree index spans.
Returns the index of this elements sibling
Returns the range (inclusive) the tree root at index spans. For example FlatTree.spans(3) would return [0, 6] (see the usage example).