In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces EA drawing UML diagram how to add operations and methods for the class, the article is very detailed, has a certain reference value, interested friends must read it!
Operation
The operation indicates the transition of the state of the target object or a query that returns the value to the caller of the operation. It has a name and a list of parameters, including return parameters. The action specifies the result of the behavior, not the behavior itself, which can be a method, a state machine transition, or something else.
Method
A method is a process that implements an operation that has an algorithm or procedure description that, if parsed to a method, will cause the procedure to be executed.
The above is ULM2.0 's description of the method of operation. Do you understand? anyway, I've been thinking about it for a while. Let me give you an example.
It is said that there is a driver base class, which has two derived classes, namely, the car owner and the thief. The driver class declares an operation to start the car, the car owner class uses (implemented) the car key, and the thief class uses (implemented) by connecting directly to the engine power cord (which is common in movies).
How's it going? is it any better? let's go on to today's topic.
How to open the property window:
Double-click the corresponding class block diagram in the class diagram, select [General], and click the [Operation] button.
two。 Select the corresponding class node from the model tree, open the context menu and select the [Operations...] menu item.
Either way, you can open the following operation settings dialog box. Strictly speaking, this is not to operate your own dialog box, but a common dialog box for properties and operations. This article only focuses on the operation part.
The operation of adding a new operation is mainly carried out in the red, green and blue rectangles. As in the previous article, we only describe projects that have zhi (dao) here.
Basic project
The basic project is set through the list control in the red box.
Name: variable name, you can enter text freely.
Parameters: detailed description in the parameter setting section, omitted here.
Retun Type: data type, you can enter text freely or click to choose from the drop-down menu. At the bottom of the drop-down menu, there is also a [Select Type...] option that provides the ability to select a type from a project. However, the result of the selection is only saved as text, and the role is limited to input assistance. This is the same as attribute types.
Scope: sets the visibility of the operation. Select from the drop-down list and there are four options: Public/Protected/Private/Package. Package is also optional, indicating that there is no problem. But it is treated as a Public when code is generated.
Stereotype: you can set some classification information, such as property set,property get, constructor, etc.
Expand the project
When an action is selected in the action list, you can set the extended properties of the operation.
Concurrency: the concurrency attribute used for custom operations. Possible options are:
Sequential: only one call can occur at a time. If a concurrent call occurs, the result is not guaranteed.
Guarded: concurrent calls are allowed to occur, but only one call is allowed to execute at the same time.
Concurrent: allow concurrent calls to occur and ensure that they are executed concurrently correctly.
Virtual: used to specify abstract operations (virtual functions).
Static: indicates that the operation is a class operation (static function), not an instance operation.
Parameter setting project
Parameter definition is mainly done through the [Parameters] form in the blue box. You can define multiple parameters and set their properties. The method is basically the same as the way the class sets properties, which is omitted here.
We tried to append two methods to the Person class, one is the static method GetMarryAge and the other is the virtual function Show. The Person class looks like this.
You can see that there is a horizontal line below the static method GetMarryAge, while the Show operation is represented in italics. This is how static methods and abstract operations are expressed in UML.
If that's not enough, you can go one step further and generate the code. Right-click on the Person class to bring up the context menu and select [Code Engineering]-[Generate]
Code] can call up the following generated code dialog box.
After selecting the path, press the [Generate] button, and we can get the following code.
The first is the header file.
And then cpp.
Don't do repetitive things, that's what the right approach should look like.
The above is all the content of the article "how to add actions and methods to classes in EA drawing UML diagram". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.