Search in sources :

Example 6 with PropertyOwner

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

the class ComponentInstanceImpl method acceptsProperty.

public boolean acceptsProperty(Property property) {
    ComponentClassifier cc = getComponentClassifier();
    Subcomponent sub = getSubcomponent();
    if (getCategory().equals(ComponentCategory.ABSTRACT)) {
        return true;
    }
    for (PropertyOwner propOwner : property.getAppliesTos()) {
        if (propOwner instanceof MetaclassReference) {
            MetaclassReference metaRef = (MetaclassReference) propOwner;
            if (metaRef.getMetaclassNames().get(0).equals("all")) {
                return true;
            } else {
                EClass appliesTo = metaRef.getMetaclass();
                if (appliesTo == null) {
                    return false;
                }
                if (cc != null && appliesTo.isSuperTypeOf(cc.eClass()) || sub != null && appliesTo.isSuperTypeOf(sub.eClass())) {
                    return true;
                }
            }
        }
    }
    return (cc == null) ? false : cc.checkAppliesToClassifier(property);
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) PropertyOwner(org.osate.aadl2.PropertyOwner) EClass(org.eclipse.emf.ecore.EClass) Subcomponent(org.osate.aadl2.Subcomponent) MetaclassReference(org.osate.aadl2.MetaclassReference)

Example 7 with PropertyOwner

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

the class ConnectionReferenceImpl method acceptsProperty.

/*
	 * (non-Javadoc)
	 *
	 * @see org.osate.aadl2.instance.impl.InstanceObjectImpl#acceptsProperty(org.osate.aadl2.Property)
	 */
public boolean acceptsProperty(Property property) {
    final boolean result;
    for (final PropertyOwner propOwner : property.getAppliesTos()) {
        if (propOwner instanceof MetaclassReference) {
            if ((((MetaclassReference) propOwner).getMetaclassNames().size() > 0) && ((MetaclassReference) propOwner).getMetaclassNames().get(0).equals("all")) {
                return true;
            }
        }
    }
    // OsateDebug.osateDebug("[ConnectionReferenceImpl] acceptsProperty" + property);
    // OsateDebug.osateDebug("[ConnectionReferenceImpl] getConnection()=" + getConnection());
    result = getConnection().acceptsProperty(property);
    // OsateDebug.osateDebug("[ConnectionReferenceImpl] result=" + result);
    return result;
}
Also used : PropertyOwner(org.osate.aadl2.PropertyOwner) MetaclassReference(org.osate.aadl2.MetaclassReference)

Aggregations

PropertyOwner (org.osate.aadl2.PropertyOwner)6 HashSet (java.util.HashSet)3 EObject (org.eclipse.emf.ecore.EObject)3 AbstractImplementation (org.osate.aadl2.AbstractImplementation)3 AbstractType (org.osate.aadl2.AbstractType)3 BusImplementation (org.osate.aadl2.BusImplementation)3 BusType (org.osate.aadl2.BusType)3 DeviceImplementation (org.osate.aadl2.DeviceImplementation)3 DeviceType (org.osate.aadl2.DeviceType)3 MemoryImplementation (org.osate.aadl2.MemoryImplementation)3 MemoryType (org.osate.aadl2.MemoryType)3 ProcessImplementation (org.osate.aadl2.ProcessImplementation)3 ProcessType (org.osate.aadl2.ProcessType)3 ProcessorImplementation (org.osate.aadl2.ProcessorImplementation)3 ProcessorType (org.osate.aadl2.ProcessorType)3 Property (org.osate.aadl2.Property)3 SubprogramImplementation (org.osate.aadl2.SubprogramImplementation)3 SubprogramType (org.osate.aadl2.SubprogramType)3 SystemImplementation (org.osate.aadl2.SystemImplementation)3 SystemType (org.osate.aadl2.SystemType)3