Search in sources :

Example 1 with SafetyContractSubclauseImpl

use of edu.umn.cs.crisys.safety.safety.impl.SafetyContractSubclauseImpl in project AMASE by loonwerks.

the class FaultsVerifyAllHandler method isProbabilisticAnalysis.

private boolean isProbabilisticAnalysis() {
    List<Classifier> classifiers = getClassifiers();
    if (classifiers == null) {
        return false;
    }
    // TODO: Finish addressing this issue.
    for (Classifier cl : classifiers) {
        // Get impl of this level
        if (cl instanceof ComponentImplementationImpl) {
            List<AnnexSubclause> asList = cl.getOwnedAnnexSubclauses();
            for (AnnexSubclause as : asList) {
                if (as.getName().equalsIgnoreCase("safety")) {
                    if (as instanceof DefaultAnnexSubclauseImpl) {
                        DefaultAnnexSubclauseImpl defaultAnnex = (DefaultAnnexSubclauseImpl) as;
                        SafetyContractSubclauseImpl safetyAnnex = (SafetyContractSubclauseImpl) defaultAnnex.getParsedAnnexSubclause();
                        // Get analysis stmt
                        List<SpecStatement> specs = ((SafetyContract) safetyAnnex.getContract()).getSpecs();
                        for (SpecStatement spec : specs) {
                            if (spec instanceof AnalysisStatement) {
                                if (!(((AnalysisStatement) spec).getBehavior() instanceof ProbabilityBehavior)) {
                                    return false;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return true;
}
Also used : SafetyContractSubclauseImpl(edu.umn.cs.crisys.safety.safety.impl.SafetyContractSubclauseImpl) AnalysisStatement(edu.umn.cs.crisys.safety.safety.AnalysisStatement) ComponentImplementationImpl(org.osate.aadl2.impl.ComponentImplementationImpl) DefaultAnnexSubclauseImpl(org.osate.aadl2.impl.DefaultAnnexSubclauseImpl) ProbabilityBehavior(edu.umn.cs.crisys.safety.safety.ProbabilityBehavior) SpecStatement(edu.umn.cs.crisys.safety.safety.SpecStatement) Classifier(org.osate.aadl2.Classifier) SafetyContract(edu.umn.cs.crisys.safety.safety.SafetyContract) AnnexSubclause(org.osate.aadl2.AnnexSubclause)

Example 2 with SafetyContractSubclauseImpl

use of edu.umn.cs.crisys.safety.safety.impl.SafetyContractSubclauseImpl in project AMASE by loonwerks.

the class FaultDisableHandler method makeMap.

/**
 * Checks classifiers in AadlPackage for any ComponentTypeImpl
 * and then collects safety annex spec statements to gather
 * fault names specific to that component.
 *
 * @param classifiers Classifiers in this AadlPackage
 */
private void makeMap(List<Classifier> classifiers) {
    for (Classifier cl : classifiers) {
        if (cl instanceof ComponentTypeImpl) {
            String compName = cl.getName();
            List<String> faultNameList = new ArrayList<String>();
            List<AnnexSubclause> asList = cl.getOwnedAnnexSubclauses();
            for (AnnexSubclause as : asList) {
                if (as.getName().equalsIgnoreCase("safety")) {
                    if (as instanceof DefaultAnnexSubclauseImpl) {
                        DefaultAnnexSubclauseImpl defaultAnnex = (DefaultAnnexSubclauseImpl) as;
                        SafetyContractSubclauseImpl safetyAnnex = (SafetyContractSubclauseImpl) defaultAnnex.getParsedAnnexSubclause();
                        List<SpecStatement> specs = ((SafetyContract) safetyAnnex.getContract()).getSpecs();
                        for (SpecStatement spec : specs) {
                            if (spec instanceof FaultStatementImpl) {
                                FaultStatementImpl fs = (FaultStatementImpl) spec;
                                faultNameList.add(fs.getName());
                            }
                        }
                    }
                }
            }
            // If list nonempty, add to map for this component
            if (!faultNameList.isEmpty()) {
                mapCompNameToFaults.put(compName, faultNameList);
            }
        }
    }
}
Also used : SafetyContractSubclauseImpl(edu.umn.cs.crisys.safety.safety.impl.SafetyContractSubclauseImpl) DefaultAnnexSubclauseImpl(org.osate.aadl2.impl.DefaultAnnexSubclauseImpl) ArrayList(java.util.ArrayList) ComponentTypeImpl(org.osate.aadl2.impl.ComponentTypeImpl) SpecStatement(edu.umn.cs.crisys.safety.safety.SpecStatement) Classifier(org.osate.aadl2.Classifier) FaultStatementImpl(edu.umn.cs.crisys.safety.safety.impl.FaultStatementImpl) SafetyContract(edu.umn.cs.crisys.safety.safety.SafetyContract) AnnexSubclause(org.osate.aadl2.AnnexSubclause)

Aggregations

SafetyContract (edu.umn.cs.crisys.safety.safety.SafetyContract)2 SpecStatement (edu.umn.cs.crisys.safety.safety.SpecStatement)2 SafetyContractSubclauseImpl (edu.umn.cs.crisys.safety.safety.impl.SafetyContractSubclauseImpl)2 AnnexSubclause (org.osate.aadl2.AnnexSubclause)2 Classifier (org.osate.aadl2.Classifier)2 DefaultAnnexSubclauseImpl (org.osate.aadl2.impl.DefaultAnnexSubclauseImpl)2 AnalysisStatement (edu.umn.cs.crisys.safety.safety.AnalysisStatement)1 ProbabilityBehavior (edu.umn.cs.crisys.safety.safety.ProbabilityBehavior)1 FaultStatementImpl (edu.umn.cs.crisys.safety.safety.impl.FaultStatementImpl)1 ArrayList (java.util.ArrayList)1 ComponentImplementationImpl (org.osate.aadl2.impl.ComponentImplementationImpl)1 ComponentTypeImpl (org.osate.aadl2.impl.ComponentTypeImpl)1