The following describes how to create a static class chart. Open the default graph () and select class ( ), And then create a class "Store" in the figure ". Select this object, press F4 to open the Properties window, and click the button on the Right of stereotype to select the prototype as "place" (location, indicating the recording Such as the nature of the store), repeat the above steps, set clerk to "role", and set "item" to "Description ). In addition, you can right-click the graph, select Add-> class, or right-click the root node in the model view, and select Add-> class. Static class diagram created, 15th: Figure 15: initial static class diagram Create a member for a class: Right-click store and select Add-> field to add a new attribute. Value assignment: Address: string. Click the F4 key to bring up the attribute editing window. Click the visibility field and select private attribute from the drop-down list. Missing In case of saving, together vs. NET will create the public int domain and the Public void method. Add a method for store, right-click the store class, and select Add-> method. Use the embedded editor to name the method findbytitle. For more information about the attributes and methods of each class, see table 1. The final store sixteen is shown as follows:
figure 16: composition of the store class |
class |
fields |
methods |
store |
address |
findbytitle |
|
storenumber |
findbykeywords |
|
hours |
findbyitemnumber |
clerk |
employee ID |
|
|
name |
|
item |
itemnumber |
getitemnumber |
|
title |
setitemnumber |
|
|
gettitle |
|
|
settitle |
|
Table 1: attributes and Methods |
|
|
Figure 17: Set an attribute alias |
You can use Ctrl + W to add an attribute, CTRL + m to add a method, and use f2 to name or rename the attribute. Select the storenumber attribute and set its alias in the attribute window, for example, "Store Number ", 17. Of course, you can also set a Chinese alias to facilitate communication. Right-click and choose GOTO Definition can be used to viewCode(18th) Figure 18: automatically generated code and alias of together Create a link and a connection. There are two relationships in this instance: one is that clerk is associated with the store, and the other is that the store contains several Items. The relationship between clerk and store is similar to that between "customer" and "supplier", while for store and items, it is obviously an aggregation relationship. (Aggragation ). Click Association. Click the link button, and then click store and drag it to clerk. This action establishes a relationship between the customer and the supplier (Figure 19 ): Figure 19: establishing a relationship between store and Clerk In another new association between store and item, the attribute window is used to define the connection type and the aggregation attribute is defined from the type attribute. Create a hyperlink. Video Store has a method called findbykeywords to find the videotape. By using hyperlink, you can quickly determine the relationship type between the graph and the element and record it in the model for its In this example. Open the use case diagram and right-click "find item ". Keywords "Use Case, select hyperliks-> edit, a dialog box (Figure 20) appears, starting from" available Select video in the content panel Store-> store-> findbykeywords, click Add to add the selected elements to the right panel, and click OK. In this case, the newly created use case exceeds The level link is displayed in blue (Figure 21 ). Figure 20: hyperlink dialog box Figure 21: use case diagram after creating a hyperlink Create a sequence diagram. Sequence diagrams are used to design the dynamic effects of object models. In the model view, right-click the video Store the root node, add-> Other digoal. In the displayed dialog box, select "sequence digoal" and rename it as "Rent Movie sqquence, and click OK. Select "UML interaction" from toolbox Digoal, click the actor button, place it in the figure, rename it to "clerk", click the object button, and click the right side of the actor timeline to rename the object "Thestore ". Click the "message" button in the toolbox to add a message connection and drag the actor timeline to thestore timeline to complete the sequence diagram. (Figure 22 ): Figure 22: sequence diagram Right-click thestore object and select choose Class-> store. The Final sequence diagram is displayed. Note that the object name is already associated with the corresponding class. Click message chain and select choose Method-> findbytitle (): void, which associates the message chain with a method (figure 23 ): Figure 23: associate a message chain with a method Converts a sequence diagram to a collaboration diagram. Right-click the sequence diagram and select "show ". As Collaboration menu command to open the collaboration diagram. In this case, the plotting tool related to the collaboration diagram is displayed in the toolbox. Right-click on the collaboration diagram to convert the context menu to the order In the column chart. |