ToolSet / com.zndevs.toolset.tools / Node

Node

class Node<TValue>

Object containing a value and children of the same type

Parameters

TValue - Type of the value contained

Constructors

<init> Node()
Creates a node with no value setNode(contents: TValue)
Creates a node with a value

Properties

value var value: TValue?
The value of this node

Functions

addChild fun addChild(child: Node<TValue>): Unit
Adds a node to this node’s childrenfun addChild(child: TValue): Node<TValue>
Wraps child in a Node instance and adds to this node’s children
createChild fun createChild(): Node<TValue>
Creates a Node, adds it to the children, and returns it
getChildren fun getChildren(): List<Node<TValue>>
Returns the list of children. Modifying this list will change the children of this node.
removeChild fun removeChild(child: Node<TValue>): Unit
Removes a node from our children. Does nothing if the node isn’t already a child