Package-level declarations

Types

Link copied to clipboard
class Node<T, L>

Properties

Link copied to clipboard
val <T, L> Node<T, L>.depth: Int

Number of parents before hitting the root Node. If this is the root, then this is 0.

Link copied to clipboard
val <T, L> Node<T, L>.height: Int

Maximum number of children before hitting a leaf Node. If this is a leaf, then this is 0.

Link copied to clipboard
val <T, L> Node<T, L>.isLeaf: Boolean

Returns true if this node has no children.

Functions

Link copied to clipboard
fun <T, L> Node<T, L>.ancestors(): Sequence<Node<T, L>>

Returns ancestor nodes, starting with this and then following the Node.parent chain.

Link copied to clipboard
fun <T, L> Node<T, L>.count(): Node<T, L>
Link copied to clipboard
inline fun <T, L> Node<T, L>.each(crossinline action: (Node<T, L>) -> Unit): Node<T, L>
Link copied to clipboard
inline fun <T, L> Node<T, L>.eachAfter(crossinline action: (Node<T, L>) -> Unit): Node<T, L>
Link copied to clipboard
inline fun <T, L> Node<T, L>.eachAfterIndexed(crossinline action: (Int, Node<T, L>) -> Unit): Node<T, L>
Link copied to clipboard
inline fun <T, L> Node<T, L>.eachBefore(crossinline action: (Node<T, L>) -> Unit): Node<T, L>
Link copied to clipboard
inline fun <T, L> Node<T, L>.eachBeforeIndexed(crossinline action: (Int, Node<T, L>) -> Unit): Node<T, L>
Link copied to clipboard
inline fun <T, L> Node<T, L>.eachIndexed(crossinline action: (Int, Node<T, L>) -> Unit): Node<T, L>
Link copied to clipboard
fun <T> flatHierarchy(values: Iterable<T>): Node<T?, Nothing?>
Link copied to clipboard
fun <T> hierarchy(root: T, getChildren: (T) -> List<T>): Node<T, Nothing?>
Link copied to clipboard
fun <T, L> Node<T?, L>.removeHierarchy(): Sequence<Pair<T, L>>

Returns a breadth-first traversal of nodes, removing those with null data, and pairing the data to the layout.

Link copied to clipboard
fun <T, L> Node<T, L>.sort(comparator: Comparator<T>): Node<T, L>
Link copied to clipboard
inline fun <T, L> Node<T, L>.sum(crossinline value: (T) -> Float): Node<T, L>
Link copied to clipboard

Returns descendant nodes, starting with this and then following the Node.children chain in a breadth-first traversal.

Link copied to clipboard

Returns descendant nodes, starting with the Node.children chain in a depth-first traversal, and ending with this.

Link copied to clipboard

Returns descendant nodes, starting with this and then following the Node.children chain in a depth-first traversal.