Main Content

systemcomposer.rptgen.finder.StereotypeFinder Class

Namespace: systemcomposer.rptgen.finder
Superclasses: mlreportgen.finder.Finder (MATLAB Report Generator)

Find stereotypes

Since R2022b

Description

The systemcomposer.rptgen.finder.StereotypeFinder class searches for information about stereotypes in a profile in a given System Composer™ architecture model.

Creation

finder = StereotypeFinder(Container) creates a finder that finds stereotypes in a profile in a given model.

Note

This finder provides these options to get search results:

  • To return the search results as an array, use the find method. Add the results directly to a report or process the results in a for-loop.

  • To iterate through the results one at a time, use the hasNext and next methods in a while-loop.

Neither option has a performance advantage.

Properties

expand all

Profile filename without the .xml extension, specified as a string.

Example: f = StereotypeFinder("TestProfile")

Data Types: string

Stereotype name, specified as a string in the form "<profile>.<stereotype>".

Example: f.StereotypeName = "TestProfile.MechanicalComponent"

Attributes:

GetAccess
public
SetAccess
public

Data Types: string

Properties of objects to find, specified as a cell array of name-value arguments. The finder returns only objects that have the specified properties with the specified values.

Example: f.Properties = {'Gain','5'}

Data Types: char

Methods

expand all

Examples

collapse 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