add method

void add(
  1. StateNodeDefinition<AutomataState> node
)

Add a new active StateNodeDefinition.

On the process of adding a new active node, we also remove any now redundant node, ie.

  • given an existing node of: RootNode > A
  • when adding: RootNode > A > B It is safe to remove RootNode > A

Implementation

void add(StateNodeDefinition node) {
  final duppedNodes = node.path.where(
    (path) => _activeNodes.any((element) => element == path),
  );
  duppedNodes.forEach(remove);

  _activeNodes.add(node);
}