public void Update(CalculatorUpdate update) { _eventBuffer.StartBuffering(); foreach (var modifier in update.RemovedModifiers) { _modifierCollection.RemoveModifier(modifier); } foreach (var modifier in update.AddedModifiers) { _modifierCollection.AddModifier(modifier); } _graphPruner.RemoveUnusedNodes(); _eventBuffer.Flush(); _eventBuffer.StopBuffering(); }
public void Update(CalculatorUpdate update) { _suspender.SuspendEvents(); // If the remove/add order matters for performance, ordering logic could be added. foreach (var modifier in update.RemovedModifiers) { _modifierCollection.RemoveModifier(modifier); } foreach (var modifier in update.AddedModifiers) { _modifierCollection.AddModifier(modifier); } _graphPruner.RemoveUnusedNodes(); _suspender.ResumeEvents(); }