Search in sources :

Example 16 with TypeSet

use of org.osate.xtext.aadl2.errormodel.errorModel.TypeSet in project osate2 by osate.

the class TypeTransformationImpl method basicSetSource.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetSource(TypeSet newSource, NotificationChain msgs) {
    TypeSet oldSource = source;
    source = newSource;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ErrorModelPackage.TYPE_TRANSFORMATION__SOURCE, oldSource, newSource);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)

Example 17 with TypeSet

use of org.osate.xtext.aadl2.errormodel.errorModel.TypeSet in project osate2 by osate.

the class OutgoingPropagationConditionImpl method basicSetTypeToken.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetTypeToken(TypeSet newTypeToken, NotificationChain msgs) {
    TypeSet oldTypeToken = typeToken;
    typeToken = newTypeToken;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ErrorModelPackage.OUTGOING_PROPAGATION_CONDITION__TYPE_TOKEN, oldTypeToken, newTypeToken);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)

Example 18 with TypeSet

use of org.osate.xtext.aadl2.errormodel.errorModel.TypeSet in project osate2 by osate.

the class OutgoingPropagationConditionImpl method basicSetTypeTokenConstraint.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetTypeTokenConstraint(TypeSet newTypeTokenConstraint, NotificationChain msgs) {
    TypeSet oldTypeTokenConstraint = typeTokenConstraint;
    typeTokenConstraint = newTypeTokenConstraint;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ErrorModelPackage.OUTGOING_PROPAGATION_CONDITION__TYPE_TOKEN_CONSTRAINT, oldTypeTokenConstraint, newTypeTokenConstraint);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)

Example 19 with TypeSet

use of org.osate.xtext.aadl2.errormodel.errorModel.TypeSet in project osate2 by osate.

the class EMV2Properties method getFailure.

/**
 * @param element - the EMV2 element that referes to the artifact
 * @param relatedComponent - the component the component (instance, subcomponent or classifier) that have the property association
 * @return - the text related to the failure part of the hazards property. Null if not defined
 */
public static String getFailure(NamedElement element, NamedElement relatedComponent) {
    TypeSet ts = null;
    if (element instanceof ErrorBehaviorState) {
        ts = ((ErrorBehaviorState) element).getTypeSet();
    }
    if (element instanceof ErrorPropagation) {
        ts = ((ErrorPropagation) element).getTypeSet();
    }
    if (element instanceof ErrorEvent) {
        ts = ((ErrorEvent) element).getTypeSet();
    }
    List<EMV2PropertyAssociation> PA = EMV2Properties.getHazardsProperty(relatedComponent, element, ts);
    if (PA.isEmpty()) {
        return null;
    }
    // XXX TODO we may get more than one back, one each for different types
    PropertyExpression val = getPropertyValue(PA.get(0));
    if (val instanceof RecordValue) {
        RecordValue rv = (RecordValue) val;
        EList<BasicPropertyAssociation> fields = rv.getOwnedFieldValues();
        BasicPropertyAssociation xref = GetProperties.getRecordField(fields, "failure");
        if (xref != null) {
            PropertyExpression peVal = getPropertyValue(xref);
            if (peVal instanceof StringLiteral) {
                return ((StringLiteral) peVal).getValue();
            }
        }
    }
    if (val instanceof ListValue) {
        ListValue lv = (ListValue) val;
        for (PropertyExpression pe : lv.getOwnedListElements()) {
            if (pe instanceof RecordValue) {
                RecordValue rv = (RecordValue) pe;
                EList<BasicPropertyAssociation> fields = rv.getOwnedFieldValues();
                BasicPropertyAssociation xref = GetProperties.getRecordField(fields, "failure");
                if (xref != null) {
                    PropertyExpression peVal = getPropertyValue(xref);
                    if (peVal instanceof StringLiteral) {
                        return ((StringLiteral) peVal).getValue();
                    }
                }
            }
        }
    }
    return null;
}
Also used : ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) StringLiteral(org.osate.aadl2.StringLiteral) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet) ListValue(org.osate.aadl2.ListValue) ErrorEvent(org.osate.xtext.aadl2.errormodel.errorModel.ErrorEvent) EMV2PropertyAssociation(org.osate.xtext.aadl2.errormodel.errorModel.EMV2PropertyAssociation) RecordValue(org.osate.aadl2.RecordValue) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation) PropertyExpression(org.osate.aadl2.PropertyExpression) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation)

Example 20 with TypeSet

use of org.osate.xtext.aadl2.errormodel.errorModel.TypeSet in project osate2 by osate.

the class EMV2TypeSetUtil method reverseMapTypeToken.

/**
 * map a TypeToken from the target type token to the first type token in the source type set according to the TypeMappingSet.
 * The original token is not modified.
 * The result token is currently that from the mapping rule and is not expected to be modified
 * @param token TypeToken
 * @param tms TypeMappingSet
 * @return result TypeToken or null if no mapping found
 */
public static TypeToken reverseMapTypeToken(TypeToken token, TypeMappingSet tms) {
    EList<TypeMapping> tmlist = tms.getMapping();
    for (TypeMapping typeMapping : tmlist) {
        TypeSet src = typeMapping.getSource();
        TypeSet trg = typeMapping.getTarget();
        if (contains(trg, token)) {
            return src.getTypeTokens().get(0);
        }
    }
    return null;
}
Also used : TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet) TypeMapping(org.osate.xtext.aadl2.errormodel.errorModel.TypeMapping)

Aggregations

TypeSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)66 TypeToken (org.osate.xtext.aadl2.errormodel.errorModel.TypeToken)29 ErrorPropagation (org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)22 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)21 ErrorBehaviorState (org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState)21 ErrorType (org.osate.xtext.aadl2.errormodel.errorModel.ErrorType)14 NamedElement (org.osate.aadl2.NamedElement)11 ErrorEvent (org.osate.xtext.aadl2.errormodel.errorModel.ErrorEvent)10 EObject (org.eclipse.emf.ecore.EObject)9 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)9 ConditionElement (org.osate.xtext.aadl2.errormodel.errorModel.ConditionElement)9 EMV2PropertyAssociation (org.osate.xtext.aadl2.errormodel.errorModel.EMV2PropertyAssociation)9 ErrorSource (org.osate.xtext.aadl2.errormodel.errorModel.ErrorSource)9 BasicEList (org.eclipse.emf.common.util.BasicEList)8 ErrorTypes (org.osate.xtext.aadl2.errormodel.errorModel.ErrorTypes)8 EventOrPropagation (org.osate.xtext.aadl2.errormodel.errorModel.EventOrPropagation)7 EList (org.eclipse.emf.common.util.EList)6 ErrorBehaviorTransition (org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorTransition)6 ErrorModelSubclause (org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause)6 Collection (java.util.Collection)5