Search in sources :

Example 36 with ComponentType

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

the class Aadl2RenameStrategy method setName.

@Override
protected EObject setName(URI targetElementURI, String newName, ResourceSet resourceSet) {
    EObject targetElement = super.setName(targetElementURI, newName, resourceSet);
    if (targetElement == null) {
        throw new RefactoringException("Target element not loaded.");
    }
    if (targetElement instanceof ComponentImplementation && !newName.contains(".")) {
        ComponentImplementation ci = (ComponentImplementation) targetElement;
        ComponentType ct = ci.getType();
        newName = ct.getName() + "." + newName;
        ci.setName(newName);
    }
    return targetElement;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentType(org.osate.aadl2.ComponentType) EObject(org.eclipse.emf.ecore.EObject) RefactoringException(org.eclipse.xtext.ui.refactoring.impl.RefactoringException)

Example 37 with ComponentType

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

the class SetExtendedClassifierPropertySection method getExtensibleClassifierDescriptions.

/**
 * Return a list of EObjectDescriptions for classifiers that could be extended.
 * The result will includes null since extending no classifier is a valid option.
 * @return
 */
private List<IEObjectDescription> getExtensibleClassifierDescriptions(final Classifier classifier) {
    final List<IEObjectDescription> objectDescriptions = new ArrayList<IEObjectDescription>();
    objectDescriptions.add(null);
    final String name = classifier.getQualifiedName();
    // Populate the list with valid classifier descriptions
    if (name != null) {
        for (final IEObjectDescription desc : AadlModelAccessUtil.getAllEObjectsByType(classifier.eResource(), classifier.eClass())) {
            if (!name.equalsIgnoreCase(desc.getName().toString("::"))) {
                objectDescriptions.add(desc);
            }
        }
        // Ensure that abstract classifiers are in the list
        if (classifier instanceof ComponentType) {
            if (classifier.eClass() != Aadl2Package.eINSTANCE.getAbstractType()) {
                for (final IEObjectDescription desc : AadlModelAccessUtil.getAllEObjectsByType(classifier.eResource(), Aadl2Package.eINSTANCE.getAbstractType())) {
                    if (!name.equalsIgnoreCase(desc.getName().toString("::"))) {
                        objectDescriptions.add(desc);
                    }
                }
            }
        } else if (classifier instanceof ComponentImplementation) {
            if (classifier.eClass() != Aadl2Package.eINSTANCE.getAbstractImplementation()) {
                for (final IEObjectDescription desc : AadlModelAccessUtil.getAllEObjectsByType(classifier.eResource(), Aadl2Package.eINSTANCE.getAbstractImplementation())) {
                    if (!name.equalsIgnoreCase(desc.getName().toString("::"))) {
                        objectDescriptions.add(desc);
                    }
                }
            }
        }
    }
    return objectDescriptions;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentType(org.osate.aadl2.ComponentType) ArrayList(java.util.ArrayList) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription)

Example 38 with ComponentType

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

the class SubcomponentImpl method getAllFeatures.

/**
 * Get list of all features of a subcomponent, including ancestor features
 * These are the features of its classifier
 * In case of refined features the refined feature is returned in the list.
 * @return List of features
 */
public EList<Feature> getAllFeatures() {
    ComponentImplementation ci = getComponentImplementation();
    if (ci != null) {
        return ci.getAllFeatures();
    }
    ComponentType ct = getComponentType();
    if (ct != null) {
        return ct.getAllFeatures();
    }
    return ECollections.emptyEList();
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentType(org.osate.aadl2.ComponentType)

Example 39 with ComponentType

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

the class AadlBusinessObjectProvider method getAllDefaultAnnexSubclauses.

/**
 * Returns all the default annex subclauses owned by a classifier or any extended or implemented classifiers.
 * @param topClassifier
 * @return
 */
private static EList<AnnexSubclause> getAllDefaultAnnexSubclauses(final Classifier topClassifier) {
    final EList<AnnexSubclause> result = new BasicEList<AnnexSubclause>();
    if (topClassifier == null) {
        return result;
    }
    final EList<Classifier> classifiers = topClassifier.getSelfPlusAllExtended();
    if (topClassifier instanceof ComponentImplementation) {
        ComponentType ct = ((ComponentImplementation) topClassifier).getType();
        if (ct != null) {
            // May be null in the case of an invalid model.
            final EList<Classifier> tclassifiers = ct.getSelfPlusAllExtended();
            classifiers.addAll(tclassifiers);
        }
    }
    for (Classifier classifier : classifiers) {
        result.addAll(classifier.getOwnedAnnexSubclauses());
    }
    return result;
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentType(org.osate.aadl2.ComponentType) BasicEList(org.eclipse.emf.common.util.BasicEList) Classifier(org.osate.aadl2.Classifier) SubprogramClassifier(org.osate.aadl2.SubprogramClassifier) ComponentClassifier(org.osate.aadl2.ComponentClassifier) DefaultAnnexSubclause(org.osate.aadl2.DefaultAnnexSubclause) AnnexSubclause(org.osate.aadl2.AnnexSubclause)

Example 40 with ComponentType

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

the class AssuranceCaseImpl method setSystem.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setSystem(ComponentType newSystem) {
    ComponentType oldSystem = system;
    system = newSystem;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, AlisaPackage.ASSURANCE_CASE__SYSTEM, oldSystem, system));
}
Also used : ComponentType(org.osate.aadl2.ComponentType) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Aggregations

ComponentType (org.osate.aadl2.ComponentType)73 ComponentImplementation (org.osate.aadl2.ComponentImplementation)46 Classifier (org.osate.aadl2.Classifier)34 ArrayList (java.util.ArrayList)29 AnnexSubclause (org.osate.aadl2.AnnexSubclause)24 ComponentClassifier (org.osate.aadl2.ComponentClassifier)24 EObject (org.eclipse.emf.ecore.EObject)18 NamedElement (org.osate.aadl2.NamedElement)18 EventDataPort (org.osate.aadl2.EventDataPort)15 DataPort (org.osate.aadl2.DataPort)14 EventPort (org.osate.aadl2.EventPort)14 AadlPackage (org.osate.aadl2.AadlPackage)13 Feature (org.osate.aadl2.Feature)13 CyberMission (com.ge.research.osate.verdict.dsl.verdict.CyberMission)11 CyberRel (com.ge.research.osate.verdict.dsl.verdict.CyberRel)11 CyberReq (com.ge.research.osate.verdict.dsl.verdict.CyberReq)11 Event (com.ge.research.osate.verdict.dsl.verdict.Event)11 SafetyRel (com.ge.research.osate.verdict.dsl.verdict.SafetyRel)11 SafetyReq (com.ge.research.osate.verdict.dsl.verdict.SafetyReq)11 Statement (com.ge.research.osate.verdict.dsl.verdict.Statement)11