主要内容

本页采用了机器翻译。点击此处可查看最新英文版本。

findElement

在交互中查找元素

自 R2024b 起

    说明

    element = findElement(interaction,UUID) 使用 UUID 在序列图中查找与交互 interaction 相对应的元素。

    示例

    示例

    全部折叠

    创建一个带有名为 Component 的组件的模型。

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

    在模型中创建序列图,然后打开序列图。

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

    在序列图中添加生命线。

    lifeline = interaction.addLifeline(comp);

    在序列图中按名称查找生命线。

    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: ''

    通过 UUID 在序列图中查找生命线。

    lifelineFoundByUUID = interaction.findElement(lifelineFound.UUID)
    lifelineFoundByUUID = 
    
      Lifeline with properties:
            externalUID: ''
                   name: 'Component'
        backendElements: [1×1 sequencediagram.lang.syntax.BackendElement Sequence]
                 parent: [1×0 sequencediagram.lang.syntax.Lifeline]
               children: [1×0 sequencediagram.lang.syntax.Lifeline Set]

    输入参数

    全部折叠

    交互,指定为 systemcomposer.interaction.Interaction 对象。

    统一唯一标识符,指定为字符向量

    示例: '91d5de2c-b14c-4c76-a5d6-5dd0037c52df'

    数据类型: char

    输出参量

    详细信息

    全部折叠

    版本历史记录

    在 R2024b 中推出