Search in sources :

Example 1 with BehaviorElement

use of org.osate.ba.aadlba.BehaviorElement in project osate2 by osate.

the class AadlBaNameResolver method propertySetpropertyReferenceResolver.

private boolean propertySetpropertyReferenceResolver(DeclarativePropertyReference ref) {
    Identifier propertyNameId = ref.getPropertyNames().get(0).getPropertyName();
    String packageName = null;
    if (ref.getQualifiedName() != null) {
        packageName = ref.getQualifiedName().getBaNamespace().getId();
    }
    NamedElement ne = null;
    // Now check the type in each current package's sections.
    for (PackageSection context : _contextsTab) {
        ne = Aadl2Visitors.findElementInPropertySet(propertyNameId.getId(), packageName, context);
        if (ne != null) {
            propertyNameId.setOsateRef(ne);
            ref.getPropertyNames().get(0).setOsateRef(ne);
            if (packageName != null) {
                ref.getQualifiedName().getBaNamespace().setOsateRef(ne.getNamespace());
                ref.getQualifiedName().setOsateRef(ne.getNamespace());
            }
            if (ne instanceof Property) {
                Property p = (Property) ne;
                // First search within the default values.
                if (p.getDefaultValue() != null) {
                    PropertyExpression pe = p.getDefaultValue();
                    propertyNameId.setOsateRef(pe);
                    ref.getPropertyNames().get(0).setOsateRef(pe);
                }
                return propertyNameResolver(ref.getPropertyNames());
            } else if (ne instanceof PropertyType) {
                if (ne instanceof EnumerationType) {
                    return propertyNameResolver(ref.getPropertyNames());
                } else {
                    // It doesn't make any sense
                    // for the other types.
                    String msg = "reference to property type (other than enumeration" + " type) is not supported";
                    _errManager.error(ref.getPropertyNames().get(1).getPropertyName(), msg);
                    return false;
                }
            } else // Property constant case.
            {
                if (ref.getPropertyNames().size() > 1) {
                    // Property constants haven't any sub property.
                    String msg = "property names are not supported for property constant";
                    _errManager.error(ref.getPropertyNames().get(1).getPropertyName(), msg);
                    return false;
                } else {
                    DeclarativePropertyName firstDpn = ref.getPropertyNames().get(0);
                    if (null != firstDpn.getField() || firstDpn.isSetIndexes()) {
                        // Property constants haven't any property field.
                        String msg = "property fields are not supported for property constant";
                        BehaviorElement bel = (null != firstDpn.getField()) ? firstDpn.getField() : firstDpn.getIndexes().get(0);
                        _errManager.error(bel, msg);
                        return false;
                    } else {
                        return true;
                    }
                }
            }
        }
    }
    reportNameError(propertyNameId, propertyNameId.getId());
    return false;
}
Also used : Identifier(org.osate.ba.declarative.Identifier) ArrayableIdentifier(org.osate.ba.declarative.ArrayableIdentifier) PackageSection(org.osate.aadl2.PackageSection) EnumerationType(org.osate.aadl2.EnumerationType) DeclarativeBehaviorElement(org.osate.ba.declarative.DeclarativeBehaviorElement) BehaviorElement(org.osate.ba.aadlba.BehaviorElement) PropertyExpression(org.osate.aadl2.PropertyExpression) PropertyType(org.osate.aadl2.PropertyType) QualifiedNamedElement(org.osate.ba.declarative.QualifiedNamedElement) NamedElement(org.osate.aadl2.NamedElement) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property) DeclarativePropertyName(org.osate.ba.declarative.DeclarativePropertyName)

Example 2 with BehaviorElement

use of org.osate.ba.aadlba.BehaviorElement in project osate2 by osate.

the class QualifiedNamedElementImpl method setBaRef.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setBaRef(BehaviorElement newBaRef) {
    BehaviorElement oldBaRef = baRef;
    baRef = newBaRef;
    if (eNotificationRequired()) {
        eNotify(new ENotificationImpl(this, Notification.SET, DeclarativePackage.QUALIFIED_NAMED_ELEMENT__BA_REF, oldBaRef, baRef));
    }
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) BehaviorElement(org.osate.ba.aadlba.BehaviorElement) DeclarativeBehaviorElement(org.osate.ba.declarative.DeclarativeBehaviorElement)

Example 3 with BehaviorElement

use of org.osate.ba.aadlba.BehaviorElement in project osate2 by osate.

the class DeclarativeTimeImpl method setBaRef.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setBaRef(BehaviorElement newBaRef) {
    BehaviorElement oldBaRef = baRef;
    baRef = newBaRef;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, DeclarativePackage.DECLARATIVE_TIME__BA_REF, oldBaRef, baRef));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) DeclarativeBehaviorElement(org.osate.ba.declarative.DeclarativeBehaviorElement) BehaviorElement(org.osate.ba.aadlba.BehaviorElement)

Example 4 with BehaviorElement

use of org.osate.ba.aadlba.BehaviorElement in project osate2 by osate.

the class ReferenceImpl method setBaRef.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setBaRef(BehaviorElement newBaRef) {
    BehaviorElement oldBaRef = baRef;
    baRef = newBaRef;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, DeclarativePackage.REFERENCE__BA_REF, oldBaRef, baRef));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) BehaviorElement(org.osate.ba.aadlba.BehaviorElement) DeclarativeBehaviorElement(org.osate.ba.declarative.DeclarativeBehaviorElement)

Example 5 with BehaviorElement

use of org.osate.ba.aadlba.BehaviorElement in project osate2 by osate.

the class IdentifierImpl method setBaRef.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setBaRef(BehaviorElement newBaRef) {
    BehaviorElement oldBaRef = baRef;
    baRef = newBaRef;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, DeclarativePackage.IDENTIFIER__BA_REF, oldBaRef, baRef));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) DeclarativeBehaviorElement(org.osate.ba.declarative.DeclarativeBehaviorElement) BehaviorElement(org.osate.ba.aadlba.BehaviorElement)

Aggregations

BehaviorElement (org.osate.ba.aadlba.BehaviorElement)10 DeclarativeBehaviorElement (org.osate.ba.declarative.DeclarativeBehaviorElement)10 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)9 BasicProperty (org.osate.aadl2.BasicProperty)1 EnumerationType (org.osate.aadl2.EnumerationType)1 NamedElement (org.osate.aadl2.NamedElement)1 PackageSection (org.osate.aadl2.PackageSection)1 Property (org.osate.aadl2.Property)1 PropertyExpression (org.osate.aadl2.PropertyExpression)1 PropertyType (org.osate.aadl2.PropertyType)1 ArrayableIdentifier (org.osate.ba.declarative.ArrayableIdentifier)1 DeclarativePropertyName (org.osate.ba.declarative.DeclarativePropertyName)1 Identifier (org.osate.ba.declarative.Identifier)1 QualifiedNamedElement (org.osate.ba.declarative.QualifiedNamedElement)1