Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [uml2-dev] UML 2.0 and templates


Chris,

This mailing list is reserved for issues related to development of the UML2 project. Please address future questions to the newsgroup.

The most confusing thing here (I think) is that TemplateParameter is not really a parameter but effectively a pointer to the element that is the parameter. Once you realize that, things should become a little clearer. Properties like name, type, and owned rules (constraints) are specified on the parameterable element referenced by a template parmeter.

The notation for classifier template parameters (from the specification) is as follows (note the use of '>', not '<'):

<classifier-template-parameter> ::= <parameter-name> [ ‘:‘ <parameter-kind> ] [‘>’ <constraint>] [‘=’ <default>]
<constraint> ::= [‘{contract }’] <classifier-name>
<default> ::= <classifier-name>

Figure 432 shows an example of a template class with a constrained class parameter (i.e. 'CarEngine > Engine' indicates that the class named 'CarEngine', referenced by a classifier template parameter, is constrained to conform to the class named 'Engine'). Note that the metaclass can be (and is) suppressed because it is 'class'. In your example, the notation would be T : class > MyClass1 (or equivalently T > MyClass1).

Cheers,

Kenn Hussey

Eclipse UML2 Project Lead
Rational Software, IBM Software Group

770 Palladium Drive
Kanata, Ontario, K2V 1C8

T: (613) 599-3980  F: (613) 599-3912



"Christoph Rathkolb" <christoph.rathkolb@xxxxxxxxxx>
Sent by: uml2-dev-bounces@xxxxxxxxxxx

07/26/2005 04:21 AM

Please respond to
"This mailing list is used to discuss the development issues for the  UML2 project. "

To
<uml2-dev@xxxxxxxxxxx>
cc
Subject
[uml2-dev] UML 2.0 and templates





Hi !

One question regarding the template-sample Figure 430 (page 692):

template Class "FArray" mit "T, k:IntegerExpression = 10"

According to the UMLSpecification:
In which modelelements and where whould be stored
*) the name of the template parameters (i.e. T, k) ?

*) the type of the template parameters ( no type (= class), IntegerExpression) ?

Additionally (not shown in the sample): where would possible constraints be stored ?
E.g. when the type should be of kind "MyClass1" ?

According to the specification, behind the ":" should be the metaclasskind and possible constraints behind a "<",

Which would mean e.g. "T : class < MyClass1" ? But wouldn't this be missleading with the UML 1.x notation and also to the sample above ?

In my opinion the spec is confusing in this part - maybe somebody can enlighten me ?

Many thanks and cheers,
Chris
_______________________________________________
uml2-dev mailing list
uml2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/uml2-dev


Back to the top