Search in sources :

Example 6 with SubprogramCallSequence

use of org.osate.aadl2.SubprogramCallSequence in project osate2 by osate.

the class BehavioredImplementationImpl method createOwnedSubprogramCallSequence.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public SubprogramCallSequence createOwnedSubprogramCallSequence() {
    SubprogramCallSequence newOwnedSubprogramCallSequence = (SubprogramCallSequence) create(Aadl2Package.eINSTANCE.getSubprogramCallSequence());
    getOwnedSubprogramCallSequences().add(newOwnedSubprogramCallSequence);
    return newOwnedSubprogramCallSequence;
}
Also used : SubprogramCallSequence(org.osate.aadl2.SubprogramCallSequence)

Example 7 with SubprogramCallSequence

use of org.osate.aadl2.SubprogramCallSequence in project osate2 by osate.

the class BehavioredImplementationImpl method getAllSubprogramCallSequences.

public EList<SubprogramCallSequence> getAllSubprogramCallSequences() {
    EList<Classifier> ancestors = getSelfPlusAllExtended();
    final BasicEList<SubprogramCallSequence> returnlist = new BasicEList<SubprogramCallSequence>();
    for (Iterator<Classifier> it = ancestors.iterator(); it.hasNext(); ) {
        final BehavioredImplementation current = (BehavioredImplementation) it.next();
        returnlist.addAll(current.getOwnedSubprogramCallSequences());
    }
    return returnlist;
}
Also used : BehavioredImplementation(org.osate.aadl2.BehavioredImplementation) SubprogramCallSequence(org.osate.aadl2.SubprogramCallSequence) BasicEList(org.eclipse.emf.common.util.BasicEList) Classifier(org.osate.aadl2.Classifier)

Example 8 with SubprogramCallSequence

use of org.osate.aadl2.SubprogramCallSequence in project osate2 by osate.

the class AgeAadlUtil method getAllSubprogramCallSequences.

public static List<SubprogramCallSequence> getAllSubprogramCallSequences(final BehavioredImplementation bi) {
    EList<SubprogramCallSequence> returnList = new BasicEList<SubprogramCallSequence>();
    ComponentImplementation tmpCi = bi;
    while (tmpCi != null) {
        if (tmpCi instanceof BehavioredImplementation) {
            final BehavioredImplementation tmpBi = (BehavioredImplementation) tmpCi;
            returnList.addAll(tmpBi.getOwnedSubprogramCallSequences());
        }
        tmpCi = tmpCi.getExtended();
    }
    return returnList;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) BehavioredImplementation(org.osate.aadl2.BehavioredImplementation) SubprogramCallSequence(org.osate.aadl2.SubprogramCallSequence) BasicEList(org.eclipse.emf.common.util.BasicEList)

Example 9 with SubprogramCallSequence

use of org.osate.aadl2.SubprogramCallSequence in project osate2 by osate.

the class CreateAadlConnectionPaletteCommand method getConnectedElementForBusinessObjectContext.

/**
 * Builds a ConnectedElement for the specific business object.
 * @param boc
 * @param connectionType
 * @param disableNesting
 * @param limitBoc is an optional business object context which limits the path of the connected element
 * @return
 */
private ConnectedElement getConnectedElementForBusinessObjectContext(final BusinessObjectContext boc, final EClass connectionType, final boolean disableNesting, final BusinessObjectContext limitBoc) {
    final Object bo = boc.getBusinessObject();
    if (!(bo instanceof ConnectionEnd)) {
        return null;
    }
    // Build a list of business objects which make up the path to the connection end.
    boolean pathIncludesSubcomponent = false;
    final LinkedList<Object> path = new LinkedList<>();
    for (BusinessObjectContext tmp = boc; tmp != null && tmp != limitBoc && tmp.getBusinessObject() != null; tmp = tmp.getParent()) {
        if (tmp.getBusinessObject() instanceof ComponentImplementation || tmp.getBusinessObject() instanceof SubprogramCallSequence) {
            break;
        } else if (tmp.getBusinessObject() instanceof Subcomponent) {
            if (pathIncludesSubcomponent) {
                // If two subcomponents are encountered then the element is nested and is inaccessible.
                return null;
            }
            pathIncludesSubcomponent = true;
        }
        path.add(0, tmp.getBusinessObject());
    }
    if (path.size() == 0) {
        return null;
    }
    final Object[] pathObjects = path.toArray();
    final Object firstBo = pathObjects[0];
    final boolean allowNested = !disableNesting && connectionType == Aadl2Package.eINSTANCE.getFeatureConnection();
    // If nesting is not allowed, then the number of objects must be at most 2.
    if (!allowNested && pathObjects.length > 2) {
        return null;
    }
    final ConnectedElement ce = AgeAadlUtil.getAadl2Factory().createConnectedElement();
    // Add the context
    int i = 0;
    if (pathObjects.length > 1) {
        if (!(firstBo instanceof Context)) {
            return null;
        }
        ce.setContext((Context) firstBo);
        i++;
    }
    // Add the first connection end
    if (!(pathObjects[i] instanceof ConnectionEnd)) {
        return null;
    }
    ce.setConnectionEnd((ConnectionEnd) pathObjects[i]);
    i++;
    // Add other segments
    ConnectedElement tmp = ce;
    for (; i < pathObjects.length; i++) {
        tmp = tmp.createNext();
        if (!(pathObjects[i] instanceof ConnectionEnd)) {
            return null;
        }
        tmp.setConnectionEnd((ConnectionEnd) pathObjects[i]);
    }
    // SubprogramSubcomponent elements are never a valid context
    if (ce.getContext() instanceof SubprogramSubcomponent) {
        return null;
    }
    return ce;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) GetCreateConnectionOperationContext(org.osate.ge.palette.GetCreateConnectionOperationContext) BusinessObjectContext(org.osate.ge.BusinessObjectContext) CanStartConnectionContext(org.osate.ge.palette.CanStartConnectionContext) Context(org.osate.aadl2.Context) SubprogramSubcomponent(org.osate.aadl2.SubprogramSubcomponent) SubprogramCallSequence(org.osate.aadl2.SubprogramCallSequence) LinkedList(java.util.LinkedList) SubprogramSubcomponent(org.osate.aadl2.SubprogramSubcomponent) Subcomponent(org.osate.aadl2.Subcomponent) FeatureGroupConnectionEnd(org.osate.aadl2.FeatureGroupConnectionEnd) PortConnectionEnd(org.osate.aadl2.PortConnectionEnd) FeatureConnectionEnd(org.osate.aadl2.FeatureConnectionEnd) ConnectionEnd(org.osate.aadl2.ConnectionEnd) AccessConnectionEnd(org.osate.aadl2.AccessConnectionEnd) ParameterConnectionEnd(org.osate.aadl2.ParameterConnectionEnd) ConnectedElement(org.osate.aadl2.ConnectedElement) BusinessObjectContext(org.osate.ge.BusinessObjectContext)

Aggregations

SubprogramCallSequence (org.osate.aadl2.SubprogramCallSequence)8 SubprogramCall (org.osate.aadl2.SubprogramCall)4 BehavioredImplementation (org.osate.aadl2.BehavioredImplementation)3 SubprogramSubcomponent (org.osate.aadl2.SubprogramSubcomponent)3 BasicEList (org.eclipse.emf.common.util.BasicEList)2 AadlPackage (org.osate.aadl2.AadlPackage)2 Classifier (org.osate.aadl2.Classifier)2 ComponentImplementation (org.osate.aadl2.ComponentImplementation)2 FeatureGroup (org.osate.aadl2.FeatureGroup)2 FeatureGroupType (org.osate.aadl2.FeatureGroupType)2 ModeTransition (org.osate.aadl2.ModeTransition)2 LinkedList (java.util.LinkedList)1 Optional (java.util.Optional)1 IProject (org.eclipse.core.resources.IProject)1 CoreException (org.eclipse.core.runtime.CoreException)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 EObject (org.eclipse.emf.ecore.EObject)1 EOperation (org.eclipse.emf.ecore.EOperation)1 EPackage (org.eclipse.emf.ecore.EPackage)1 Window (org.eclipse.jface.window.Window)1