private void AddNode(IStepNode node, SimpleStepNode simpleNode) { if (_rootNode == null) { _rootNode = node; } else if (_lastSimpleNode != null) { _lastSimpleNode.AttachNode(node); // HAX: attach the node to the top-level decorator so that Previous works correctly node.AttachTo(_lastNode); } _lastNode = node; _lastSimpleNode = simpleNode; }
public void AttachNode(IStepNode node) { if (node == null) { throw new ArgumentNullException("node cannot be null"); } // Place the new node in-between this node and the current next node IStepNode oldNext = _next; node.AttachTo(this); if (oldNext != null) { oldNext.AttachTo(node); } // Link the node to us _next = node; }
/// <summary> /// Connects an IStepNode to one of the IBranchStep's branches. /// </summary> /// <param name="branch">The branch to connect to (see the concrete IBranchStep implementation this wraps).</param> /// <param name="node">The IStepNode that should be jumped to if the branch is selected.</param> public void ConnectBranch(T branch, IStepNode node) { node.AttachTo(this); _branches[branch] = node; }