navigate.model.features.feature_container.DataContainer
- class navigate.model.features.feature_container.DataContainer(root=None, cleanup_list=[])
Bases:
Container
DataContainer class for managing data-based control sequences.
This class is a specialized container for managing control sequences that involve data-based nodes. It extends the functionality of the base Container class and provides methods for running data-based control sequences.
Notes:
The DataContainer class is designed for managing control sequences that are data-based, typically used in applications involving data processing and analysis.
It extends the functionality of the base Container class and provides methods for running data-based control sequences.
The run method is responsible for executing the data-based control sequence nodes in the order defined by the control sequence tree. It handles transitions between nodes and manages node cleanup when necessary.
- __init__(root=None, cleanup_list=[])
Initialize the DataContainer object.
Parameters:
- rootTreeNode or None, optional
The root node of the control sequence tree. Default is None.
- cleanup_listlist of TreeNode, optional
A list of nodes containing ‘cleanup’ functions to be executed when the container is closed. Default is an empty list.
Methods
__init__
([root, cleanup_list])Initialize the DataContainer object.
cleanup
()Execute 'cleanup' functions for specified nodes in the tree.
reset
()Reset the container's state, including the current node and end flag.
run
(*args)Run the data-based control sequence.
Attributes
- cleanup()
Execute ‘cleanup’ functions for specified nodes in the tree.
This method executes the ‘cleanup’ functions associated with nodes in the cleanup_list. These functions are typically used to perform resource cleanup or finalization when the container is closed. The ‘cleanup_list’ specifies which nodes should have their ‘cleanup’ functions executed.
- reset()
Reset the container’s state, including the current node and end flag.
This method resets the state of the container, including setting the current node to None and clearing the end flag. It prepares the container for running the control sequence from the beginning.
- run(*args)
Run the data-based control sequence.
This method runs the data-based control sequence by iterating through its nodes and executing them in order. It manages the execution of nodes, handles transitions between nodes, and performs node cleanup when necessary.
Parameters:
- *argsarguments
Optional arguments to pass to the control sequence nodes.
Notes:
The run method is responsible for executing the data-based control sequence nodes in the order defined by the control sequence tree.
It handles transitions between nodes, waits for responses if necessary, and performs cleanup for nodes marked as not needing a response and having a ‘one-step’ node type.
- end_flag
A flag indicating whether the control sequence execution should stop.
- Type:
bool
- is_closed
A boolean indicating whether the container is closed.
- Type:
bool