Search in sources :

Example 31 with ErrorBehaviorState

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

the class CreateFTAModel method createModel.

public static FaultTree createModel(ComponentInstance selection, final String startingPoint, FaultTreeType faultTreeType) {
    NamedElement errorStateOrPropagation = null;
    TypeToken errorType = null;
    if (startingPoint.startsWith(prefixState)) {
        String toProcess = startingPoint.replace(prefixState, "");
        for (ErrorBehaviorState ebs : EMV2Util.getAllErrorBehaviorStates(selection)) {
            if (ebs.getName().equalsIgnoreCase(toProcess)) {
                errorStateOrPropagation = ebs;
            }
        }
    }
    if (startingPoint.startsWith(prefixOutgoingPropagation)) {
        String toProcess = startingPoint.replace(prefixOutgoingPropagation, "");
        for (ErrorPropagation opc : EMV2Util.getAllOutgoingErrorPropagations(selection.getComponentClassifier())) {
            EList<TypeToken> result = EMV2TypeSetUtil.flattenTypesetElements(opc.getTypeSet());
            for (TypeToken tt : result) {
                String longName = EMV2Util.getPrintName(opc) + EMV2Util.getPrintName(tt);
                if (longName.equalsIgnoreCase(toProcess) && !tt.getType().isEmpty()) {
                    errorStateOrPropagation = opc;
                    errorType = tt;
                }
            }
        }
    }
    if (errorStateOrPropagation == null) {
        return null;
    }
    PropagationGraph currentPropagationGraph = Util.generatePropagationGraph(selection.getSystemInstance(), false);
    FTAGenerator generator = new FTAGenerator(currentPropagationGraph);
    FaultTree ftamodel = generator.getftaModel(selection, errorStateOrPropagation, errorType, faultTreeType);
    String rootname = ftamodel.getName() + (faultTreeType.equals(FaultTreeType.MINIMAL_CUT_SET) ? "_cutset" : (faultTreeType.equals(FaultTreeType.FAULT_TRACE) ? "_trace" : (faultTreeType.equals(FaultTreeType.COMPOSITE_PARTS) ? "_parts" : "_tree")));
    ftamodel.setName(rootname);
    return ftamodel;
}
Also used : ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) PropagationGraph(org.osate.aadl2.errormodel.PropagationGraph.PropagationGraph) TypeToken(org.osate.xtext.aadl2.errormodel.errorModel.TypeToken) FaultTree(org.osate.aadl2.errormodel.FaultTree.FaultTree) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation) NamedElement(org.osate.aadl2.NamedElement)

Example 32 with ErrorBehaviorState

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

the class ErrorDetectionImpl 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.ERROR_DETECTION__STATE, oldState, state));
}
Also used : ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 33 with ErrorBehaviorState

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

the class ErrorStateToModeMappingImpl method setErrorState.

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

Example 34 with ErrorBehaviorState

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

the class QualifiedErrorBehaviorStateImpl 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.QUALIFIED_ERROR_BEHAVIOR_STATE__STATE, oldState, state));
}
Also used : QualifiedErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.QualifiedErrorBehaviorState) ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 35 with ErrorBehaviorState

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

the class TransitionBranchImpl 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.TRANSITION_BRANCH__TARGET, oldTarget, target));
}
Also used : ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

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