Class (GI Struct)

GLib-2.0GLibNode

The GLib.Node struct represents one node in a n-ary tree.

Index

Constructors

Properties

data: any
$gtype: GType<GLib.Node>

Methods

  • Gets the position of the first child of a GLib.Node which contains the given data.

    Parameters

    • Optionaldata: any

      the data to find

    Returns number

    the index of the child of node which contains data, or -1 if the data is not found

  • Gets the position of a GLib.Node with respect to its siblings. child must be a child of node. The first child is numbered 0, the second 1, and so on.

    Parameters

    Returns number

    the position of child with respect to its siblings

  • Gets the depth of a GLib.Node.

    If node is null the depth is 0. The root node has a depth of 1. For the children of the root node the depth is 2. And so on.

    Returns number

    the depth of the GLib.Node

  • Removes root and its children from the tree, freeing any memory allocated.

    Returns void

  • Returns true if node is an ancestor of descendant. This is true if node is the parent of descendant, or if node is the grandparent of descendant etc.

    Parameters

    Returns boolean

    true if node is an ancestor of descendant

  • Gets the maximum height of all branches beneath a GLib.Node. This is the maximum distance from the GLib.Node to all leaf nodes.

    If root is null, 0 is returned. If root has no children, 1 is returned. If root has children, 2 is returned. And so on.

    Returns number

    the maximum height of the tree beneath root