use of org.osate.xtext.aadl2.errormodel.errorModel.EMV2Path in project osate2 by osate.
the class EMV2Util method getLastSubcomponent.
/**
* return the last subcomponent in the EMV2Path
* @param epath EMV2Path
* @return Subcomponent
*/
public static Subcomponent getLastSubcomponent(EMV2Path epath) {
if (epath.getContainmentPath() != null) {
// handle paths that come from the EMV2PropertyAssociation with the new syntax for the core path
ContainmentPathElement last = getLast(epath.getContainmentPath());
if (last.getNamedElement() instanceof Subcomponent) {
return (Subcomponent) last.getNamedElement();
}
return null;
}
EMV2PathElement epe = epath.getEmv2Target();
Subcomponent result = null;
while (epe != null) {
if (epe.getNamedElement() instanceof Subcomponent) {
result = (Subcomponent) epe.getNamedElement();
}
epe = epe.getPath();
}
return result;
}
Aggregations