public boolean transit ( T transition ) { S currentState = definition . getState ( currentStateId . get ( ) ) ; if ( currentState != null ) { try { Transition < S > transitionDef = definition . getTransition ( currentState , transition ) ; return currentStateId . compareAndSet ( transitionDef . fromStateId , transitionDef . toStateId ) ; } catch ( IllegalArgumentException iae ) { return false ; } catch ( NullPointerException npe ) { return false ; } } return false ; }
Transit from current state to another . The method is multi - thread safe .