




已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Associations联合An association is a structural relationship that specifies that objects of one thing are connected to objects of another. Given an association connecting two classes, you can relate objects of one class to objects of the other class. Its quite legal to have both ends of an association circle back to the same class. This means that, given an object of the class, you can link to link to other objects of the same class. An association that connects exactly two classes is called a binary association. Although its not as common, you can have associations that connect more than two classes; these are called n-ary associations. Graphically, an association is rendered as a solid line connecting the same or different classes. Use associations when you want to show structural relationships. Beyond this basic form, there are four adornments that apply to associations.联合是一个结构关系,它描述一个事物的对象连接另一个事物的对象给定一个关联连接两个类,你能建立一个类的对象和另一个类的对象之间的联系一个联合的一端从一个类出发而另一端又回到这个类的关联是符合规则的连接两个类的联合被称为二元联合尽管不是很常见,但是可以有连接超过两个类的联合;这被称为n级联合图形显示上,联合表现为一条连接相同或不同的类的实线在你想显示结构关系时使用联合除了基本形式,还有四个修饰适用于联合Name An association can have a name, and you use that name to describe the nature of the relationship. So that there is no ambiguity about its meaning, you can give a direction to the name by providing a direction triangle that points in the direction you intend to read the name, as shown in Figure 5-4.名称:一个联合可以有名称使用这个名称以描述关系的特征,以便对它的含义没有歧义你能通过带有方向的三角形给名称提供方向,以指出从哪边开始读名称,如图5-4显示的Note: Although an association may have a name, you typically dont need to include one if you explicitly provide end names for the association. If you have more than one association connecting the same classes, it is necessary to use either association names or association end names to distinguish them. If an association has more than one end on the same class, it is necessary to use association end names to distinguish the ends. If there is only one association between a pair of classes, some modelers omit the names, but it is better to provide them to make the purpose of the association clear.备注:尽管联合可能有名称,但如果你明确地为联合两端提供名称,那么通常就不需要再包含一个如果有超过一个联合关联连接同一个类,有必要使用联合名称和联合端名称以示区分,如果一对类之间只有一个联合,有些模型会省略名称,但最好别那么做,以便清晰联合的意图Role When a class participates in an association, it has a specific role that it plays in that relationship; a role is just the face the class at the far end of the association presents to the class at the near end of the association. You can explicitly name the role a class plays in an association. The role played by an end of an association is called an end name (in UML 1, it was called a role name). In Figure 5-5, the class Person playing the role of employee is associated with the class Company playing the role of employer.角色:当一个类加入到一个联合中,应该有一个特定的角色以使用这个关系;一个角色面对的是联合关联中远端的那个类,代表的是联合关联中近端的这个类在一个联合关联里,你可以明确地为类的使用者角色命名由联合关联的一端扮演的角色被称为端名(在UML1.0中,它被称之为角色名)在图5-5中,人这个类扮演着职员角色联合到公司这个类所扮演的雇主角色中Note: The same class can play the same or different roles in other associations.备注:同样的类能在其它的联合中扮演同样的或不同的角色Note: An attribute may be regarded as a one-way association owned by a class. The attribute name corresponds to the end name on the association end away from the class.备注:属性可以被视为一个类所拥有的单向联合属性名称与这个联合的端名(离这个类更远的那个端点)一致Multiplicity An association represents a structural relationship among objects. In many modeling situations, its important for you to state how many objects may be connected across an instance of an association. This “how many “ is called the multiplicity of an associations role. It represents a range of integers specifying the possible size of the set of related objects. It is written as an expression with a minimum and maximum value, which may be the same; two dots are used to separate the minimum and maximum values. When you state a multiplicity at the far end of an association, you are specifying that, for each object of the class at the near end, how many objects at the near end may exist. The number of objects must be in the given range. You can show a multiplicity of exactly one (1), zero or one (0.1), many (0.*), or one or more (1.*). You can give an integer range (such as 2.5). You can even state an exact number (for example, 3, which is equivalent to 3.3).For example, in Figure 5-6, each company object has as employee one or more person objects (multiplicity 1.*); each person object has as employer zero or more company objects (multiplicity *, which is equivalent to 0.*)多态:一个联合表示对象之间的结构关系在大多数的建模情况下,重要的是你要声明多少个对象可以连接一个联合的一个实例这里的”多少”被称为一个联合角色的多态它表现为一个整数范围以指定相关对象集的可能大小被书写为最小值和最大值的表达式,两个值可能一样;用两个小数点将最小值和最大值分开当你为一个联合的远端那个类表述一个多态性时,你就为近端这个类的每一个对象指定在近端存在多少个对象对象的数量必须在给定的范围之内你可以用()表示只有一个多态,用(.)表示有个或是一个多态,用(.)表示许多,或是(.)表示一个或更多你还可以给定一个整数范围(如.),甚至是表达为一个精确的数字(如,这等价于.)举个例子,在图中显示的,每个公司对象有一个或更多个人对象做为雇员(多态性.);每个人对象有个或多个公司对象做为雇主(多态性,等价于.)Aggregation A plain association between two classes represents a structural relationship between peers, meaning that both classes are conceptually at the same level, no one more important than the other. Sometimes you will want to mode a “whole/part” relationship, in which one class represents a larger thing (the “whole”), which consists of smaller things (the “parts”). This kind of relationship is called aggregation, which represents a “has-a” relationship, meaning that an object of the whole has objects of the part. Aggregation is really just a special kind of association and is specified by adorning a plain association with an unfilled diamond at the whole end, as shown in Figure 5-7.聚合:两个类之间的等价联合表现的是对等的结构关系,也就是两个类在概念上属于同一层次,没有谁比谁更重要有时你想构建”整体部分”关系模型,其中一个类表现更大的事物(“整体”),它由更小的事物组成(“部分”)这一类的关系被称之为”
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年中国激光功率监视器行业市场发展前景及发展趋势与投资战略研究报告
- 脑梗死护理指南
- 理财培训课件
- 2025-2030年中国140g瓦楞纸箱行业深度研究分析报告
- 中国浓缩鱼油软胶囊行业市场深度研究及投资战略规划建议报告
- 切朴机行业深度研究分析报告(2024-2030版)
- 中国六角钻尾钉行业市场发展前景及发展趋势与投资战略研究报告(2024-2030)
- 2025年 宜昌市市级机关遴选考试笔试试题附答案
- 2025年 湖南大学幼儿园招聘考试笔试试题附答案
- 2025-2030年中国盐基青莲粒行业深度研究分析报告
- TTJSFB 002-2024 绿色融资租赁项目评价指南
- 无人机培训计划及方案
- 临终关怀中的文化敏感性
- 河湖生态系统保护与修复工程技术导则
- 运动改造大脑阅读记录
- DL∕T 2011-2019 大型发电机定子绕组现场更换处理试验规程
- 从黄土高原视角品黄河生态变迁智慧树知到期末考试答案章节答案2024年西北工业大学
- 电通量高斯定理课件
- 广东省东莞市2023-2024学年高二下学期7月期末英语试题
- 2024年云南省职业院校技能大赛(中职组)植物嫁接赛项考试题库(含答案)
- 河北省建设项目概算其他费用定额
评论
0/150
提交评论