主要内容

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

hasNext

类: systemcomposer.rptgen.finder.FunctionFinder
命名空间: systemcomposer.rptgen.finder

确定函数搜索结果队列是否非空

自 R2022b 起

语法

nonempty = hasNext(finder)

说明

nonempty = hasNext(finder) 决定 Function 搜索结果队列是否为空。

输入参数

全部展开

函数查找器,指定为 systemcomposer.rptgen.finder.FunctionFinder 对象。

输出参量

全部展开

队列是否为非空,以 1 (true) 或 0 (false) 返回。

数据类型: logical

示例

全部展开

使用 ComponentFinderComponentResultFunctionFinderFunctionResult 类生成报告,查找给定软件架构模型中的所有组件及其函数。

import mlreportgen.report.*
import slreportgen.report.*
import systemcomposer.query.*
import systemcomposer.rptgen.finder.*

打开 ACCSoftwareComposition 模型。

model_name = "ACCSoftwareComposition";
mdl = systemcomposer.loadModel(model_name);

创建一个报告,并追加标题页和目录。

functionsReport = slreportgen.report.Report(OutputPath=model_name + "_FunctionsReport", ...
    CompileModelBeforeReporting=false);
append(functionsReport,TitlePage(Title="Components and their Functions in " + model_name));
append(functionsReport,TableOfContents);

创建一个章节,包含与组件及其函数相关的所有节。

compChapter = Chapter("Components and their Functions");

查找架构模型中的所有组件。

componentFinder = ComponentFinder(model_name);
componentFinder.Query = AnyComponent;

为每个组件创建一个章节。

while hasNext(componentFinder)
    comp = next(componentFinder);
    compSection = Section(Title=comp.Name);
    compReporter = getReporter(comp);
    compReporter.IncludeSnapshot = 1;
    compReporter.IncludeProperties = 0;
    compReporter.IncludeFunctions = 0;
    append(compSection,compReporter);

查找与组件相关的所有函数。

    functionFinder = FunctionFinder(model_name);
    functionFinder.ComponentName = comp.Name;
    functionResult = find(functionFinder);
    append(compSection,functionResult);

    append(compChapter,compSection);
end

将章节附加到报告中,并查看生成的报告。

append(functionsReport,compChapter);
close(functionsReport);
rptview(functionsReport);

版本历史记录

在 R2022b 中推出