Book a Demo

Author Topic: How to model conditional actions?  (Read 12077 times)

EricP

  • EA User
  • **
  • Posts: 122
  • Karma: +0/-0
    • View Profile
How to model conditional actions?
« on: April 25, 2010, 02:36:26 am »
What is the best kind of UML diagram to use to model this?

I have a process with five inputs, A thru E, and three processes, X thru Z.

If A and !B and C and !D and E then execute processes X and Z.
(where !B means "not B")

If A and B and !C (don't care about D and E) then execute processes Y and Z.

IF A and B and C and !E (don't care about D) then execute process Y alone.

A thru E come at me in a message, and X thru Z are things that get done in response to the message contents.  I thought a sequence chart would be good for modeling this but I can't figure out how to do that kind of combinatorial logic in a sequence chart or even if it can be done.

What else would be better?

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: How to model conditional actions?
« Reply #1 on: April 25, 2010, 10:00:11 pm »
You can model this in sequence or interaction diagrams using fragments (http://www.sparxsystems.com/uml_tool_guide/code_engineering/localpaths.htm), but it can easily get out of hand when conditions are becoming too complex. Gates (http://www.sparxsystems.com/uml_tool_guide/uml_dictionary/diagramgate.htm) can help to split it up.

For complex conditions you could use activity diagrams with  conditional nodes (http://www.sparxsystems.com/uml_tool_guide/uml_dictionary/loop_and_conditional_nodes2.htm).

Paul Lotz

  • EA User
  • **
  • Posts: 248
  • Karma: +1/-0
    • View Profile
Re: How to model conditional actions?
« Reply #2 on: April 27, 2010, 04:51:06 am »
I think you can do this with statemachine diagram without too much trouble.  You can define A through E as signals on the triggers.