Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize interaction and Interactive use in EA drawing UML sequence Diagram

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to achieve interaction and interactive use in EA drawing UML sequence diagrams. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Interaction (interaction)

Interaction describes how messages are exchanged between roles in order to perform a task in a context. Interaction describes the pattern of behavior.

I believe I can understand Chinese itself, but it is not so easy to know what to say. Let's put it another way.

Defining a function requires a function declaration in addition to the function body. The function declaration specifies what information is required to call the function and what the return value of the function is. The same is true of interaction.

Example

Let's take the speed control of the streetcar as an example. First of all, look at the timing diagram below.

The tram driver sets the upper and lower limits of acceleration. After the target speed, call startControlPattern to start the speed control of the specified mode. When the goal is achieved or abnormal occurs, the control ends and feedback the reason for the end.

This sequence diagram describes how speed control works, but you also need to define interactions if you want to be used by other sequence diagrams (strictly speaking, interaction diagrams). It's like having a function body and requiring a function declaration.

Define interaction

First drag the [Interaction] icon in the toolbox to the timing.

Next, enter the necessary information in each property page in the [Interation] properties dialog box.

[General] property page

Enter the interaction name SpeedControl.

[Behavior] property page

Select the return value of type FinishReason (you need to define the data type in advance).

[Parameters] property page

Define a total of three parameters for max_acc,max_dec,speed. They are equivalent to the formal parameters of the function.

When you press the OK button and resize the interation box, the timing diagram looks like this.

The text in the upper-left corner of the outer box is [int SpeedControl (,)], where int is not an integer, but an abbreviation for interation.

Interactive use

After defining interaction, it is natural to use interaction.

Steps

First drag the Interaction-defined timing diagram to the one that uses the interaction, and the following dialog box appears, with [Interaction Occurrence] selected here. In UML, interaction occurrence and interaction use have the same meaning.

Setting method

Set it through the property pages in the Interaction Occurrence dialog box that appears later.

[General] property page

Specifies the actual name in the context of the call. Enter ConstantSpeedControl for this example. This name is equivalent to the alias when the function is called.

[Call] property page

Click the [...] button on the right side of the [Behavior] project, select the previously defined SpeedControl interaction, enter FinishReason in the [ReturnValue] project, and enter finish_reason in the AttributeName project. This finish_reason is equivalent to the variable used to accept the return value when the function is called.

[Arguments] property page

Specify the variable name in the invocation context for each parameter of the Interation. The input is equivalent to the argument when defining the function call.

After pressing the OK button, the timing diagram on the calling side looks like this.

The information such as the actual parameters, the corresponding relations of the formal parameters, and the operation of the return value assignment are clearly shown in the figure. Arguments should be specified before using the interaction, and the return value can be used after the call. It's omitted here.

Thank you for reading! On "EA drawing UML sequence diagram how to achieve interaction and interactive use" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

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.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report