The referenced UML 2.1 Specification, section 7.3.36, seems to me to be self contradictory.
Under Constraints it says:
[1] An operation can have at most one return parameter (i.e., an owned parameter with the direction set to ‘return’).
ownedParameter->select(par | par.direction = #return)->size() <= 1
Then under Notation it says:
• ordered means that the values of the return parameter are ordered.
• unique means that the values returned by the parameter have no duplicates.
I don't know how one can talk (meaningfully) about
uniqueness and
ordering of a
single return parameter. I can only reason that UML's implicit intent is to specify, on an operation that returns a multiplicity of elements, that the single parameter returned is a reference to a set of either the elements themselves, or secondary references to them. Otherwise, I cannot resolve the contradiction.
The UML is silent on how all of this is implemented in code; e.g.; array, collection, list, object, etc. That would be platform specific. In a [PIM], I would define a class to hold the set elements and then return an object of that type. Then, in the [PSM], that class may be sub-typed to take advantage of the implementation language used.
I don't see how the Semantic Variations section enters into this issue. But I too, am confused by the
Return Array name on the check box. Perhaps EA can improve upon the name they chose?
Array is too data structure specific for my tastes. What if the operation returns a reference to the head of a linked list or the root of a tree? Perhaps
Returns Set or
Returns multiplicity?