public void AddProcessor(StateProcessorBase newProcessor) { if (_root == null) { _root = newProcessor; } else { AddProcessor(_root, newProcessor); } }
public void RemoveProcessor(StateProcessorBase removedProcessor) { if (_root == removedProcessor) { _root = null; } else { RemoveProcessor(_root, removedProcessor); } }
private void RemoveProcessor(StateProcessorBase currentProcessor, StateProcessorBase removedProcessor) { if (currentProcessor.Next == removedProcessor) { currentProcessor.Next = removedProcessor.Next; } else if (currentProcessor.Next != null) { RemoveProcessor(currentProcessor.Next, removedProcessor); } }
private void AddProcessor(StateProcessorBase currentProcessor, StateProcessorBase newProcessor) { if (currentProcessor.Next == null || currentProcessor.Next.Priority >= newProcessor.Priority) { newProcessor.Next = currentProcessor.Next; currentProcessor.Next = newProcessor; } else { AddProcessor(currentProcessor.Next, newProcessor); } }