コード例 #1
0
        /// <summary>
        /// Method to process the input.
        /// TODO: Currently State Machine on a single match
        /// Will need immediate change
        /// </summary>
        /// <param name="interpreter">Rule Interpreter as provided by dependency injection.</param>
        /// <param name="input">Input object to process</param>
        /// <returns>Returns the State loaded after processing the input over the rule file.</returns>
        internal State <T> Process(IRuleInterpreter interpreter, T input)
        {
            inputBuffer.Add(input);
            List <IRule> nextRules
                = interpreter.LoadEvent <List <T> >(this.rule
                                                    , interpreter.CreateTransitionEvent <List <T> >(inputBuffer)
                                                    , Config <T> .GetInstance().stateMachineInputComparer);

            if (nextRules.Count == 0 ||
                nextRules[0].Name == this.Name)
            {
                return(this);
            }

            return(State <T> .Create(nextRules[0]));
        }