Search in sources :

Example 6 with Reference

use of org.osate.ba.declarative.Reference in project osate2 by osate.

the class AadlBaTypeChecker method unparseNameElement.

private String unparseNameElement(BehaviorElement e) {
    if (e instanceof Reference) {
        return unparseReference((Reference) e);
    } else {
        AadlBaUnparser unparser = new AadlBaUnparser();
        unparser.process(e);
        return unparser.getOutput();
    }
}
Also used : AadlBaUnparser(org.osate.ba.unparser.AadlBaUnparser) LocationReference(org.osate.aadl2.parsesupport.LocationReference) Reference(org.osate.ba.declarative.Reference) DeclarativePropertyReference(org.osate.ba.declarative.DeclarativePropertyReference)

Example 7 with Reference

use of org.osate.ba.declarative.Reference in project osate2 by osate.

the class AadlBaTypeChecker method dispatchConditionCheck.

/**
 * Document: AADL Behavior Annex draft
 * Version : 0.94
 * Type : Naming rule
 * Section : D.4 Thread Dispatch Behavior Specification
 * Object : Check naming rules D.4.(N1), D.4.(N2)
 * Keys : frozen port, subprogram access feature, dispatch trigger condition
 */
private boolean dispatchConditionCheck(DispatchCondition cond) {
    boolean result = false;
    DispatchTriggerCondition dtc = cond.getDispatchTriggerCondition();
    if (dtc != null) {
        DispatchTriggerCondition tmp = dispatchTriggerConditionCheck(dtc);
        result = tmp != null;
        // dispatchTriggerConditionCheck method. So replace if needed.
        if (tmp != dtc && result) {
            cond.setDispatchTriggerCondition(tmp);
        }
    } else {
        result = true;
    }
    if (cond.isSetFrozenPorts()) {
        PortHolder portHolder = null;
        ListIterator<ActualPortHolder> it = cond.getFrozenPorts().listIterator();
        while (it.hasNext()) {
            Reference ref = (Reference) it.next();
            portHolder = frozenPortCheck(ref);
            if (portHolder != null) {
                it.set((ActualPortHolder) portHolder);
            } else {
                result = false;
            }
        }
    }
    return result;
}
Also used : LocationReference(org.osate.aadl2.parsesupport.LocationReference) Reference(org.osate.ba.declarative.Reference) DeclarativePropertyReference(org.osate.ba.declarative.DeclarativePropertyReference)

Example 8 with Reference

use of org.osate.ba.declarative.Reference in project osate2 by osate.

the class AadlBaNameResolver method dispatchTriggerLogicalExpressionResolver.

private boolean dispatchTriggerLogicalExpressionResolver(DispatchTriggerLogicalExpression dtle) {
    boolean result = true;
    for (DispatchConjunction dc : dtle.getDispatchConjunctions()) {
        for (Element e : dc.getDispatchTriggers()) {
            Reference trigg = (Reference) e;
            result &= refResolver(trigg);
        }
    }
    return result;
}
Also used : DispatchConjunction(org.osate.ba.aadlba.DispatchConjunction) DeclarativePropertyReference(org.osate.ba.declarative.DeclarativePropertyReference) Reference(org.osate.ba.declarative.Reference) ContainmentPathElement(org.osate.aadl2.ContainmentPathElement) QualifiedNamedElement(org.osate.ba.declarative.QualifiedNamedElement) DeclarativeBehaviorElement(org.osate.ba.declarative.DeclarativeBehaviorElement) NamedElement(org.osate.aadl2.NamedElement) Element(org.osate.aadl2.Element) BehaviorElement(org.osate.ba.aadlba.BehaviorElement)

Example 9 with Reference

use of org.osate.ba.declarative.Reference in project osate2 by osate.

the class AadlBaNameResolver method communicationActionResolver.

