use of com.ge.research.osate.verdict.dsl.verdict.Verdict in project VERDICT by ge-high-assurance.
the class VerdictUtil method getAllReqs.
/**
* Get the (linked) set of all cyber requirements in the AADL AST of which obj is part.
*
* @param obj
* @return
*/
public static Set<String> getAllReqs(EObject obj) {
Set<String> reqs = new LinkedHashSet<>();
// Find public package section
EObject container = obj;
while (container != null && !(container instanceof PublicPackageSection)) {
container = container.eContainer();
}
PublicPackageSection pack = (PublicPackageSection) container;
if (pack != null && pack.getOwnedClassifiers() != null) {
// Find all systems
for (Classifier cls : pack.getOwnedClassifiers()) {
if (cls instanceof SystemType) {
SystemType system = (SystemType) cls;
// Get all verdict annexes for this system
for (AnnexSubclause annex : system.getOwnedAnnexSubclauses()) {
if ("verdict".equals(annex.getName())) {
Verdict subclause = VerdictUtil.getVerdict(annex);
// Get all cyber req IDs
for (Statement statement : subclause.getElements()) {
if (statement instanceof CyberReq) {
reqs.add(statement.getId());
} else if (statement instanceof SafetyReq) {
reqs.add(statement.getId());
}
}
}
}
}
}
}
return reqs;
}
Aggregations