move - Move fragment within interaction - MATLAB (original) (raw)

Move fragment within interaction

Since R2024b

Syntax

Description

move([fragment](#mw%5F13680776-163e-407d-bc8e-8fc1eca4f39b), Before=[beforeElement](#mw%5F81ff2937-aff0-4aeb-b886-4e74090cb4c3)) places the fragment specified by fragment immediately before thebeforeElement interaction element object.

example

move([fragment](#mw%5F13680776-163e-407d-bc8e-8fc1eca4f39b), After=[afterElement](#mw%5F97a8d2b5-4e6b-4020-b6a1-0e5d9e9ffd58)) places the fragment specified by fragment immediately after theafterElement interaction element object.

example

Examples

collapse all

You can programmatically move fragments in a sequence diagram. This example assumes you have the TLExample model open from Create Sequence Diagrams Programmatically. You use the move function to place the alternative fragment before the first message in the root fragment.

Open the Inhibit sequence diagram.

model = systemcomposer.openModel("TLExample"); diagram = getInteraction(model, "Inhibit");

Inhibit sequence diagram.

Get the first message in the root fragment.

message = diagram.RootFragment.Operands.Fragments(1).Message;

Use an iterator to navigate through all elements of the sequence diagram and find the AltFragment.

iterator = systemcomposer.interaction.Iterator(diagram.RootFragment); next = iterator.next; while ~isempty(next) if isa(next, 'systemcomposer.interaction.AltFragment') altFrag = next; end next = iterator.next; end

Place the altFrag fragment immediately before the message message.

if ~isempty(altFrag) move(altFrag, Before=message); end diagram.open;

Inhibit sequence diagram with alt fragment placed before the messages.

Input Arguments

More About

collapse all

Term Definition Application More Information
Interaction An interaction specifies how each part of a system should interact as a sequence of message exchanges. Use interactions to describe operational system behaviors. Describe System Behavior Using Sequence Diagrams
Sequence diagram A sequence diagram is a visual representation of an interaction. Use sequence diagrams to visually specify how each part of a system should interact. Describe System Behavior Using Sequence Diagrams
Lifeline A lifeline represents an instance of a component as a participant of an interaction. A lifeline corresponds to a component in an architecture. Describe Interactions with Lifelines and Messages
Message A message represents communication between two lifelines. Messages have labels to specify the expected condition for the message to occur. A message label has a trigger, an optional guard, and an optional constraint where a trigger represents the identifying event for this message, a guard represents an additional condition to determine whether the message occurs, and a constraint is an expression that is expected to be true when this message occurs. Describe Interactions with Lifelines and Messages
Gate A gate represents the root of an architectural hierarchy. A gate allows you to describe the exchange of messages between the architecture and its environment. Describe Interactions with Lifelines and Messages
Annotation An annotation describes the elements of a sequence diagram. Use annotations to provide detailed explanations of elements or workflows captured by sequence diagrams. Annotate Sequence Diagrams with Annotations
Fragment A fragment encloses a group of lifelines and messages within an interaction to allow for the specification of more complex patterns of interaction. A fragment defines the type of ordering logic such as looping and alternatives. Fragments can have one or more operands. Model Complex Interactions with Fragments and Operands
Operand An operand is a region in a fragment, or group of messages. The condition of an operand specifies whether the messages inside the operand execute. The condition of an operand can specify constraints on the input signal of a lifeline as a MATLABĀ® Boolean expression. Model Complex Interactions with Fragments and Operands
Duration constraint A duration constraint defines a constraint on elapsed time between a start and an end occurrence. Use duration constraints to explicitly express a constraint on the duration between a start occurrence and an end occurrence. Specify Timing Constraints Between Message Events with Duration Constraints

Version History

Introduced in R2024b

See Also

Tools

Functions

Objects

Topics