On p. 190 of the UML 2.5.1 specification document, the constraint ParameterSet::two_parameter_sets
is defined like this:
• two_parameter_sets
Two ParameterSets cannot have exactly the same set of Parameters.
inv: parameter->forAll(parameterSet->forAll(s1, s2 | s1->size() = s2->size() implies
s1.parameter->exists(p | not s2.parameter->includes(p))))
There are some very interesting general remarks about ParameterSet
in this 6-page document: On the Pitfalls of UML 2 Activity Modeling beginning with the last paragraph on page 3. It poses the question of ParameterSets
which are subsets of another ParameterSet
. Just from perusing this constraint, it would appear to fail if such a subset existed.
However, now to my more general question: How do we evaluate the last OCL includes()
operation in the above constraint implementation? What features identify two parameters as being equal? Comparing names probably isn't such a good idea ... for example, at least in some languages, a function declaration can have unnamed parameters:
int Foo(int, int, int);
The only way to determine that the three int
parameters are different would be to consider their order, assuming that their direction
, etc. are also equal. However, the parameters in a ParameterSet
are not ordered. I haven't found any UML method for determining the equality of parameters in an unordered set.
Determining whether two elements are equal is very simple: They are equal when they are equal. Remember that model elements have an identity independent of any properties they have. So, it is easy to find out when two references point to the same model element or if an element is included in a given set of elements.
I don‘t see a problem with a Parameterset being a subset of another set. That means they are different - as required. It is possible that two or even more Parametersets have the required number of tokens. The specification simply says “ one is chosen non-deterministically“.