DecoratorNode
dendron.decorator_node.DecoratorNode
Bases: TreeNode
A decorator is a "wrapper" around a single node. The purpose of the decorator is to modify or support the action of its child in some way.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
`str`
|
The given name of this node. |
required |
child |
`dendron.tree_node.TreeNode`
|
An optional child node. If not specified, the child must be
set before this node's |
None
|
Source code in src/dendron/decorator_node.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
get_child()
Get the child of this decorator.
Returns:
Type | Description |
---|---|
TreeNode
|
|
get_node_by_name(name)
Search for a node by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
`str`
|
The name of the node we are looking for. |
required |
Returns:
Type | Description |
---|---|
Optional[TreeNode]
|
|
Optional[TreeNode]
|
or None. |
Source code in src/dendron/decorator_node.py
halt_child()
node_type()
pretty_repr(depth=0)
Return a string representation of this node at the given depth.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
depth |
`int`
|
The depth of this node in a surrounding tree. |
0
|
Returns:
Type | Description |
---|---|
str
|
|
Source code in src/dendron/decorator_node.py
reset()
Set the status of this node to IDLE and instruct the child node to reset.
set_child(child)
Set the child of this node to a new TreeNode
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
child |
`dendron.tree_node.TreeNode`
|
The new child of this decorator. |
required |
set_log_level(new_level)
Set the log level for this node, and then forward that level to the child node.
set_logger(new_logger)
Set the logger for this node, and then forward the logger to the child node.
set_tree(tree)
Set the tree of this node, and then forward the tree to the child to have it set its tree.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tree |
`dendron.behavior_tree.BehaviorTree`
|
The tree that contains this node. |
required |