Search in sources :

Example 21 with Identifier

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

the class AadlBaNameResolver method behaviorTimeResolver.

private boolean behaviorTimeResolver(DeclarativeTime bt) {
    Identifier timeUnit = bt.getUnitId();
    boolean result = integerValueResolver(bt.getIntegerValue());
    result &= timeUnitResolver(timeUnit);
    if (result && bt.getIntegerValue() instanceof BehaviorIntegerLiteral) {
        BehaviorIntegerLiteral bil = (BehaviorIntegerLiteral) bt.getIntegerValue();
        bil.setUnit((UnitLiteral) timeUnit.getOsateRef());
    }
    return result;
}
Also used : Identifier(org.osate.ba.declarative.Identifier) ArrayableIdentifier(org.osate.ba.declarative.ArrayableIdentifier) BehaviorIntegerLiteral(org.osate.ba.aadlba.BehaviorIntegerLiteral)

Example 22 with Identifier

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

the class AadlBaNameResolver method transDestStateResolver.

private boolean transDestStateResolver(DeclarativeBehaviorTransition trans) {
    BehaviorState state = null;
    Identifier id = trans.getDestState();
    state = AadlBaVisitors.findBehaviorState(_ba, id.getId());
    if (state != null) {
        id.setBaRef(state);
        return true;
    } else {
        reportNameError(id, id.getId());
        return false;
    }
}
Also used : Identifier(org.osate.ba.declarative.Identifier) ArrayableIdentifier(org.osate.ba.declarative.ArrayableIdentifier) BehaviorState(org.osate.ba.aadlba.BehaviorState)

Example 23 with Identifier

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

the class AadlBaNameResolver method transSrcStateResolver.

private boolean transSrcStateResolver(DeclarativeBehaviorTransition trans) {
    boolean result = true;
    BehaviorState state = null;
    for (Identifier id : trans.getSrcStates()) {
        state = AadlBaVisitors.findBehaviorState(_ba, id.getId());
        if (state != null) {
            id.setBaRef(state);
        } else {
            reportNameError(id, id.getId());
            result = false;
        }
    }
    return result;
}
Also used : Identifier(org.osate.ba.declarative.Identifier) ArrayableIdentifier(org.osate.ba.declarative.ArrayableIdentifier) BehaviorState(org.osate.ba.aadlba.BehaviorState)

Example 24 with Identifier

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

the class AadlBaNameResolver method classifierFeaturePropertyReferenceResolver.

