Esempio n. 1
0
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
}
Esempio n. 2
0
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
}