简体   繁体   English

我在我的UML图中放了'const'吗?

[英]Do I put 'const' in my UML diagram?

I'm making a UML diagram using Dia . 我正在使用Dia制作UML图。 Do I need to put const in the diagram when a function is const ? 我需要把const图中当一个功能是const If so, where? 如果是的话,在哪里?

Chapter 11.8.2 ("Operation") in the latest UML specification lists isQuery as one of the operation's attributes: 最新的UML规范中的第11.8.2节(“操作”)列出了将isQuery作为操作的属性之一:

isQuery : Boolean - Specifies whether an execution of the Operation leaves the state of the system unchanged (isQuery=true) or whether side effects may occur (isQuery=false). isQuery:Boolean - 指定Operation的执行是否保持系统状态不变(isQuery = true)或是否可能发生副作用(isQuery = false)。 The default value is false. 默认值为false。

If operation that does not change system's state is shown in a diagram, property {query} should be added after function's return type. 如果在图中显示不改变系统状态的操作,则应在函数的返回类型之后添加属性{query}

Dia supports isQuery attribute for class' operations: open class' Properties window and in Operations tab tick Query checkbox for method that does not change class' state and const will appear after method's return type in a diagram. Dia支持类'操作的isQuery属性:打开类' 属性窗口,在操作选项卡中勾选查询复选框,用于不改变类'状态的方法, const将在方法的返回类型后出现在图中。

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

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