In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to create a class template in EA UML drawing, I believe most people don't know much about it, so share this article for your reference. I hope you will gain a lot after reading this article. Let's go to know it together.
Create a class template
Suppose we are going to create a mapping class (hypothetically, don't actually create it) MyMap, which takes two parameters, one is Key, and the other is element T.
First create a normal class and set the class name to MyMap.
Someone must have typed MyMap directly when typing the class name, and the generated class diagram looks like this.
That seems to be the case, but it doesn't generate the correct code. So let's get back on track. Just type MyMap.
Next, select the [Templates] category and add two parameters, Key and T, to the [Template Parameter (s)] list space, and Type is specified as class.
When you press the OK button to return, the class diagram looks like this.
The generated code is as follows:
Use class templates
As an example, we use MayMap to instantiate a class named PersonMap, which manages the mapping from integers to Person*.
First create a normal class called PersonMap.
Select the icon below from the [Class Relationsships] group on the toolbar.
Then drag the mouse from the PersonMap class to the MyMap class to establish a connection between the two classes.
Double-click the "bind" connector to open the properties dialog box and select the [Binding] category, then press the [Add] button to add parameters to the [Parameter Substitution (s)] list.
As shown in the figure above, the Formal column can select the Key and T parameters. They are all defined in the MyMap class template. Continue, specifying the contents of the Key and T parameters.
The class diagram will look like this. Please pay attention to the changes in the red circle.
The corresponding code is as follows.
Very little valid code is generated, but this is the right code. In UML, this is called display binding.
There is also an implicit binding in UML that does not specify a new type name, but unfortunately the author has not found a suitable expression in EA. If you are reading this article, please do not hesitate to comment.
These are all the contents of the article "how to create class templates in EA drawing UML diagrams". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more 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.