Book a Demo

Author Topic: Switch/Case modeling in EA UML  (Read 8163 times)

HansChandra

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Switch/Case modeling in EA UML
« on: April 19, 2013, 10:43:37 pm »
Hello,
Does anyone have an example of a switch-case UML implementation in te EA context?  I could not find one in the documentation or online.  I hate to implement it as a series of if..else statements.

Thanks,
Hans.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Switch/Case modeling in EA UML
« Reply #1 on: April 19, 2013, 10:57:05 pm »
In a sequence diagram you can use an alt fragment.
What type of diagram are you trying to use?

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Switch/Case modeling in EA UML
« Reply #2 on: April 19, 2013, 11:09:09 pm »
Quote
Hello,
Does anyone have an example of a switch-case UML implementation in te EA context?  I could not find one in the documentation or online.  I hate to implement it as a series of if..else statements.

Thanks,
Hans.
Both are just two syntax variants of the same semantic. Basically it boils down to a compare/jump.

q.

HansChandra

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Switch/Case modeling in EA UML
« Reply #3 on: April 19, 2013, 11:17:20 pm »
Quote
In a sequence diagram you can use an alt fragment.
What type of diagram are you trying to use?

Geert

Geert - I am using an activity diagram.  Thanks!

HansChandra

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Switch/Case modeling in EA UML
« Reply #4 on: April 19, 2013, 11:19:15 pm »
My expectation would be to see the switch /case construct in the generated code. Hope this claridfies my question a little more.

Thanks,
Hans.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Switch/Case modeling in EA UML
« Reply #5 on: April 20, 2013, 12:39:16 am »
IIRC the code body is taken from the operation/behavior properties. And what is in there is up to you. I might be wrong as I'm not a code gen power user.

q.

HansChandra

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Switch/Case modeling in EA UML
« Reply #6 on: April 20, 2013, 01:16:49 am »
I agree. I was wondering whether there is something that I could specify in the model to generate a switch/case construct ( C code) as opposed to a series of if/else statements.   I admit both end up doing the same thing once the compiler gets done with it.  I prefer switch/case in the particular code section I am modeling.

Thanks.
H.