What's the UML syntax for multiplicity? ( insi

2019-07-21 08:20发布

I know it is possible to specify the multiplicity within the same class box, without having to draw the link to another class.

My question is, Where should the multiplicity go, after the name or after the type?

Is it:

visibility name multiplicity : type

as

+ clients [0..n] : Client

or

visibility name : type multiplicity

as

+ clients : Client [0..n]

I have two books (Applitying UML and Patterns by Larman and UML and the Unified process by Arlow and Newstadt ) but they differ

标签: oop uml ooad
2条回答
不美不萌又怎样
2楼-- · 2019-07-21 08:51

Pulled from printed page 107 of the UML 2.2 Superstructure OMG Specificiation

Example ...

+createWindow (location: Coordinates, container: Container [0..1]): Window

MORE Examples from the multiplicity element spec, on printed page 97.

Example from Spec on multiplicity.

|--------------------------------------------|
|                Customer                    |
|--------------------------------------------|
| purchase : Purchase [*] {ordered, unique}  |
| account: Account [0..5] {unique}           |
|                                            |
|--------------------------------------------|
查看更多
你好瞎i
3楼-- · 2019-07-21 09:10

UML syntax is a diagrammatic syntax. See this multiplicity example from

http://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/

Figure 6: An example of a bi-directional association between a Flight class and a Plane class

 -----------------                   -----------------
 | Flight        |0..*         0..1  |  Plane        |
 |               | ------------------|               |
 |----------------                   -----------------
查看更多
登录 后发表回答