use of org.geotoolkit.sml.xml.v101.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;
}
use of org.geotoolkit.sml.xml.v101.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();
}
use of org.geotoolkit.sml.xml.v101.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;
}
use of org.geotoolkit.sml.xml.v101.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));
}
use of org.geotoolkit.sml.xml.v101.ComponentType in project osate2 by osate.
the class AadlBaUtils method prototypeBindingResolverForDataComponentReference.
/**
* Returns the DataClassifier object associated to prototype binding in a DataComponentReference
*
* @param r the DataComponentRefenrence object from which the binding will be resolved
* @param dp the DataPrototpye object that enables to identify the targeted prototype binding
* @param parentContainer the object that contains the element binded to the
* given DataComponentRefenrence
* @return the DataClassifier object
*/
private static DataClassifier prototypeBindingResolverForDataComponentReference(DataComponentReference r, DataPrototype dp, NamedElement parentContainer) {
if (r.getData().size() > 1) {
DataHolder h = r.getData().get(r.getData().size() - 2);
NamedElement parent = h.getElement();
if (parent instanceof Classifier) {
Classifier c = (Classifier) parent;
return getDataClassifier(c.getOwnedPrototypeBindings(), dp);
}
if (parent instanceof Subcomponent) {
Subcomponent s = (Subcomponent) parent;
return getDataClassifier(s.getOwnedPrototypeBindings(), dp);
} else if (parent instanceof DataAccess) {
DataAccess da = (DataAccess) parent;
DataSubcomponentType parentDst = da.getDataFeatureClassifier();
Classifier c = (Classifier) parentDst;
DataClassifier matchedPrototype = getDataClassifier(c.getOwnedPrototypeBindings(), dp);
if (matchedPrototype == null) {
if (parentContainer instanceof ComponentType) {
ComponentType ct = (ComponentType) parentContainer;
for (Feature f : ct.getOwnedFeatures()) {
if (f instanceof DataAccess && f.getName().equals(parent.getName())) {
DataAccess containerDa = (DataAccess) f;
DataSubcomponentType containerDst = containerDa.getDataFeatureClassifier();
Classifier c2 = (Classifier) containerDst;
return getDataClassifier(c2.getOwnedPrototypeBindings(), dp);
}
}
}
}
} else if (parent instanceof DataPort) {
DataPort dataport = (DataPort) parent;
DataSubcomponentType parentDst = dataport.getDataFeatureClassifier();
Classifier c = (Classifier) parentDst;
DataClassifier matchedPrototype = getDataClassifier(c.getOwnedPrototypeBindings(), dp);
if (matchedPrototype == null) {
if (parentContainer instanceof ComponentType) {
ComponentType ct = (ComponentType) parentContainer;
for (Feature f : ct.getOwnedFeatures()) {
if (f instanceof DataPort && f.getName().equals(parent.getName())) {
DataPort containerDp = (DataPort) f;
DataSubcomponentType containerDst = containerDp.getDataFeatureClassifier();
Classifier c2 = (Classifier) containerDst;
return getDataClassifier(c2.getOwnedPrototypeBindings(), dp);
}
}
}
}
}
}
return null;
}
Aggregations