use of org.osate.aadl2.impl.ComponentTypeImpl 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