Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TopDownTreeIterator

This tree iterator visits all nodes from top to bottom considering the following rules.

Let assume the following tree:

  R
  |
  +---1
  |   |
  |   +---1.1
  |   |
  |   +---1.2
  |   |
  |   +---1.3
  |   |    |
  |   |    +---1.3.1
  |   |    |
  |   |    +---1.3.2
  |   |
  |   +---1.4
  |
  +---2
      |
      +---2.1

When selecting 1.2 as the root, the normal DepthFirstTreeIterator would stop on 1.2 as it does not have children, but this iterator will visit the next sibling (1.3 and 1.4 but not 1.1) nodes. So the expected traversal order will be 1.2, 1.3, 1.3.1, 1.3.2, and 1.4 then jumps to 2 and continues with 2.1.

Hierarchy

Index

Constructors

constructor

Properties

Protected Readonly delegate

delegate: IterableIterator<TreeNode>

Protected Readonly options

options: Options

Protected Readonly root

root: TreeNode

Methods

[Symbol.iterator]

  • [Symbol.iterator](): IterableIterator<TreeNode>

Protected children

Protected doNext

Protected findFirstChild

Protected findNextSibling

Protected isCollapsed

Protected isEmpty

  • isEmpty(nodes: undefined | TreeNode[]): boolean

Protected iterator

next