func (this *ActiveState) HandleEvent(evt fsm.Event) bool { if evt.MessageId() == EVENT_RESET_ID { fmt.Println("Active state, Received EVENT_RESET_ID") this.elapsedTime = 0 return true } return false }
func (this *StoppedState) HandleEvent(evt fsm.Event) bool { if evt.MessageId() == EVENT_STARTSTOP_ID { fmt.Println("StoppedState received EVENT_STARTSTOP_ID") stopWatch, _ := this.StateMachine().(*StopWatch) stopWatch.StateTransition(stopWatch.RunningState) return true } return false }