Finite state machine in Objective-c