Open Rob117 opened 5 years ago
@Rob117 operations like stateMachine.validEventsFor(State.Liquid) // -> list(Event.OnFroze, event.OnVaporized)
are not well supported because of the way state machine is implemented.
What state<State.Solid>
, on<Event.OnCondensed>
, on("A State")
, and on("An Event")
create are matchers, which are defined by a list of closures stored here.
Because the relationship between states and events is computed at runtime using closures, I don't think it is possible to extract all valid events for a state.
Got it. I statically defined an event list, and it worked for my use case. Thank you for your response though!
If this is confusing, please let me know.
Given the test code:
I want to know how I could, for example, do stateMachine.validEventsFor(State.Liquid) // -> list(Event.OnFroze, event.OnVaporized)
Is there a way to do this, even with reflection?