Main Content

move

Move lifeline within interaction

Since R2024b

    Description

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

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

    example

    Examples

    collapse all

    You can programmatically move lifelines 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 poller lifeline immediately before the source lifeline.

    Open the 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 the pollerLifeline lifeline immediately before the sourceLifeline lifeline.

    move(pollerLifeline, Before=sourceLifeline);

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

    diagram.open;

    Input Arguments

    collapse all

    Lifeline to be moved, specified as a systemcomposer.interaction.Lifeline object.

    Existing lifeline before which to place lifeline in interaction, 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.

    Existing lifeline after which to place lifeline in interaction, 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

    Version History

    Introduced in R2024b