Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UML decision node syntax for using objects in guard condition

Given an object array, an instance of some arbitrary class Array, which for this purpose has an attribute length.

How can I model an UML activity diagram, that, at some point, uses array.length in an control flow statement, i.e. in guards of a decision node.

array = getArray();
if (array.length > 5)
    save();
else
    waitForData();

I know that the guards of the used decision node would be [array.length > 5] and [array.length <= 5]. But I am not sure how I can integrate this with the object flow present in activity diagrams.

like image 764
mike Avatar asked Jun 27 '26 03:06

mike


1 Answers

UML does not specify how the guards should be described. It only requires it to be a logical expression i.e. one that evaluates either to true our to false. You can use a natural language, any programming language or OCL. The statement you've used is absolutely valid. Additionally you can put a status of an object on an object node, e.g. [length > 5]

like image 152
Ister Avatar answered Jun 30 '26 12:06

Ister



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!