Пример #1
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);
            }
Пример #2
0
 /// <summary>
 /// Custom constructor with parent and executor
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="executor"></param>
 public SplitBuilder(FlowBuilder <T> parent, ITaskExecutor executor)
 {
     _parent   = parent;
     _executor = executor;
 }
Пример #3
0
 /// <summary>
 /// Custom constructor using parent and pattern.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="pattern"></param>
 public TransitionBuilder(FlowBuilder <T> parent, string pattern)
 {
     _parent  = parent;
     _pattern = pattern;
 }