use of org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause in project osate2 by osate.
the class ErrorModelValidator method caseErrorModelSubclause.
@Check(CheckType.FAST)
public void caseErrorModelSubclause(ErrorModelSubclause subclause) {
if (EcoreUtil2.getContainerOfType(subclause, FeatureGroupType.class) != null) {
error("Error model subclauses are not permitted in feature group types.", EcoreUtil2.getContainerOfType(subclause, DefaultAnnexSubclause.class), Aadl2Package.eINSTANCE.getNamedElement_Name());
return;
}
checkSubclauseAssociationToClassifier(subclause);
checkDuplicateSubclause(subclause);
checkOnePropagationAndContainmentPoint(subclause);
Collection<NamedElement> names = EMV2Util.getAllNamedElements(subclause);
List<NamedElement> doubles = EMV2Util.findDoubleNamedElementsInList(names);
for (NamedElement namedElement : doubles) {
if (!(namedElement instanceof ErrorPropagation)) {
error(namedElement, "Subclause has more than one element with the name '" + namedElement.getName() + "'.");
}
}
Collection<ErrorPropagation> ins = EMV2Util.getAllIncomingErrorPropagations(subclause.getContainingClassifier());
for (ErrorPropagation errorPropagation : ins) {
checkTypePropagationAndContainment(errorPropagation);
}
Collection<ErrorPropagation> outs = EMV2Util.getAllOutgoingErrorPropagations(subclause.getContainingClassifier());
for (ErrorPropagation errorPropagation : outs) {
checkTypePropagationAndContainment(errorPropagation);
}
checkUseBehavior(subclause);
}
use of org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause in project osate2 by osate.
the class ErrorModelValidator method checkOnePropagationAndContainmentPoint.
private void checkOnePropagationAndContainmentPoint(ErrorModelSubclause ems) {
EList<ErrorPropagation> eps = ems.getPropagations();
int epssize = eps.size();
for (int i = 0; i < epssize - 1; i++) {
ErrorPropagation ep1 = eps.get(i);
for (int k = i + 1; k < epssize; k++) {
ErrorPropagation ep2 = eps.get(k);
if (EMV2Util.getPrintName(ep1).equalsIgnoreCase(EMV2Util.getPrintName(ep2))) {
// uniqueness needs to take into account direction
if (((ep1.isNot() && ep2.isNot()) || (!ep1.isNot() && !ep2.isNot())) && ep1.getDirection() == ep2.getDirection()) {
error(ep2, (ep1.isNot() ? "Error containment " : "Error propagation ") + EMV2Util.getPrintName(ep2) + " can only be declared once [E.7.1 (L1)].");
}
}
}
}
}
use of org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause in project osate2 by osate.
the class EMV2Util method getAllErrorPaths.
/**
* return list of error paths including those inherited from classifiers being extended
* @param cl Classifier
* @return Collection<ErrorSource> list of error paths declared in the flow section
*/
public static Collection<ErrorPath> getAllErrorPaths(Classifier cl) {
HashMap<String, ErrorPath> result = new LinkedHashMap<>();
EList<ErrorModelSubclause> emslist = getAllContainingClassifierEMV2Subclauses(cl);
for (ErrorModelSubclause errorModelSubclause : emslist) {
EList<ErrorFlow> eflist = errorModelSubclause.getFlows();
for (ErrorFlow errorFlow : eflist) {
if (errorFlow instanceof ErrorPath) {
if (!result.containsKey(errorFlow.getName())) {
result.put(errorFlow.getName(), (ErrorPath) errorFlow);
}
}
}
}
return result.values();
}
use of org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause in project osate2 by osate.
the class EMV2Util method getAllCompositeStates.
/**
* return list of CompositeState including those inherited from classifiers being extended
* @param cl Classifier
* @param unnamed Collection of unnamed CompositeState
* @return Collection<CompositeState> list of CompositeState as HashMap for quick lookup of names
*/
private static HashMap<String, CompositeState> getAllCompositeStates(Classifier cl, Collection<CompositeState> unnamed) {
HashMap<String, CompositeState> result = new LinkedHashMap<>();
EList<ErrorModelSubclause> emslist = getAllContainingClassifierEMV2Subclauses(cl);
for (ErrorModelSubclause errorModelSubclause : emslist) {
EList<CompositeState> eslist = errorModelSubclause.getStates();
for (CompositeState es : eslist) {
if (es.getName() == null) {
unnamed.add(es);
} else {
if (!result.containsKey(es.getName())) {
result.put(es.getName(), es);
}
}
}
}
return result;
}
use of org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause in project osate2 by osate.
the class EMV2Util method getAllPropagationPaths.
/**
* return list of PropagationPaths including those inherited from classifiers being extended
* @param cl Classifier
* @return Collection<PropagationPath> list of PropagationPaths as HashMap for quick lookup of names
*/
public static Collection<PropagationPath> getAllPropagationPaths(Classifier cl) {
HashMap<String, PropagationPath> result = new LinkedHashMap<>();
EList<ErrorModelSubclause> emslist = getAllContainingClassifierEMV2Subclauses(cl);
for (ErrorModelSubclause errorModelSubclause : emslist) {
EList<PropagationPath> eflist = errorModelSubclause.getPaths();
for (PropagationPath propPointConn : eflist) {
if (!result.containsKey(propPointConn.getName())) {
result.put(propPointConn.getName(), propPointConn);
}
}
}
return result.values();
}
Aggregations