Main Content

move

Move lifeline within an interaction

Since R2024b

    Description

    move(lifeline, Before=beforeLifeline) places the lifeline lifeline immediately before the beforeLifeline lifeline.

    move(lifeline, After=afterLifeline) places the lifeline lifeline immediately after the afterLifeline lifeline.

    example

    Examples

    collapse all

    You can programmatically move lifelines in a sequence diagram. This example assumes you have the TLExample model open from the Create Sequence Diagrams Programmatically example and uses the move function to place the poller lifeline immediately before the source lifeline.

    Open Inhibit sequence diagram.

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

    Inhibit sequence diagram.

    Get the poller lifeline and the source lifeline from the interaction.

    pollerLifeline = findLifeline(diagram, Name="poller");
    sourceLifeline = findLifeline(diagram, Name="source");

    Place pollerLifeline immediately before the sourceLifeline.

    move(pollerLifeline, Before=sourceLifeline);

    Inhibit sequence diagram with the source lifeline now to the right of the poller lifeline.

    save(model);

    Input Arguments

    collapse all

    Lifeline object specified as a systemcomposer.interaction.Lifeline object.

    Lifeline object specified as a systemcomposer.interaction.Lifeline object. This lifeline must be in the same interaction as the lifeline lifeline and have the same parent lifeline as the lifeline lifeline.

    Lifeline object specified as a systemcomposer.interaction.Lifeline object. This lifeline must be in the same interaction as the lifeline lifeline and have the same parent lifeline as the lifeline lifeline.

    More About

    collapse all

    Definitions

    TermDefinitionApplicationMore Information
    sequence diagram

    A sequence diagram represents the expected interaction between structural elements of an architecture as a sequence of message exchanges.

    Use sequence diagrams to describe how the parts of a system interact.

    Describe System Behavior Using Sequence Diagrams
    lifeline

    A lifeline is represented by a head and a timeline that proceeds down a vertical dotted line.

    The head of a lifeline represents a component in an architecture model.

    Add Lifelines and Messages
    message

    A message sends information from one lifeline to another. Messages are specified with a message label.

    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.

    Create Messages in Sequence Diagram
    gate

    A gate represents the root architecture of the corresponding architecture model.

    Connect messages to gates to represent architecture ports.

    Create Sequence Diagram Gates
    annotation

    An annotation describes the elements of a sequence diagram.

    Use annotations to provide detailed explanations of elements or workflows captured by sequence diagrams.

    Use Annotations to Describe Elements of Sequence Diagram
    fragment

    A fragment indicates how a group of messages execute or interact.

    A fragment is used to model complex sequences, such as alternatives, in a sequence diagram.

    Author Sequence Diagram Fragments
    operand

    An operand is a region in a fragment. Fragments have one or more operands depending on the kind of fragment. Operands can contain messages and additional fragments.

    Each operand can include a constraint to specify whether the messages inside the operand execute. You can express the precondition of an operand as a MATLAB® Boolean expression using the input signal of a lifeline.

    Add Fragments and Operands

    Version History

    Introduced in R2024b