Workcraft uses the Observer pattern both mathematical and visual models create a number of observers listening to the changes in hierarchy such as adding and removing nodes in some container.
NodeContextTrackerfor each node provides the model with the information about the current pre-set and post-set. It can also quickly return all related connections to a given node.
DefaultMathNodeRemovercounts references from the visual node to the math node. When all related visual nodes are deleted, the corresponding math node is deleted as well.
HierarchicalUniqueNameReferenceManagermakes sure that all nodes are named. These names are necessary during the serialization and deserialization procedures.
RemovedNodeDeselectorlistens to the node removal events and removes these nodes from the visual model selection as well.
DefaultHangingConnectionRemoverremoves connections that cannot exist without the nodes being removed.