private boolean classifierFeaturePropertyReferenceResolver(DeclarativePropertyReference ref) {
    Reference component = ref.getReference();
    if (refResolver(component)) {
        PropertyAssociation pa = null;
        Classifier type = null;
        Identifier propertyNameId = ref.getPropertyNames().get(0).getPropertyName();
        Element el = (component.getOsateRef() != null) ? component.getOsateRef() : component.getBaRef();
        if (el instanceof PrototypeBinding) {
            PrototypeBinding pb = (PrototypeBinding) el;
            type = AadlBaUtils.getClassifier(pb, pb.getContainingClassifier());
        } else if (el instanceof ClassifierFeature) {
            ClassifierFeature cf = (ClassifierFeature) el;
            // Fetch the own property association of the classifier feature.
            pa = PropertyUtils.findPropertyAssociation(propertyNameId.getId(), cf);
            if (pa == null) {
                type = AadlBaUtils.getClassifier(cf, cf.getContainingClassifier());
            }
        } else if (el instanceof BehaviorVariable) {
            BehaviorVariable bv = (BehaviorVariable) el;
            DeclarativeBehaviorElement de = (DeclarativeBehaviorElement) bv.getDataClassifier();
            if (de.getOsateRef() instanceof Classifier) {
                type = (Classifier) de.getOsateRef();
            }
        } else // Cannot resolve or unimplemented cases.
        {
            String msg = "the type of \'" + ((NamedElement) el).getName() + "\' cannot be resolved";
            _errManager.error(el, msg);
        }
        // search within its type.
        if (pa == null && type != null) {
            pa = PropertyUtils.findPropertyAssociation(propertyNameId.getId(), type);
        }
        if (pa != null) {
            ref.getPropertyNames().get(0).setOsateRef(pa);
            propertyNameId.setOsateRef(pa);
            return propertyNameResolver(ref.getPropertyNames());
        } else {
            reportNameError(propertyNameId, propertyNameId.getId());
            return false;
        }
    } else {
        // refResolver has already reported the error.
        return false;
    }
}
Also used : DeclarativeBehaviorElement(org.osate.ba.declarative.DeclarativeBehaviorElement) Identifier(org.osate.ba.declarative.Identifier) ArrayableIdentifier(org.osate.ba.declarative.ArrayableIdentifier) BehaviorVariable(org.osate.ba.aadlba.BehaviorVariable) DeclarativePropertyReference(org.osate.ba.declarative.DeclarativePropertyReference) Reference(org.osate.ba.declarative.Reference) PropertyAssociation(org.osate.aadl2.PropertyAssociation) DeclarativeBasicPropertyAssociation(org.osate.ba.declarative.DeclarativeBasicPropertyAssociation) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) 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) ComponentClassifier(org.osate.aadl2.ComponentClassifier) Classifier(org.osate.aadl2.Classifier) DataClassifier(org.osate.aadl2.DataClassifier) ProcessorClassifier(org.osate.aadl2.ProcessorClassifier) PrototypeBinding(org.osate.aadl2.PrototypeBinding) QualifiedNamedElement(org.osate.ba.declarative.QualifiedNamedElement) NamedElement(org.osate.aadl2.NamedElement) ClassifierFeature(org.osate.aadl2.ClassifierFeature)

Example 25 with Identifier

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

the class QualifiedNamedElementImpl method basicSetBaNamespace.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetBaNamespace(Identifier newBaNamespace, NotificationChain msgs) {
    Identifier oldBaNamespace = baNamespace;
    baNamespace = newBaNamespace;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DeclarativePackage.QUALIFIED_NAMED_ELEMENT__BA_NAMESPACE, oldBaNamespace, newBaNamespace);
        if (msgs == null) {
            msgs = notification;
        } else {
            msgs.add(notification);
        }
    }
    return msgs;
}
Also used : Identifier(org.osate.ba.declarative.Identifier) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Aggregations

Identifier (org.osate.ba.declarative.Identifier)30 ArrayableIdentifier (org.osate.ba.declarative.ArrayableIdentifier)10 BehaviorState (org.osate.ba.aadlba.BehaviorState)9 QualifiedNamedElement (org.osate.ba.declarative.QualifiedNamedElement)8 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)5 NamedElement (org.osate.aadl2.NamedElement)5 DeclarativeBehaviorTransition (org.osate.ba.declarative.DeclarativeBehaviorTransition)5 DeclarativePropertyReference (org.osate.ba.declarative.DeclarativePropertyReference)5 DataClassifier (org.osate.aadl2.DataClassifier)4 Reference (org.osate.ba.declarative.Reference)4 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)3 NamedValue (org.osate.aadl2.NamedValue)3 PropertyAssociation (org.osate.aadl2.PropertyAssociation)3 BehaviorElement (org.osate.ba.aadlba.BehaviorElement)3 BehaviorIntegerLiteral (org.osate.ba.aadlba.BehaviorIntegerLiteral)3 BehaviorVariable (org.osate.ba.aadlba.BehaviorVariable)3 DeclarativeBasicPropertyAssociation (org.osate.ba.declarative.DeclarativeBasicPropertyAssociation)3 DeclarativePropertyName (org.osate.ba.declarative.DeclarativePropertyName)3 BasicProperty (org.osate.aadl2.BasicProperty)2 Classifier (org.osate.aadl2.Classifier)2