As you can see the default definitions depend on the type of the relation and the multiplicity, of course these defaults are modifiable through the generation settings.
正如你所见到的,默认的定义依赖于关联的类型和关联的重数,当然这些默认值可通过generation settings 进行修改。
The way a UML stereotype is projected for each language is also modifiable through the generation settings, as you can see above and below vector produces vector in C++ Vector in Java and sequence in IDL :
UML的范型相对于各语言来说都是屏蔽的(保护的),其实现可以通过generation settings 进行修改。下面你可见到,UML中vector 在C++中产生一个向量Vector,而在IDL中产生序列sequence。
- 37 -
Press the button Ok and look at the diagram : 按OK按钮,看图:
- 38 -
Because the relation is now bi-directional this one appears in the browser in C1 and Administrator (I mark them in the browser : they are red).
因为,现在关联是双向的,在浏览器中C1 and Administrator 中都可见到此关联。(我将它们标记为红色)
Define struct, union, typedef, enum定义结构、联合、类型定义(typedef),枚举
To define a C++ or IDL struct use the class stereotype struct, and edit the class using the Default declaration button on the desired language(s). In Java a struct is implemented through a standard class, of course the projection of a class stereotype from UML to a given language may be set through the generation settings, look at the dialog already shown below and read the reference manual.
要定义一个C++或ISDL的struc,使用类范型 struct , 使用Default declaration 按钮,针对相关的语言编辑类。在Java 中的struct 是通过一个标准的类来实现的,当然在UML的类范型到给定的语言的映射可以通过设置generation settings来完成,请看下面的对话框,并参阅参考手册。
To define a C++ or IDL union use the class stereotype union as for a struct. 要定义一个C++或IDL的联合,针对Class 使用Union 范型:
To define for instance the C++ typedef T which is a pointer to a C1 : create the class T, and draw a dependency from T to C1
例如要在C++中定义typedef T,它是指向C1的一个指针:创建类T,绘制一个从T到C1
- 39 -
的依赖关系。
Edit the class and set the stereotype to typedef : the dialog is changed to indicate a base type, thanks to the dependency this one is set to C1, but you may change it . Go in the C++ tab :
编辑此类T,设置其范型为typedef:对话框中发生改变指向其基类型。 转到C++标签:
Of course the dependency in not mandatory, for instance to define typedef int turlututu 当然,依赖性不是强制的,例如可以定义 typedef int turlututu Add a '*' between ${type} and ${name} : 在$(type)和$(name)之间増加一个’*’ :
- 40 -