public CastleProcessState GetNext(CastleCommand command) { StateTransition transition = new StateTransition(CurrentState, command); CastleProcessState nextState; if (!transitions.TryGetValue(transition, out nextState)) { throw new Exception("Invalid transition: " + CurrentState + " -> " + command); } return(nextState); }
public CastleProcessState MoveNext(CastleCommand command) { CurrentState = GetNext(command); return(CurrentState); }
public StateTransition(CastleProcessState currentState, CastleCommand command) { CurrentState = currentState; Command = command; }