Book a Demo

Author Topic: Same Submachine multiple times in a state machine  (Read 5212 times)

pH

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Same Submachine multiple times in a state machine
« on: June 28, 2010, 10:28:45 pm »
Hi All,

UML Spec says, "The same state machine may be a submachine more
than once in the context of a single containing state machine."

If I try to do this in EA, I get a message saying that it
"The diagram already contains an instance of the element you are trying to paste. Currently, only one instance is supported,So you cannot paste the element here"

IS it is a limitation or is there another way to do it ?

Thanks,
pH
<a href="http://webuml.org"><img src="http://webuml.org/images/webuml-badge.png" alt="Set UML Free!" style="border-width:0"></a>

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Same Submachine multiple times in a state mach
« Reply #1 on: June 28, 2010, 11:32:38 pm »
Ph,

I think you have indeed met a limitation in EA.
I would report it as a bug.
What you could do as a workaround is to create two states and make both composite, linking to the same state machine diagram.

(drag the diagram under the state, and then go advanced/make composite, then drag the diagram under the next state, and repeat)

Geert

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Same Submachine multiple times in a state mach
« Reply #2 on: June 29, 2010, 12:02:56 am »
I don't think it's a bug. The way I understand the specification, you can add multiple instances of a state machine as submachines to a containing state machine, an this is no problem with EA.

For in- and outgoing transitions you will need Entry- and Exit Points in the submachine definition and make them visible in the instances, but EA allows this too.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Same Submachine multiple times in a state mach
« Reply #3 on: June 29, 2010, 01:11:23 am »
Frank have you tried adding instances of statemachines to a diagram?

Geert

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Same Submachine multiple times in a state mach
« Reply #4 on: June 29, 2010, 05:24:22 am »
Quote
Frank have you tried adding instances of statemachines to a diagram?

Geert, I thought I had, but maybe it was just a dream...

Tried it again right now and found the "Embedded elements" context menu missing on state machines (it's there on states, though). I seem to recall that it was there in EA 7.5.

Anyway, you can still do it with multiple instances of a  complex state: Define a state somewhere (e.g. "Connection"), mark it as "composite", define substates (e.g. "Connected", "Connecting", ...), and use the "Embedded elements" context menu to define entry and exit points (e.g. "StartConnect", "ConnectSucceeded", ...). Don't use the entry and exit points from the tool box, they won't work!

Then drag instances of the state into your state machine and name them accordingly (e.g. "DBConnection", "SerialConnection", ...) and use the "Embedded elements" context menu to select the entry and exit points you want to use with each instance.


pH

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Same Submachine multiple times in a state mach
« Reply #5 on: June 29, 2010, 03:16:06 pm »
Thanks for your replies and workarounds. I will report this as a bug.

Yes.. The entry exit points work from emebedded elements but from tool box are not tied to the state. Looks like it might be another bug.

pH
<a href="http://webuml.org"><img src="http://webuml.org/images/webuml-badge.png" alt="Set UML Free!" style="border-width:0"></a>

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Same Submachine multiple times in a state mach
« Reply #6 on: July 30, 2010, 04:41:43 pm »
In the meantime I needed exactly this featue and couldn't get it to work. My bug report has been handled, however:

http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1279878885/0#3