具有双向关联的UML组合(组合对象具有反向指针) [英] UML composition with bidirectional association (composing object has back-pointer)

查看:280
本文介绍了具有双向关联的UML组合(组合对象具有反向指针)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管我确信以前已经有人问过这个问题,但我似乎在互联网上找不到合适的答案。

I can't seem to find a decent answer on the interwebs, though I'm sure it's been asked before.

基本上,我有一个对象由另一个物体组成-如此黑色的菱形和线条。父对象去世时,它组成的对象也去世。但是,由它组成的对象具有指向父对象的指针。在UML中看起来像什么?

Basically, I have an object that is composed of another object - so black diamond and line. When the parent dies, the object it composes dies. However, the object that is it composed of has a pointer back to the parent. What does this look like in UML?

编辑:例如,建筑物可能由房间组成,但是房间包含指向建筑物对象的指针

For example, a building may be composed of rooms, but the rooms contain pointers back to the building object

谢谢

推荐答案

您将使用拥有的结束符号


由最终类拥有或最终拥有的协会的最终财产is Association的navigableOwnedEnd表示该协会可以从相对两端进行导航;否则,该协会就不能从相反的方向进行导航。可导航性意味着可以从关联另一端的实例有效地访问运行时参与链接的实例(关联的实例)。实现这种有效访问的精确机制是特定于实现的。如果一端不可导航,则可能无法通过另一端进行访问,如果可以,则可能效率不高。

An end Property of an Association that is owned by an end Class or that is a navigableOwnedEnd of the Association indicates that the Association is navigable from the opposite ends; otherwise, the Association is not navigable from the opposite ends. Navigability means that instances participating in links at runtime (instances of an Association) can be accessed efficiently from instances at the other ends of the Association. The precise mechanism by which such efficient access is achieved is implementation specific. If an end is not navigable, access from the other ends may or may not be possible, and if it is, it might not be efficient.

摘自上层建筑ptc-13-09-05页。 207

From Superstructures ptc-13-09-05 p. 207

这篇关于具有双向关联的UML组合(组合对象具有反向指针)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