Main Content

findLifeline

Find lifeline in interaction

Since R2024b

    Description

    lifelines = findLifeline(interaction,Name=Value) uses the name or path to find lifelines in a sequence diagram that correspond to the interaction interaction.

    example

    Examples

    collapse all

    Create a model with a component called Component.

    model = systemcomposer.createModel("archModel");
    systemcomposer.openModel("archModel");
    arch = get(model,"Architecture");
    comp = addComponent(arch,"Component");

    Create a sequence diagram in the model, and then open the sequence diagram.

    interaction = model.addInteraction("NewSequenceDiagram");
    interaction.open

    Add a lifeline to the sequence diagram.

    lifeline = interaction.addLifeline(comp);

    Find a lifeline by name in the sequence diagram.

    lifelineFound = interaction.findLifeline(Name="Component")
    lifelineFound = 
    
      Lifeline with properties:
    
                   Name: 'Component'
               FullPath: 'archModel/Component'
                 Parent: [0×0 systemcomposer.interaction.Lifeline]
               Children: [0×0 systemcomposer.interaction.Lifeline]
        RelatedElements: [1×1 systemcomposer.arch.Component]
                   UUID: '6e96667a-c5a9-4480-90cc-808f6ebd46e4'
            ExternalUID: ''

    Input Arguments

    collapse all

    Interaction, specified as a systemcomposer.interaction.Interaction object.

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

    Example: findLifeline(interaction,Name="Component")

    Name of lifelines, specified as a character vector or string. Multiple lifelines at different hierarchical levels can all share the same name.

    Example: findLifeline(interaction,Name="Component")

    Data Types: char | string

    Path of lifeline, specified as a character vector or string.

    Example: findLifeline(interaction,Path="GrandParent/Parent/Child")

    Data Types: char | string

    Output Arguments

    collapse all

    Lifelines, returned as a systemcomposer.interaction.Lifeline object or array of systemcomposer.interaction.Lifeline objects.

    More About

    collapse all

    Version History

    Introduced in R2024b