Tree

class Tree<Node : TreeNode<Node>, out RootNode : Node>(val root: RootNode)

Computes and stores parent/child/sibling relations in a tree structure.

This class is a simplified version of Kiama's tree relations. Refer to the sections on Attribute Grammars and Relations. in Kiama's user manual for more information.

Parameters

Node

The type of nodes in the tree.

RootNode

The type of the root node of the tree.

root

The root node of the tree.

Constructors

Link copied to clipboard
fun <out RootNode : Node> Tree(root: RootNode)

Functions

Link copied to clipboard
fun childIndex(node: Node): Int

Returns the index of node in its parent's children list.

Link copied to clipboard
fun nextSibling(node: Node): Node?

Returns the node that occurs just after node in its parent's children list, or null if node is the root or node is its parent's last child.

Link copied to clipboard
fun parent(node: Node): Node?

Returns the parent of node, or null if node is the root.

Link copied to clipboard

Returns the node that occurs just before node in its parent's children list, or null if node is the root or node is its parent's first child.

Properties

Link copied to clipboard