Ejemplo n.º 1
0
            public void Execute(IExecutor[] executors)
            {
                tokenCommand = executors[1].ResultToStr;
                tokenSrc     = executors[2].ResultToStr;
                tokenDest    = executors[3].ResultToStr;
                tokenValue   = executors[4].ResultToInt;
                tokenWeight  = executors[5].ResultToInt;

                if (string.IsNullOrEmpty(tokenCommand) ||
                    string.IsNullOrEmpty(tokenSrc) ||
                    string.IsNullOrEmpty(tokenDest))
                {
                    throw new InvalidOperationException("invaild finish result: token is null");
                }

                if (Object.ReferenceEquals(Constants.IF, tokenCommand))
                {
                    token = TokenFactory.Create(TokenFlag.Read, tokenSrc, tokenDest, tokenValue, tokenWeight);
                }
                else if (Object.ReferenceEquals(Constants.AND, tokenCommand))
                {
                    token = token.AND(tokenSrc, tokenDest, tokenValue, tokenWeight);
                }
                else if (Object.ReferenceEquals(Constants.OR, tokenCommand))
                {
                    token = token.OR(tokenSrc, tokenDest, tokenValue, tokenWeight);
                }
                else if (Object.ReferenceEquals(Constants.ACT, tokenCommand))
                {
                    token = token.ACT(tokenSrc, tokenDest, tokenValue, tokenWeight);
                }
            }