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;
}
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);
}
}
}
}
Aggregations