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.
DefaultHangingConnectionRemoverremoves connections that cannot exist without the nodes being removed.
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.
RemovedNodeDeselectorlistens to the node removal events and removes these nodes from the visual model selection as well.
HierarchyReferenceManagermake sure that all nodes are named. These names are necessary during the serialization and deserialization procedures. The former is used for visual models and the later for the mathematical ones.