We build a tree node that can execute an operation mode and can have any number of children. Furthermore, the node should call the corresponding operation mode for all children nodes, so that we get a traverse call over all tree elements. The calls of the corresponding operation mode should be done via an interface that a client can call (operation mode handler and parent node).
When calling the constructor (FB_init), the parent node should be passed, the child node calls the addChildNode method with itself. This way we save attachment methods, and the declaration structure also reflects the tree structure (ease of use and good readability). The class structure is shown in Figure 3, and the idea of communication is indicated in Figure 4.