类图的多样性和实现(Class diagram multiplicity and implementation)

编程入门 行业动态 更新时间:2024-10-27 08:37:59
类图的多样性和实现(Class diagram multiplicity and implementation)

经过大量阅读后,我对课堂图表非常有信心。 但我不明白以下几点:

ChessManSet-<>----------16-ChessMan

为什么没有0..16? 玩家可以放松他的西洋棋棋子。 这是在我公司一位受人尊敬的设计师所做的模型中展示的,当我问到这一点时,他只说“他们仍然属于他”。 所以我有点困惑,我希望这可以作为一个列表实现,显然可以从16减少到0。

After reading a lot, I was quite confident when it came to class diagrams. Yet I do not understand the following:

ChessManSet-<>----------16-ChessMan

Why is there not 0..16? Player can loose his chessman. This was displayed in a model done by a respected designer in my company and when I asked about that, he said only "they still belong to him". So I'm a bit confused, I would expect that to be implemented as a list which obviously could decrease in its size from 16 to 0.

最满意答案

唯一可靠的是,根据您在实现中的模型或设计,您将始终拥有16个西洋棋棋子实例。 当然你可以选择实现一个可以从16减少到0的列表,但正如你所说,你必须将基数从16..16改为0..16。

The only sure thing is that according to your model or design in the implementation you will always have 16 chessman instances. Of course you can choose to implement a list which could decrease from 16 to 0 but, as you said, you have to change the cardinality from 16..16 to 0..16.

更多推荐

本文发布于:2023-07-09 14:53:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1087132.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多样性   Class   diagram   multiplicity   implementation

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!