Main Content

hasNext

Class: systemcomposer.rptgen.finder.ProfileFinder
Namespace: systemcomposer.rptgen.finder

Determine if profile search result queue is nonempty

Since R2022b

Syntax

nonempty = hasNext(finder)

Description

nonempty = hasNext(finder) determines whether the Profile search result queue is nonempty.

Input Arguments

expand all

Profile finder, specified as a systemcomposer.rptgen.finder.ProfileFinder object.

Output Arguments

expand all

Whether queue is nonempty, returned as 1 (true) or 0 (false).

Data Types: logical

Examples

expand all

Use the ProfileFinder, ProfileResult, StereotypeFinder, and StereotypeResult classes to create a report that finds all profiles in a given architecture model.

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

Open the scKeylessEntrySystem project.

prj = openProject("scKeylessEntrySystem");
model_name = "KeylessEntryArchitecture";
mdl = systemcomposer.loadModel(model_name);

Create a report and append a title page and table of contents.

profilesReport = slreportgen.report.Report(OutputPath=model_name + "_ProfileReport", ...
    CompileModelBeforeReporting=false);
append(profilesReport,TitlePage(Title="Profiles and their Stereotypes in " + model_name));
append(profilesReport,TableOfContents);

Create a chapter to contain all sections related to profiles and their stereotypes.

profileChapter = Chapter(Title="Profiles");

Find all profiles imported into the architecture model.

profileFinder = ProfileFinder(model_name);

while hasNext(profileFinder)
    profile = next(profileFinder);
    profileSection = Section(Title="Profile: " + profile.Name);
    append(profileSection, profile);

Find all stereotypes in a profile.

    stereotypeFinder = StereotypeFinder(profile.Name);
    while hasNext(stereotypeFinder) 
        stereotype = next(stereotypeFinder);
        stereotypeSection = Section(Title=stereotype.Name);
        append(stereotypeSection,stereotype);
        append(profileSection,stereotypeSection);
    end
    
    append(profileChapter,profileSection);
end

Append the chapter to the report and view the generated report.

append(profilesReport,profileChapter);
close(profilesReport);
rptview(profilesReport);

Version History

Introduced in R2022b