Class DocumentOrderIndex

Create a new secondary tree structure providing quick access to all nodes in document order.

Constructor

class DocumentOrderIndex(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

DocumentOrderIndex#buildAll()

Build up complete document order index upfront if necessary.

flatten

DocumentOrderIndex#flatten(refnode)
Arguments:
  • refnode

Return an array of all nodes contained in the subtree under refnode in document order index. Static function: must work also with nodes which are not part of the index.

get

DocumentOrderIndex#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 at the offset relative to the given reference node.

size

DocumentOrderIndex#size(refnode)
Arguments:
  • refnode

Return the size of a subtree when traversed using this index Static function: must work also with nodes which are not part of the index.

Attributes

idxcomplete

idxcomplete

Return true if the whole generation index is complete.

nodes

nodes

Array of nodes in document order.

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 Matching

Next topic

Class GenerationIndex