//根据输入的命令得到下一个状态 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); }
public override bool Equals(object obj) { StateTransition other = obj as StateTransition; return(other != null && this.CurrentState == other.CurrentState && this.command == other.command); }