示例#1
0
 /// <summary>
 /// 进入非正常agent
 /// </summary>
 /// <param name="preData"></param>
 /// <returns></returns>
 internal async Task MoveUnusualAgent(IExecuteData preData)
 {
     if (UnusualAgent == null)
     {
         throw new RespException(SysRespTypes.ApplicationError, "UnusualAgent is null!");
     }
     await UnusualAgent.MoveIn(preData);
 }
示例#2
0
        internal override async Task MoveSubNext(IExecuteData preData)
        {
            if (_nextAgents == null || (GatewayType == GatewayType.Branch && _nextAgents.Length == 1))
            {
                await MoveUnusualAgent(preData);

                return;
            }
            await MoveMulitAgents(preData, _nextAgents);
        }
示例#3
0
        /// <summary>
        /// 单一agent前进
        /// </summary>
        /// <param name="preData"></param>
        /// <param name="agent"></param>
        /// <returns></returns>
        internal async Task MoveSingleAgents(IExecuteData preData, BaseAgent agent)
        {
            if (agent == null)
            {
                await MoveUnusualAgent(preData);

                return;
            }
            await agent.MoveIn(preData);
        }
示例#4
0
        /// <summary>
        ///   多agent前进
        /// </summary>
        /// <param name="preData"></param>
        /// <param name="agents"></param>
        /// <returns></returns>
        internal async Task MoveMulitAgents(IExecuteData preData, BaseAgent[] agents)
        {
            if (agents == null || agents.Length < 1)
            {
                await MoveUnusualAgent(preData);

                return;
            }

            foreach (var ag in agents)
            {
                await ag.MoveIn(preData);
            }
        }
示例#5
0
        internal async Task MoveNext(IExecuteData preData)
        {
            var aCheck = await AggregateCheck(preData);

            if (!aCheck)
            {
                var release = await AggregateRelease(preData);

                if (release)
                {
                    await MoveUnusualAgent(preData);

                    return;
                }
            }
            await MoveSubNext(preData);
        }
示例#6
0
 public ExecuteController(IExecuteData executeData)
 {
     _executeData = executeData;
 }
示例#7
0
        //internal override BaseAgent[] GetNextAgentMaps()
        //{
        //    return new[] {_nextAgent};
        //}
        internal override async Task MoveSubNext(IExecuteData preData)
        {
            var agent = await(_exclusiveFunc?.Invoke(preData) ?? GetExclusiveAgent(preData));

            await MoveSingleAgents(preData, agent);
        }
示例#8
0
 protected virtual Task <BaseAgent> GetExclusiveAgent(IExecuteData data)
 {
     return(Task.FromResult <BaseAgent>(null));
 }
示例#9
0
        internal override async Task MoveSubNext(IExecuteData preData)
        {
            var agents = await(_inclusiveFunc?.Invoke(preData) ?? GetAgents(preData));

            await MoveMulitAgents(preData, agents);
        }
示例#10
0
 protected virtual Task <BaseAgent[]> GetAgents(IExecuteData data)
 {
     return(Task.FromResult <BaseAgent[]>(null));
 }
示例#11
0
 public virtual Task MoveIn(IExecuteData preData)
 {
     return(Task.CompletedTask);
 }
示例#12
0
 internal abstract Task MoveSubNext(IExecuteData preData);
示例#13
0
 /// <summary>
 ///  聚合控制释放,不再检查
 /// </summary>
 /// <param name="preData"></param>
 /// <returns></returns>
 protected internal virtual Task <bool> AggregateRelease(IExecuteData preData)
 {
     return(Task.FromResult(true));
 }