Uml Class 地铁图

Uml Class Diagram for Metro Railway

我正在尝试在 UML 中为以下问题绘制和定义 类。

An Information System of Metro Railway

Design the part of the conceptual scheme of the above system that will allow me to register the stations (by distinguishing between interchanges and terminals), the interconnection of the stations (ie the network topology) and the distances (in kilometers of the railway line) they divide.

Each train moves in a line by running consecutive routes, ie moving between prescribed extreme pairs of stations, which are not necessarily the same on each route (Eg Bronx - Manhattan, Brooklyn - Queens). Each route has a specific time of arrival and stay at each station. The actual arrival times at each station may differ from the programmed ones, as well as the speed of traffic between stations.

我的第一个想法是主要类应该是:

Metro Line, Metro Station, Metro Route, Metro Route Stop, Metro Train

我正在为如何表示预定时间和实际时间而苦恼。

让我们看看 classes,它们相当明显:

  • Metro line是一组Metro routes
  • Metro routeMetro stations
  • 的序列相关联
  • Metro route 由两个极端定义 Metro stations
  • TrainMetro routes
  • 上运行

Each route has a specific time of arrival and stay at each station.

这意味着路线不是一般路线(例如布鲁克林 - 皇后区),而是非常具体的路线(例如布鲁克林 - 皇后区从 15:03 开始)。

此外,由于多个 Metro routes 可能使用相同的 Metro station,并且由于 Metro route 由多个 Metro stations 组成,我们之间存在多对多关联那两个 classes。 时间停留既不单靠路线,也不单单从车站出发。所以最好将其视为 association class 的 属性:

您有计划入住时间和实际入住时间意味着只有两种不同的住宿。车站之间每列火车的位置告诉我们交通情况。

最后,一个更精细的处理不同时间的方法是考虑一个Time table class. The association between Metro route, Metro station and Time table would then be a ternary association,一个三元关联关联class可以保存时间数据(或者计划为计划table,或实际的 table;但您也可以有多个版本的计划,以及一年中每一天的实际版本。这将是完全灵活的。

现在,如果你不习惯table关联class,你可以将多对多关联分解成两个多对一关联,中间有一个class,你可以命名为 Route stop

最后,

这个设计是我想出来的

非常感谢