mxutils.DebugNode

Description

Realizes a simple tree structure used in printing debug information.

Inheritance diagram

Attributes

mxutils.DebugNode.Children

Gets an immutable tuple of the child nodes of the node.

mxutils.DebugNode.Depth

Gets the depth of the node in the tree.

mxutils.DebugNode.Label

Gets the label of the node, i.e., what is printed in a debug tree.

mxutils.DebugNode.Nid

Gets the ID of the node.

mxutils.DebugNode.Parent

Gets the pointed parent node of the node.

Methods Signature

Add(child)

Adds a child node to the node.

Find(nid)

Finds a node by its ID.

FromString(input[, indentation])

Builds a tree structure from a string representation.

Remove()

Removes the node from its parent.

ToString()

Returns the string representation of the current node and its subtree.

__init__(name[, nid])

Initializes a DebugNode instance.

__repr__()

Returns the label of the node.

__str__()

Returns the label of the node.

Methods Definition

DebugNode.Add(child: mxutils.mxu_scene.DebugNode) → None

Adds a child node to the node.

Parameters

child – The child node to add.

Raises

ValueError – If the child already has a parent.

DebugNode.Find(nid: tuple) → mxutils.mxu_scene.DebugNode | None

Finds a node by its ID.

Parameters

nid – The ID of the node to find.

Returns

The node with the specified ID, or None if not found.

Return type

DebugNode | None

static DebugNode.FromString(input: str, indentation: int = 4) → mxutils.mxu_scene.DebugNode

Builds a tree structure from a string representation.

Parameters
  • input – The string representation of the tree structure.

  • indentation – The number of spaces used for indentation.

Returns

The root node of the constructed tree.

Return type

DebugNode

DebugNode.Remove() → None

Removes the node from its parent.

DebugNode.ToString() → str

Returns the string representation of the current node and its subtree.

Returns

The string representation of the current node and its subtree.

Return type

str

DebugNode.__init__(name: str, nid: tuple[int] | None = None) → None

Initializes a DebugNode instance.

Parameters
  • name – The label of the node.

  • nid – The ID of the node as a tuple of integers.

DebugNode.__repr__() → str

Returns the label of the node.

DebugNode.__str__()

Returns the label of the node.