Search in sources :

Example 11 with EMV2Path

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;
}
Also used : EMV2PathElement(org.osate.xtext.aadl2.errormodel.errorModel.EMV2PathElement) Subcomponent(org.osate.aadl2.Subcomponent) ContainmentPathElement(org.osate.aadl2.ContainmentPathElement)

Aggregations

ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)8 EMV2PathElement (org.osate.xtext.aadl2.errormodel.errorModel.EMV2PathElement)7 EMV2Path (org.osate.xtext.aadl2.errormodel.errorModel.EMV2Path)6 NamedElement (org.osate.aadl2.NamedElement)4 ErrorTypes (org.osate.xtext.aadl2.errormodel.errorModel.ErrorTypes)4 TypeSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)4 EObject (org.eclipse.emf.ecore.EObject)3 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)3 Subcomponent (org.osate.aadl2.Subcomponent)3 ErrorBehaviorState (org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState)3 ErrorEvent (org.osate.xtext.aadl2.errormodel.errorModel.ErrorEvent)3 ErrorPropagation (org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)3 TypeToken (org.osate.xtext.aadl2.errormodel.errorModel.TypeToken)3 EList (org.eclipse.emf.common.util.EList)2 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)2 ListValue (org.osate.aadl2.ListValue)2 ModalPropertyValue (org.osate.aadl2.ModalPropertyValue)2 RecordValue (org.osate.aadl2.RecordValue)2 AllExpression (org.osate.xtext.aadl2.errormodel.errorModel.AllExpression)2 AndExpression (org.osate.xtext.aadl2.errormodel.errorModel.AndExpression)2