Let me summarize my question as follows,
I know that the stateMachine.sendEvent(Event e)
returns a boolean value representing if the event triggers a transition or not, but it also triggers the transition if true
.
However, I want only to check if the state machine is triggerable by that event or not, and not to trigger the transition afterwards. Is there any way to do that?
CodePudding user response:
There is no built-in method to do that, but once you retrieve an instance of a StateMachine, you can implement a method to iterate over the transitions looking for the current state and check what are the available transitions for that state. Each AbstractTransition contains a source and target state
machine.getTransitions()