ValyardStateMachine Swift port of Finite State Machine originally implemented by Valyard in ActionScript 3