Node

interface Node(source)

An element in an abstract tree.

It is not expected that users of this library have to deal with this class directly.

Trees

Trees are expected to be built bottom-up: a node is always built before its parents. Once a node has been accepted by a parent, it freezes (becomes forever immutable). The same node may be added to multiple parent nodes.

This schemes ensures that trees are always as simplified as possible: we are always building a single node at a time, and all its children are guaranteed to be immutable and fully simplified.

There are two main categories of nodes:

  • Nodes that represent some data by themselves,

  • Nodes that group other nodes into a single larger node.

The former category implements this interface, whereas the latter implements CompoundNode.

Inheritors

Functions

Link copied to clipboard
abstract fun freeze()

Makes this node immutable.