问题
I'm in the process of getting my head around UML state digrams while analysing the states that one of our customers can have. I'm attempting to use a composite state with orthogonal regions in which one state in one reason is the trigger for at least one state change in another orthogonal reason.
I realise that I might be trying to use the wrong paradigm to model this, so feel free to correct me on that basis, but there is a simplified but slightly more detailed explanation of the situation for the purposes of this question:
- A customer's "Active" state has 3 orthogonal regions, I'll call them R1, R2 and R3
- R1 has "account withdrawal disabled" and "withdrawal enabled" states
- R2 has "ID not verified" and "ID verified" states
- R3 has "Cash-only account" and "credit account"
The change in R3 from "cash-only" to "credit" can only occur once R1 is in "withdrawal enabled" state and R2 is in "ID verified" state - plus another trigger.
When drawing the state diagram, is there a valid way to make one state transition in one orthogonal region (at least partially) dependent on a set of states in other orthogonal regions? If not, what other ways could I represent this?
(By the way, I had thought of modelling the account states separately but the discussions in the domain is such here that it feels more useful to integrate that as part of a customer's state)
Thanks in advance for your help.
回答1:
I'd use a guard like this
assuming that R1
and R2
are state machines on their own.
Maybe there is a more formally correct way to describe the guard. But I guess a reader can grasp the idea behind it.
来源:https://stackoverflow.com/questions/43460978/uml-state-diagram-cross-orthogonal-region-triggers