Search in sources :

Example 21 with Verdict

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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) PublicPackageSection(org.osate.aadl2.PublicPackageSection) CyberReq(com.ge.research.osate.verdict.dsl.verdict.CyberReq) Statement(com.ge.research.osate.verdict.dsl.verdict.Statement) EObject(org.eclipse.emf.ecore.EObject) SystemType(org.osate.aadl2.SystemType) Classifier(org.osate.aadl2.Classifier) SafetyReq(com.ge.research.osate.verdict.dsl.verdict.SafetyReq) DefaultAnnexSubclause(org.osate.aadl2.DefaultAnnexSubclause) AnnexSubclause(org.osate.aadl2.AnnexSubclause) Verdict(com.ge.research.osate.verdict.dsl.verdict.Verdict)

Aggregations

Statement (com.ge.research.osate.verdict.dsl.verdict.Statement)21 Verdict (com.ge.research.osate.verdict.dsl.verdict.Verdict)21 ArrayList (java.util.ArrayList)17 CyberReq (com.ge.research.osate.verdict.dsl.verdict.CyberReq)16 AnnexSubclause (org.osate.aadl2.AnnexSubclause)16 SafetyReq (com.ge.research.osate.verdict.dsl.verdict.SafetyReq)15 CyberMission (com.ge.research.osate.verdict.dsl.verdict.CyberMission)14 CyberRel (com.ge.research.osate.verdict.dsl.verdict.CyberRel)14 Event (com.ge.research.osate.verdict.dsl.verdict.Event)14 SafetyRel (com.ge.research.osate.verdict.dsl.verdict.SafetyRel)14 DataPort (org.osate.aadl2.DataPort)11 EventDataPort (org.osate.aadl2.EventDataPort)11 EventPort (org.osate.aadl2.EventPort)11 Port (verdict.vdm.vdm_model.Port)11 EObject (org.eclipse.emf.ecore.EObject)10 BusAccess (org.osate.aadl2.BusAccess)7 DataAccess (org.osate.aadl2.DataAccess)6 SystemType (org.osate.aadl2.SystemType)6 VerdictContractSubclause (com.ge.research.osate.verdict.dsl.verdict.VerdictContractSubclause)5 DefaultAnnexSubclauseImpl (org.osate.aadl2.impl.DefaultAnnexSubclauseImpl)5