use of org.sireum.aadl.osate.securitymodel.secMF.SecModelLibrary in project osate-plugin by sireum.
the class SmfVisitor method getAllPackages.
private HashSet<SecModelLibrary> getAllPackages(Element root) {
HashSet<SecModelLibrary> secLibs = new HashSet<SecModelLibrary>();
// no need of seen set as the circular imports are not allowed
HashSet<ModelUnit> seens = new HashSet();
PackageSection ps = AadlUtil.getContainingPackageSection(((SystemInstance) root).getComponentClassifier());
EList<ComponentImplementation> ais = AadlUtil.getAllComponentImpl();
Set<ModelUnit> aps = ais.stream().flatMap(it -> AadlUtil.getContainingPackage(it).getPublicSection().getImportedUnits().stream()).collect(Collectors.toSet());
Set<ModelUnit> worklist = aps;
try {
for (ModelUnit head : worklist) {
seens.add(head);
if (head != null && head instanceof AadlPackage) {
secLibs.addAll(AnnexUtil.getAllActualAnnexLibraries((AadlPackage) head, SecMFPackage.eINSTANCE.getSecModelLibrary()).stream().map(al -> (SecModelLibrary) al).collect(Collectors.toList()));
}
}
} catch (Exception e) {
e.printStackTrace();
}
return secLibs;
}
Aggregations