Search in sources :

Example 1 with TypeMappingSet

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

the class ErrorPathImpl method setTypeMappingSet.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setTypeMappingSet(TypeMappingSet newTypeMappingSet) {
    TypeMappingSet oldTypeMappingSet = typeMappingSet;
    typeMappingSet = newTypeMappingSet;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ErrorModelPackage.ERROR_PATH__TYPE_MAPPING_SET, oldTypeMappingSet, typeMappingSet));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) TypeMappingSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeMappingSet)

Example 2 with TypeMappingSet

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

the class ErrorModelSubclauseImpl method setTypeMappingSet.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setTypeMappingSet(TypeMappingSet newTypeMappingSet) {
    TypeMappingSet oldTypeMappingSet = typeMappingSet;
    typeMappingSet = newTypeMappingSet;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ErrorModelPackage.ERROR_MODEL_SUBCLAUSE__TYPE_MAPPING_SET, oldTypeMappingSet, typeMappingSet));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) TypeMappingSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeMappingSet)

Example 3 with TypeMappingSet

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

the class ErrorModelValidator method checkTypeMappingSet.

/**
 * @since 6.1
 */
public void checkTypeMappingSet(TypeMappingSet tms) {
    int size = tms.getMapping().size();
    for (int i = 0; i < size; i++) {
        TypeSet ts = tms.getMapping().get(i).getTarget();
        TypeToken tt = ts.getTypeTokens().get(0);
        if (tt != null && tt.getType() != null && (!(tt.getType().get(0) instanceof ErrorType) || ts.getTypeTokens().size() > 1)) {
            error(tms.getMapping().get(i), "Target error type may only have a single error type");
        }
    }
}
Also used : ErrorType(org.osate.xtext.aadl2.errormodel.errorModel.ErrorType) TypeToken(org.osate.xtext.aadl2.errormodel.errorModel.TypeToken) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet) PropagationPoint(org.osate.xtext.aadl2.errormodel.errorModel.PropagationPoint)

Example 4 with TypeMappingSet

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

the class EMV2Util method getAllTypeEquivalenceMapping.

/**
 * return type mapping set to be used for bindings other than connection bindings.
 * Looks for use type equivalence in classifier or inherited from classifiers being extended
 * Also look in parent component instances, i.e., the equivalence mapping is inherited down the component hierarchy
 * @param ci Component Instance
 * @return TypeMappingSet
 */
public static TypeMappingSet getAllTypeEquivalenceMapping(ComponentInstance ci) {
    while (ci != null) {
        EList<ErrorModelSubclause> emslist = getAllContainingClassifierEMV2Subclauses(ci);
        for (ErrorModelSubclause errorModelSubclause : emslist) {
            TypeMappingSet tms = errorModelSubclause.getTypeEquivalence();
            if (tms != null) {
                return tms;
            }
        }
        ci = ci.getContainingComponentInstance();
    }
    return null;
}
Also used : ErrorModelSubclause(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause) TypeMappingSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeMappingSet)

Example 5 with TypeMappingSet

use of org.osate.xtext.aadl2.errormodel.errorModel.TypeMappingSet 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

TypeMappingSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeMappingSet)8 TypeSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)6 TypeToken (org.osate.xtext.aadl2.errormodel.errorModel.TypeToken)5 ErrorModelSubclause (org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause)4 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)3 TypeTransformationSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeTransformationSet)3 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)2 ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)2 ErrorPropagation (org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)2 ErrorType (org.osate.xtext.aadl2.errormodel.errorModel.ErrorType)2 MathContext (java.math.MathContext)1 EPackage (org.eclipse.emf.ecore.EPackage)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 AadlPackage (org.osate.aadl2.AadlPackage)1 ArrayRange (org.osate.aadl2.ArrayRange)1 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)1 BooleanLiteral (org.osate.aadl2.BooleanLiteral)1 Classifier (org.osate.aadl2.Classifier)1