コード例 #1
0
            /// <summary>
            /// Specify the next step and return a FlowBuilder for chaining.
            /// </summary>
            /// <param name="step"></param>
            /// <returns></returns>
            public FlowBuilder <T> To(IStep step)
            {
                IState next = _parent.CreateState(step);

                _parent.AddTransition(_pattern, next);
                _parent._currentState = next;
                return(_parent);
            }
コード例 #2
0
            /// <summary>
            /// Add flows to the split, in addition to the current state already present in the parent builder.
            /// </summary>
            /// <param name="flows"> more flows to add to the split</param>
            /// <returns>the parent builder</returns>
            public FlowBuilder <T> Add(IFlow[] flows)
            {
                ICollection <IFlow> list = new List <IFlow>(flows);
                var    name = "split" + _parent._splitCounter++;
                IState one  = _parent._currentState;
                IFlow  flow = null;

                if (!(one is FlowState))
                {
                    FlowBuilder <IFlow> stateBuilder = new FlowBuilder <IFlow>(name + "_0")
                    {
                        _currentState = one
                    };
                    flow = stateBuilder.Build();
                }
                else if (_parent._states.Count == 1)
                {
                    list.Add(((FlowState)one).GetFlows().First());
                }

                if (flow != null)
                {
                    list.Add(flow);
                }
                IState next = _parent.CreateState(list, _executor);

                _parent._currentState = next;
                return(_parent);
            }