Beispiel #1
0
        //根据输入的命令得到下一个状态
        public ProcessState GetNextState(Command command)
        {
            StateTransition transition = new StateTransition(CurrentState, command);
            ProcessState    nextState;

            if (!transitions.TryGetValue(transition, out nextState))
            {
                throw new Exception("invalid transition: " + CurrentState + "->" + command);
            }
            return(nextState);
        }
Beispiel #2
0
            public override bool Equals(object obj)
            {
                StateTransition other = obj as StateTransition;

                return(other != null && this.CurrentState == other.CurrentState && this.command == other.command);
            }