Class GenerationIndex

Create a new secondary tree structure providing quick access to all nodes of a generation.

Constructor

class GenerationIndex(root[, propname])
Arguments:
  • root (object) – A tree.Node representing the root of the tree
  • propname (string) – The name of the property which will be used to cache index values on tree.Node objects.

Methods

buildAll

GenerationIndex#buildAll()

Build up complete generation index upfront if necessary.

buildSubtree

GenerationIndex#buildSubtree(node)
Arguments:
  • node

Build up index of a subtree rooting at the specified node.

extendGeneration

GenerationIndex.extendGeneration(depth, offset)
Arguments:
  • depth
  • offset

Extend generation index dynamically (not implemented yet)

first

GenerationIndex#first(depth)
Arguments:
  • depth

Return first node of the generation at depth.

get

GenerationIndex#get(refnode, offset)
Arguments:
  • refnode (object) – The reference tree.Node
  • offset (number) – An integer value
Returns object:

tree.Node or undefined

Return a tree.Node with the same depth at the given offset relative to the given reference node.

last

GenerationIndex#last(depth)
Arguments:
  • depth

Return last node of the generation at depth.

Attributes

gencomplete

gencomplete

An array of booleans indexed by tree depth indicating whether all nodes of a generation have been indexed.

generations

generations

An array of arrays of tree.Nodes. Each containing tree.Nodes at the same depth.

idxcomplete

idxcomplete

Return true if the whole generation index is complete.

propname

propname

A property set at every indexed tree.Node indicating the position of the node in the generation.

root

root

The root of the tree.

Table Of Contents

Previous topic

Class DocumentOrderIndex

Next topic

Class NodeHashIndex