Search in sources :

Example 1 with ErrorBehaviorState

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

the class ErrorSourceImpl method setFailureModeReference.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setFailureModeReference(ErrorBehaviorState newFailureModeReference) {
    ErrorBehaviorState oldFailureModeReference = failureModeReference;
    failureModeReference = newFailureModeReference;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ErrorModelPackage.ERROR_SOURCE__FAILURE_MODE_REFERENCE, oldFailureModeReference, failureModeReference));
}
Also used : ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 2 with ErrorBehaviorState

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

the class ErrorBehaviorTransitionImpl method setSource.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setSource(ErrorBehaviorState newSource) {
    ErrorBehaviorState oldSource = source;
    source = newSource;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ErrorModelPackage.ERROR_BEHAVIOR_TRANSITION__SOURCE, oldSource, source));
}
Also used : ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 3 with ErrorBehaviorState

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

the class ErrorBehaviorTransitionImpl method setTarget.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setTarget(ErrorBehaviorState newTarget) {
    ErrorBehaviorState oldTarget = target;
    target = newTarget;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ErrorModelPackage.ERROR_BEHAVIOR_TRANSITION__TARGET, oldTarget, target));
}
Also used : ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 4 with ErrorBehaviorState

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

the class CompositeStateImpl method setState.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setState(ErrorBehaviorState newState) {
    ErrorBehaviorState oldState = state;
    state = newState;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ErrorModelPackage.COMPOSITE_STATE__STATE, oldState, state));
}
Also used : ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 5 with ErrorBehaviorState

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

the class ErrorModelValidator method checkTransitionTargetTriggerTypes.

private void checkTransitionTargetTriggerTypes(ErrorBehaviorTransition ebt) {
    if (ebt.isSteadyState()) {
        return;
    }
    ErrorBehaviorState targetstate = ebt.getTarget();
    if (targetstate != null) {
        TypeSet targetTS = targetstate.getTypeSet();
        if (targetTS == null) {
            return;
        }
        TypeSet tt = ebt.getTargetToken();
        if (tt != null) {
            return;
        }
        // state requires a type
        if (ebt.getCondition() instanceof ConditionElement) {
            // either the event must be typed or the source state must be typed
            EventOrPropagation ep = EMV2Util.getErrorEventOrPropagation((ConditionElement) ebt.getCondition());
            if (ep instanceof ErrorEvent) {
                ErrorEvent ev = (ErrorEvent) ep;
                TypeSet evTS = ev.getTypeSet();
                if (evTS == null) {
                    TypeSet srcTS = ebt.getSource().getTypeSet();
                    if (srcTS == null) {
                        error(ebt, "Target state " + targetstate.getName() + " requires type but the triggering error event " + EMV2Util.getPrintName(ev) + " or source state " + EMV2Util.getPrintName(ebt.getSource()) + " does not have a type");
                    } else {
                        // source typeset must be contained in target type set
                        if (!EMV2TypeSetUtil.contains(targetTS, srcTS)) {
                            error(ebt, "Target state " + targetstate.getName() + " does not contain types of source state " + EMV2Util.getPrintName(ebt.getSource()));
                        }
                    }
                } else {
                    // error event has type. It must be consistent with the expected state type
                    if (!EMV2TypeSetUtil.contains(targetTS, evTS)) {
                        error(ebt, "Target state " + targetstate.getName() + " does not contain types of error event " + EMV2Util.getPrintName(ev));
                    }
                }
            } else if (ep instanceof ErrorPropagation) {
                ErrorPropagation eprop = (ErrorPropagation) ep;
                // we can check type compatibility
                if (!EMV2TypeSetUtil.contains(targetTS, eprop.getTypeSet())) {
                    error(ebt, "Target state " + targetstate.getName() + " does not contain types of error propagation " + EMV2Util.getPrintName(eprop));
                }
            }
        } else {
            // full condition expression
            // type transformation & events must be typed
            ErrorBehaviorStateMachine ebsm = (ErrorBehaviorStateMachine) targetstate.eContainer();
            if (ebsm.getUseTransformation().isEmpty()) {
                error(ebt, "Target state " + targetstate.getName() + " does not include a target type but requires types. For conditions on multiple elements a target type must be assigned explicitly or a type transformation must be specified in the error behavior state machine" + EMV2Util.getPrintName(ebsm));
            }
        }
    }
}
Also used : ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) SConditionElement(org.osate.xtext.aadl2.errormodel.errorModel.SConditionElement) ConditionElement(org.osate.xtext.aadl2.errormodel.errorModel.ConditionElement) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet) ErrorBehaviorStateMachine(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorStateMachine) ErrorEvent(org.osate.xtext.aadl2.errormodel.errorModel.ErrorEvent) EventOrPropagation(org.osate.xtext.aadl2.errormodel.errorModel.EventOrPropagation) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)

Aggregations

ErrorBehaviorState (org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState)35 TypeSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)20 ErrorPropagation (org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)14 TypeToken (org.osate.xtext.aadl2.errormodel.errorModel.TypeToken)14 ErrorEvent (org.osate.xtext.aadl2.errormodel.errorModel.ErrorEvent)12 EObject (org.eclipse.emf.ecore.EObject)9 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)9 ConditionElement (org.osate.xtext.aadl2.errormodel.errorModel.ConditionElement)7 ErrorBehaviorTransition (org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorTransition)7 NamedElement (org.osate.aadl2.NamedElement)6 QualifiedErrorBehaviorState (org.osate.xtext.aadl2.errormodel.errorModel.QualifiedErrorBehaviorState)6 LinkedList (java.util.LinkedList)5 EList (org.eclipse.emf.common.util.EList)5 ConditionExpression (org.osate.xtext.aadl2.errormodel.errorModel.ConditionExpression)5 EMV2PropertyAssociation (org.osate.xtext.aadl2.errormodel.errorModel.EMV2PropertyAssociation)5 ErrorSource (org.osate.xtext.aadl2.errormodel.errorModel.ErrorSource)4 ErrorType (org.osate.xtext.aadl2.errormodel.errorModel.ErrorType)4 EventOrPropagation (org.osate.xtext.aadl2.errormodel.errorModel.EventOrPropagation)4 SConditionElement (org.osate.xtext.aadl2.errormodel.errorModel.SConditionElement)4 BigDecimal (java.math.BigDecimal)3