开发者

transition with same start/end in UML state diagram

开发者 https://www.devze.com 2023-03-12 14:23 出处:网络
I am new to UML, regrading FSM diagram, how to represent two transitions that lead to same state, for example, I\'m in state1:

I am new to UML, regrading FSM diagram, how to represent two transitions that lead to same state, for example, I'm in state1:

when(e开发者_StackOverflowvent1)-->action1-->state2
when(event2)-->action2-->state2

I mean do I need to draw two lines from state1 to state2?


Yes, you have to draw two lines since the event and action is part of the line.

as you can see in http://en.wikipedia.org/wiki/File:UML_state_machine_Fig1.png

your line will get a text like "event1 / action1" and "event2 / action2".

If you don't generate code from your diagram, you can also use one line and add a text like "event1 / action1 OR event2 / action2" if this is more readable.

I consider UML as a guide - sometimes you have to change the rules a little bit in order to create something readable and useful. :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号