简体   繁体   English

用UML显示递归方法

[英]Showing a recursive method with UML

Is there a way to show a recursive method with UML class diagram modelling? 有没有办法用UML类图建模显示递归方法?

类图

In the above class I have a static method Calculate and I want to show that this method alone calls itself recursively and not any other methods or the class. 在上面的类中,我有一个静态方法Calculate,我想表明这个方法本身是递归调用自身而不是任何其他方法或类。 How do I show this in UML? 如何在UML中显示?

In sequence diagrams you can show method calls made by a method, it is therefore possible to show a method is recursive (caling itself). 在序列图中,您可以显示由方法进行的方法调用,因此可以显示一个方法是递归的(caling本身)。 A class diagram, on the contrary, models only the static structure of the system. 相反,类图仅模拟系统的静态结构。 If you want to emphasize a method is recursive, the only way is to use a comment 如果要强调方法是递归的,唯一的方法是使用注释

您可以“递归地”使用构造型或添加标记值“recursive = true”来添加该信息。

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

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