-
Notifications
You must be signed in to change notification settings - Fork 966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Determine if a state can switch to another state #131
Comments
from the documentation: fsm.is(s) - return true if state s is the current state when getting transitions() - aren't you getting the state each transition leads you to? |
Yes, I've seen those functions - none of them address the issue of needing to know what valid states you could be switching to based on what state you are in. fsm.transitions() seems to only return the names of the possible transitions, but doesn't include which end-states these transitions go to. That why I would need something like fsm.getToState(transition) or something like that to then look up what states these possible transitions represent. I appreciate you looking into this - any other ideas?
|
from a quick look there's no quick way to do it, so either:
|
Is this still not possible? |
I have a unique use-case for these FSMs that I hope you can help me with!
I am using the FSM to track a state machine from another source. It's possible that the source could send invalid state switches... I am forcing my FSM to change to any state (using that "goto" wildcard example) but I also defined what I know to be the correct possible transitions. I would like to force my FSM switch to new state (done already), but also report that the transition was in-error because there was no defined transition that went from the beforeState to this afterState.
I can use fsm.transitions to get all possible transitions (great)... but I need to be able to see what all possible endStates are for each possible transition. Is there any way to do that?
Something like:
fsm.getAllPossibleNextStates()
or
fsm.getToState(transition)
Any help is greatly appreciated!
The text was updated successfully, but these errors were encountered: