Node

class Node(source)

Represents a node of a tree.

Constructors

Link copied to clipboard
constructor(@NotNull text: @NotNull String, @Nullable parent: @Nullable Tree.Node)
Creates a new node with its associated text and an optional parent.
constructor(@NotNull text: @NotNull String)
Creates a new node with its associated text without a parent.

Properties

Link copied to clipboard
@NotNull
val children: @NotNull List<Tree.Node>
A read-only list of the node's children.
Link copied to clipboard
@NotNull
val text: @NotNull String
The text associated with the node.

Functions

Link copied to clipboard
@NotNull
open fun appendChild(@NotNull text: @NotNull String): @NotNull Tree.Node
Creates a new node and adds it as a new child of the current node.
Link copied to clipboard
open fun toString(): String