问题
Is it possible to reuse an operation call of a class as transition in an UML diagram of Sparx Enterprise Architect (I've got version 9)? If yes, how do I do that?
It's possible to use it as action in an activity diagram and as message in an object diagram, but I can't figure it out for the state machine. I wish there was more integration for software developers...
Furthermore, I wish I could set a state in the diagram as special state of a class instance (class instance == object).
回答1:
Is it possible to reuse an operation call of a class as transition in an UML diagram ...?
Yes. In the state machine diagram: Open the transition properties, enable "Effect is Behavior" and select the operation from the browser.
It's possible to use it as action in an activity diagram ...
Yes. Add a 'Call Operation' action to the activity diagram. Goto, "action properties" -> "Call" and select the operation from the "Behavior:" menu.
... and as message in an object diagram ...
Yes. Draw a link between the objects on the object diagram, right-click the link and select "Add message from ... " (where "..." is the desired direction). Double-click the message and select the operation from the "Message:" drop-down list.
来源:https://stackoverflow.com/questions/33563076/how-to-set-a-class-operation-call-as-transition-in-an-uml-state-machine-diagram