Search in sources :

Example 1 with TypeToken

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

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

the class ErrorModelValidator method checkTypePropagationAndContainment.

private void checkTypePropagationAndContainment(ErrorPropagation ep) {
    ErrorPropagation epopposite;
    if (ep.isNot()) {
        // do it only for propagation, so we do not get double messages.
        return;
    }
    epopposite = EMV2Util.findErrorContainment(ep.getContainingClassifier(), EMV2Util.getPrintName(ep), ep.getDirection());
    if (epopposite == null) {
        return;
    }
    BasicEList<TypeToken> res = EMV2TypeSetUtil.getTypeSetIntersection(ep.getTypeSet(), epopposite.getTypeSet());
    if (!res.isEmpty()) {
        error(ep, "Error propagation and containment " + EMV2Util.getPrintName(ep) + " have a common error type or type product " + EMV2Util.getPrintName(res));
    }
}
Also used : TypeToken(org.osate.xtext.aadl2.errormodel.errorModel.TypeToken) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)

Example 3 with TypeToken

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

the class ErrorModelValidator method checkTransitionTargetTypes.

private void checkTransitionTargetTypes(TransitionBranch ebt) {
    if (ebt.isSteadyState()) {
        return;
    }
    ErrorBehaviorState ebs = ebt.getTarget();
    if (ebs != null) {
        TypeSet ebsTS = ebs.getTypeSet();
        TypeSet tt = ebt.getTargetToken();
        if (tt == null || tt.getTypeTokens().isEmpty()) {
            return;
        }
        TypeToken ebtargetTS = tt.getTypeTokens().get(0);
        if (ebtargetTS == null) {
            return;
        }
        if (ebsTS == null && ebtargetTS != null) {
            error(ebt, "Target state " + ebs.getName() + " does not have a type set declared but the transition target specifies " + EMV2Util.getPrintName(ebtargetTS));
        } else if (!EMV2TypeSetUtil.contains(ebsTS, ebtargetTS)) {
            error(ebt, "Target type " + EMV2Util.getPrintName(ebt.getTargetToken()) + " is not contained in type set of error behavior state \'" + ebs.getName() + "\'");
        }
    }
}
Also used : ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) TypeToken(org.osate.xtext.aadl2.errormodel.errorModel.TypeToken) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)

Example 4 with TypeToken

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

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

the class EMV2Util method getName.

public static String getName(EList<TypeToken> tul) {
    boolean docomma = false;
    String res = "";
    for (TypeToken typeSetElement : tul) {
        EList<ErrorTypes> et = typeSetElement.getType();
        if (docomma) {
            res = res + ',';
        } else {
            docomma = true;
        }
        if (et != null && !et.isEmpty()) {
            boolean doproduct = false;
            for (ErrorTypes errorType : et) {
                if (doproduct) {
                    res = res + "*";
                } else {
                    doproduct = true;
                }
                res = res + errorType.getName();
            }
        }
    }
    return res;
}
Also used : TypeToken(org.osate.xtext.aadl2.errormodel.errorModel.TypeToken) ErrorTypes(org.osate.xtext.aadl2.errormodel.errorModel.ErrorTypes)

Aggregations

TypeToken (org.osate.xtext.aadl2.errormodel.errorModel.TypeToken)40 ErrorEvent (org.osate.xtext.aadl2.errormodel.errorModel.ErrorEvent)28 TypeSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)26 Event (org.osate.aadl2.errormodel.FaultTree.Event)24 ErrorPropagation (org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)17 EObject (org.eclipse.emf.ecore.EObject)14 ErrorBehaviorState (org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState)13 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)9 LinkedList (java.util.LinkedList)8 BasicEList (org.eclipse.emf.common.util.BasicEList)8 ErrorType (org.osate.xtext.aadl2.errormodel.errorModel.ErrorType)8 ErrorTypes (org.osate.xtext.aadl2.errormodel.errorModel.ErrorTypes)7 NamedElement (org.osate.aadl2.NamedElement)5 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)5 ErrorSource (org.osate.xtext.aadl2.errormodel.errorModel.ErrorSource)5 EList (org.eclipse.emf.common.util.EList)4 ConditionExpression (org.osate.xtext.aadl2.errormodel.errorModel.ConditionExpression)4 ErrorBehaviorTransition (org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorTransition)4 OrmoreExpression (org.osate.xtext.aadl2.errormodel.errorModel.OrmoreExpression)4 BigDecimal (java.math.BigDecimal)3