简体   繁体   English

这两个类之间应该使用什么UML关系?

[英]What UML relation should I use between these two classes?

I have a class called "EventManager" and one called "Event". 我有一个叫做“ EventManager”的类,还有一个叫做“ Event”的类。 From Eventmanager I can created and store events in a linkedlisted, which then is stored in a hashmap together with "persons" who attend these events. 通过Eventmanager,我可以创建事件并将其存储在链表中,然后将其与参加这些事件的“人员”一起存储在哈希图中。 Now, which relationship(UML) between Event and Eventmanager? 现在,事件和事件管理器之间有哪些关系(UML)?

I think it's an HAS-A. 我认为这是HAS-A。 Since EventManager contains Events. 由于EventManager包含事件。

Use simple association. 使用简单的关联。 EventManager is not composed of Events. EventManager不是由事件组成的。 It only provide list of events to process. 它仅提供要处理的事件列表。 Another association would be created between event and person. 在事件和人之间将创建另一个关联。

I also think it is HAS-A relationship as EventManager class has Event class as its data member. 我还认为这是HAS-A关系,因为EventManager类具有Event类作为其数据成员。

Simple association will not suffice in this case. 在这种情况下,简单的关联是不够的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM