Search in sources :

Example 16 with ComponentType

use of org.geotoolkit.sml.xml.v101.ComponentType in project osate2 by osate.

the class TypeExtensionImpl method setExtended.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setExtended(ComponentType newExtended) {
    ComponentType oldExtended = extended;
    extended = newExtended;
    if (eNotificationRequired()) {
        eNotify(new ENotificationImpl(this, Notification.SET, Aadl2Package.TYPE_EXTENSION__EXTENDED, oldExtended, extended));
    }
}
Also used : ComponentType(org.osate.aadl2.ComponentType) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 17 with ComponentType

use of org.geotoolkit.sml.xml.v101.ComponentType in project osate2 by osate.

the class ModeImpl method getPropertyValueInternal.

// Cannot make this final because I need to override in SystemOperationMode
public void getPropertyValueInternal(final Property prop, final PropertyAcc pas, final boolean fromInstanceSlaveCall, final boolean all) throws InvalidModelException {
    final Classifier owner = getContainingClassifier();
    final boolean inType = (owner instanceof ComponentType);
    // local contained value
    if (!inType && !fromInstanceSlaveCall) {
        // owner could be null if we are looking up a property on a SystemOperationMode, which does not have a containing classifier.
        if (owner != null && pas.addLocalContained(this, owner)) {
            if (!all) {
                return;
            }
        }
    }
    // local value
    if (pas.addLocal(this)) {
        if (!all) {
            return;
        }
    }
    // not an implementation
    if ((inType || !inType && !fromInstanceSlaveCall) && prop.isInherit()) {
        if (owner != null) {
            owner.getPropertyValueInternal(prop, pas, fromInstanceSlaveCall, all);
        } else {
            throw new InvalidModelException(this, "Mode is not contained in a component type or implementation");
        }
    }
}
Also used : InvalidModelException(org.osate.aadl2.properties.InvalidModelException) ComponentType(org.osate.aadl2.ComponentType) ComponentClassifier(org.osate.aadl2.ComponentClassifier) Classifier(org.osate.aadl2.Classifier)

Example 18 with ComponentType

use of org.geotoolkit.sml.xml.v101.ComponentType in project osate2 by osate.

the class AnnexHandler method getAnnexSubclauseIndex.

/**
 * Returns a 0 based index for referencing an annex subclause in a list that contains only annex subclauses with the same type and owner
 * @return
 */
public static int getAnnexSubclauseIndex(AnnexSubclause annexSubclause, final boolean useExtended) {
    // Get the default annex library if a parsed annex subclause was specified. This is needed for the comparison later in the function.
    if (!(annexSubclause instanceof DefaultAnnexSubclause)) {
        if (annexSubclause.eContainer() instanceof DefaultAnnexSubclause) {
            annexSubclause = (AnnexSubclause) annexSubclause.eContainer();
        } else {
            return -1;
        }
    }
    final String annexName = annexSubclause.getName();
    if (annexName == null) {
        return -1;
    }
    final Classifier cl = annexSubclause.getContainingClassifier();
    final List<Classifier> classifiers;
    if (useExtended) {
        classifiers = cl.getSelfPlusAllExtended();
        // Get all related classifiers
        if (cl instanceof ComponentImplementation) {
            final ComponentType ct = ((ComponentImplementation) cl).getType();
            if (ct != null) {
                classifiers.addAll(ct.getSelfPlusAllExtended());
            }
        }
    } else {
        classifiers = Arrays.asList(cl);
    }
    int index = 0;
    // Use reversed view of list so that base classifiers will be first. This is needed to ensure subclauses have unique indices
    for (final Classifier tmpClassifier : Lists.reverse(classifiers)) {
        for (final AnnexSubclause tmpSubclause : tmpClassifier.getOwnedAnnexSubclauses()) {
            if (tmpSubclause == annexSubclause) {
                return index;
            } else if (annexName.equalsIgnoreCase(tmpSubclause.getName())) {
                index++;
            }
        }
    }
    return -1;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentType(org.osate.aadl2.ComponentType) Classifier(org.osate.aadl2.Classifier) DefaultAnnexSubclause(org.osate.aadl2.DefaultAnnexSubclause) DefaultAnnexSubclause(org.osate.aadl2.DefaultAnnexSubclause) AnnexSubclause(org.osate.aadl2.AnnexSubclause)

Example 19 with ComponentType

use of org.geotoolkit.sml.xml.v101.ComponentType in project osate2 by osate.

the class AgeRenameParticipant method getDependentObjects.

private static Set<EObject> getDependentObjects(final EObject obj, final ResourceSet rs, final Map<URI, Set<URI>> externalReferencesMap) {
    final Set<EObject> results = new HashSet<>();
    final EObject objectOfInterest;
    // is the only known way of getting types related to the renames.
    if (obj instanceof ComponentTypeRename) {
        final ComponentType renamedComponentType = ((ComponentTypeRename) obj).getRenamedComponentType();
        objectOfInterest = renamedComponentType == null ? null : renamedComponentType;
    } else {
        objectOfInterest = obj;
    }
    if (objectOfInterest != null) {
        getRelatedObjects(Collections.singleton(objectOfInterest), rs, results, externalReferencesMap, obj instanceof Feature);
    }
    return results;
}
Also used : ComponentType(org.osate.aadl2.ComponentType) EObject(org.eclipse.emf.ecore.EObject) ComponentTypeRename(org.osate.aadl2.ComponentTypeRename) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) Feature(org.osate.aadl2.Feature) HashSet(java.util.HashSet)

Example 20 with ComponentType

use of org.geotoolkit.sml.xml.v101.ComponentType in project osate2 by osate.

the class ClassifierCreationHelper method buildName.

public String buildName(final ClassifierOperationPartType primaryType, final Supplier<AadlPackage> primaryPkgSupplier, final String identifier, final ClassifierOperationPart basePart) {
    final String newName;
    if (primaryType == ClassifierOperationPartType.NEW_COMPONENT_IMPLEMENTATION) {
        if (basePart == null) {
            throw new RuntimeException("Base operation in invalid");
        }
        final AadlPackage primaryPkg = primaryPkgSupplier.get();
        final PackageSection section = primaryPkg.getPublicSection();
        // Determine details about the type specified by the base operation part.
        final String baseTypeName;
        final AadlPackage typePackage;
        // Get the name of the type and the package in which it is contained.
        if (ClassifierOperationPartType.isCreate(basePart.getType())) {
            typePackage = getResolvedPackage(basePart.getSelectedPackage());
            baseTypeName = basePart.getIdentifier();
        } else if (basePart.getType() == ClassifierOperationPartType.EXISTING) {
            final Classifier classifier = getResolvedClassifier(basePart.getSelectedClassifier());
            final ComponentType ct = getResolvedComponentType(classifier);
            if (ct == null) {
                return null;
            }
            typePackage = getPackage(ct);
            baseTypeName = ct.getName();
        } else {
            throw new RuntimeException("Invalid base operation part: " + basePart.getType());
        }
        // Handle type not being in same package as implementation
        final boolean samePackage = AadlNameUtil.namesAreEqual(primaryPkg, typePackage);
        final String localBaseTypeName = samePackage ? baseTypeName : getRenamedType(section, typePackage, baseTypeName).aliasName;
        newName = localBaseTypeName + "." + identifier;
    } else {
        newName = identifier;
    }
    return newName;
}
Also used : ComponentType(org.osate.aadl2.ComponentType) AadlPackage(org.osate.aadl2.AadlPackage) PackageSection(org.osate.aadl2.PackageSection) PublicPackageSection(org.osate.aadl2.PublicPackageSection) Classifier(org.osate.aadl2.Classifier)

Aggregations

ComponentType (org.osate.aadl2.ComponentType)73 ComponentImplementation (org.osate.aadl2.ComponentImplementation)42 Classifier (org.osate.aadl2.Classifier)33 ComponentClassifier (org.osate.aadl2.ComponentClassifier)21 ArrayList (java.util.ArrayList)18 EObject (org.eclipse.emf.ecore.EObject)16 NamedElement (org.osate.aadl2.NamedElement)15 AnnexSubclause (org.osate.aadl2.AnnexSubclause)13 Feature (org.osate.aadl2.Feature)13 BasicEList (org.eclipse.emf.common.util.BasicEList)11 AadlPackage (org.osate.aadl2.AadlPackage)11 HashSet (java.util.HashSet)10 FeatureGroupType (org.osate.aadl2.FeatureGroupType)10 List (java.util.List)9 Subcomponent (org.osate.aadl2.Subcomponent)8 FeatureGroup (org.osate.aadl2.FeatureGroup)7 EList (org.eclipse.emf.common.util.EList)6 Property (org.osate.aadl2.Property)6 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)6 GetPropertyExpr (com.rockwellcollins.atc.agree.agree.GetPropertyExpr)5