private boolean communicationActionResolver(CommAction act) {
    boolean result = true;
    if (act.getTarget() != null) {
        result &= targetResolver(act.getTarget());
    }
    if (act.getQualifiedName() != null) {
        result &= qualifiedNamedElementResolver(act.getQualifiedName(), true);
    }
    if (act.getReference() != null) {
        // Ambiguous cases :
        // _ unqualified unique component classifier reference
        // without implementation information provided, are parsed as reference
        // (single name) without array index.
        // _ unqualified unique component classifier reference with
        // implementation information provided and a reference (two names)
        // without array index.
        Reference ref = act.getReference();
        EList<ArrayableIdentifier> ids = ref.getIds();
        boolean hasArrayIndex = false;
        // names.
        if (ids.size() > 2) {
            result &= refResolver(ref);
        } else {
            for (ArrayableIdentifier id : ids) {
                if (id.isSetArrayIndexes()) {
                    hasArrayIndex = true;
                }
            }
            // unique component classifier reference can't have array index.
            if (hasArrayIndex) {
                result &= refResolver(ref);
            } else {
                // Resolves ambiguous case between unqualified unique component
                // classifier reference and a reference with only one name.
                ArrayableIdentifier idComponent = ids.get(0);
                StringBuilder subprogramName = new StringBuilder();
                subprogramName.append(idComponent.getId());
                if (ids.size() == 2) {
                    ArrayableIdentifier idImplementation = ids.get(1);
                    subprogramName.append('.');
                    subprogramName.append(idImplementation.getId());
                }
                QualifiedNamedElement qne = DeclarativeFactory.eINSTANCE.createQualifiedNamedElement();
                // Clone the identifier as object reference in the most of the AADLBA
                // Front End emf meta model classes are unique (the containment
                // attribute set to true).
                Identifier idClone = DeclarativeFactory.eINSTANCE.createIdentifier();
                idClone.setLocationReference(idComponent.getLocationReference());
                idClone.setId(subprogramName.toString());
                qne.setBaName(idClone);
                qne.setBaNamespace(null);
                qne.setLocationReference(idComponent.getLocationReference());
                if (qualifiedNamedElementResolver(qne, false)) {
                    act.setReference(null);
                    act.setQualifiedName(qne);
                    act.setLocationReference(qne.getLocationReference());
                    result &= true;
                } else {
                    result &= refResolver(ref);
                }
            }
        }
    }
    if (act.isSetParameters()) {
        result &= subprogramParameterListResolver(act.getParameters());
    }
    return result;
}
Also used : QualifiedNamedElement(org.osate.ba.declarative.QualifiedNamedElement) Identifier(org.osate.ba.declarative.Identifier) ArrayableIdentifier(org.osate.ba.declarative.ArrayableIdentifier) DeclarativePropertyReference(org.osate.ba.declarative.DeclarativePropertyReference) Reference(org.osate.ba.declarative.Reference) ArrayableIdentifier(org.osate.ba.declarative.ArrayableIdentifier)

Example 10 with Reference

use of org.osate.ba.declarative.Reference in project osate2 by osate.

the class NamedValueImpl method basicSetReference.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetReference(Reference newReference, NotificationChain msgs) {
    Reference oldReference = reference;
    reference = newReference;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DeclarativePackage.NAMED_VALUE__REFERENCE, oldReference, newReference);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : Reference(org.osate.ba.declarative.Reference) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Aggregations

Reference (org.osate.ba.declarative.Reference)19 DeclarativePropertyReference (org.osate.ba.declarative.DeclarativePropertyReference)16 LocationReference (org.osate.aadl2.parsesupport.LocationReference)7 QualifiedNamedElement (org.osate.ba.declarative.QualifiedNamedElement)6 NamedElement (org.osate.aadl2.NamedElement)5 ArrayableIdentifier (org.osate.ba.declarative.ArrayableIdentifier)5 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)4 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)4 DataClassifier (org.osate.aadl2.DataClassifier)4 Element (org.osate.aadl2.Element)4 BehaviorElement (org.osate.ba.aadlba.BehaviorElement)4 Identifier (org.osate.ba.declarative.Identifier)4 Classifier (org.osate.aadl2.Classifier)3 ComponentClassifier (org.osate.aadl2.ComponentClassifier)3 ProcessorClassifier (org.osate.aadl2.ProcessorClassifier)3 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)2 ClassifierFeature (org.osate.aadl2.ClassifierFeature)2 ClassifierValue (org.osate.aadl2.ClassifierValue)2 Feature (org.osate.aadl2.Feature)2 PropertyAssociation (org.osate.aadl2.PropertyAssociation)2