UML composition with bidirectional association (composing object has back-pointer)

血红的双手。 提交于 2019-12-14 04:09:52

问题


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

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?

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

Thanks


回答1:


You would use the owned end notation which is showing a dot near the owning class in the association connector.

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.

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



来源:https://stackoverflow.com/questions/31993606/uml-composition-with-bidirectional-association-composing-object-has-back-pointe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!