Reputation: 5055
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.
Upvotes: 3
Views: 504
Reputation: 6318
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]
Upvotes: 2