Search in sources :

Example 1 with ErrorType

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

the class EMV2PathElementImpl method setErrorType.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setErrorType(ErrorTypes newErrorType) {
    ErrorTypes oldErrorType = errorType;
    errorType = newErrorType;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ErrorModelPackage.EMV2_PATH_ELEMENT__ERROR_TYPE, oldErrorType, errorType));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) ErrorTypes(org.osate.xtext.aadl2.errormodel.errorModel.ErrorTypes)

Example 2 with ErrorType

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

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

the class EMV2Util method getContainmentErrorType.

/**
 * get error type (last element of containment path, if present
 * Otherwise return null
 * @param containedNamedElement Containment path
 * @return EList<ErrorType>
 */
public static ErrorType getContainmentErrorType(ContainedNamedElement containedNamedElement) {
    EList<ContainmentPathElement> cpes = containedNamedElement.getContainmentPathElements();
    if (!cpes.isEmpty()) {
        ContainmentPathElement cpe = cpes.get(cpes.size() - 1);
        NamedElement appliestome = cpe.getNamedElement();
        if (appliestome instanceof ErrorType) {
            return ((ErrorType) appliestome);
        }
    }
    return null;
}
Also used : ErrorType(org.osate.xtext.aadl2.errormodel.errorModel.ErrorType) ContainmentPathElement(org.osate.aadl2.ContainmentPathElement) ContainedNamedElement(org.osate.aadl2.ContainedNamedElement) NamedElement(org.osate.aadl2.NamedElement)

Example 4 with ErrorType

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

the class ErrorModelValidator method checkCyclicExtends.

private void checkCyclicExtends(ErrorType origet) {
    ErrorType et = EMV2Util.resolveAlias(origet);
    if (et.getSuperType() == null) {
        return;
    }
    HashSet<ErrorType> result = new HashSet<ErrorType>();
    while (et.getSuperType() != null) {
        result.add(et);
        ErrorType last = et;
        et = EMV2Util.resolveAlias(et.getSuperType());
        if (result.contains(et)) {
            error(origet, "Cycle in supertype hierarchy of error type " + origet.getName() + " at type " + last.getName());
            return;
        }
    }
}
Also used : ErrorType(org.osate.xtext.aadl2.errormodel.errorModel.ErrorType) HashSet(java.util.HashSet)

Example 5 with ErrorType

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

ErrorType (org.osate.xtext.aadl2.errormodel.errorModel.ErrorType)30 TypeToken (org.osate.xtext.aadl2.errormodel.errorModel.TypeToken)13 TypeSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)12 ErrorModelLibrary (org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelLibrary)7 ErrorBehaviorState (org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState)6 ErrorPropagation (org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)6 NamedElement (org.osate.aadl2.NamedElement)5 ErrorTypes (org.osate.xtext.aadl2.errormodel.errorModel.ErrorTypes)5 AadlPackage (org.osate.aadl2.AadlPackage)4 BasicEList (org.eclipse.emf.common.util.BasicEList)3 UniqueEList (org.eclipse.emf.common.util.UniqueEList)3 EObject (org.eclipse.emf.ecore.EObject)3 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)3 Classifier (org.osate.aadl2.Classifier)3 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)3 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)3 PropagationPoint (org.osate.xtext.aadl2.errormodel.errorModel.PropagationPoint)3 HashSet (java.util.HashSet)2 URI (org.eclipse.emf.common.util.URI)2 AllExpression (org.osate.xtext.aadl2.errormodel.errorModel.AllExpression)2