Search in sources :

Example 1 with ErrorPath

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

the class EMV2Util method getAllErrorPaths.

/**
 * return list of error paths including those inherited from classifiers being extended
 * @param cl Classifier
 * @return Collection<ErrorSource> list of error paths declared in the flow section
 */
public static Collection<ErrorPath> getAllErrorPaths(Classifier cl) {
    HashMap<String, ErrorPath> result = new LinkedHashMap<>();
    EList<ErrorModelSubclause> emslist = getAllContainingClassifierEMV2Subclauses(cl);
    for (ErrorModelSubclause errorModelSubclause : emslist) {
        EList<ErrorFlow> eflist = errorModelSubclause.getFlows();
        for (ErrorFlow errorFlow : eflist) {
            if (errorFlow instanceof ErrorPath) {
                if (!result.containsKey(errorFlow.getName())) {
                    result.put(errorFlow.getName(), (ErrorPath) errorFlow);
                }
            }
        }
    }
    return result.values();
}
Also used : ErrorModelSubclause(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause) ErrorFlow(org.osate.xtext.aadl2.errormodel.errorModel.ErrorFlow) ErrorPath(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPath) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with ErrorPath

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

the class PropagateErrorSources method traceErrorFlows.

/**
 * traverse through the destination of the connection instance
 * @param conni
 */
protected void traceErrorFlows(ComponentInstance ci, ErrorPropagation ep, TypeToken tt, int depth, String entryText) {
    if (ci == null) {
        return;
    }
    /**
     * With alreadyTreated, we have a cache that keep track of existing report
     * text for each component. For each component, we maintain a list of existing
     * entryText already reported. So, we do not duplicate the error report for each component
     * and make sure to report each entry only once.
     */
    if (!alreadyTreated.containsKey(ci)) {
        alreadyTreated.put(ci, new ArrayList<String>());
    }
    if (alreadyTreated.get(ci).contains(entryText)) {
        return;
    }
    alreadyTreated.get(ci).add(entryText);
    boolean handled = false;
    Collection<ErrorFlow> outefs = EMV2Util.findErrorFlowFromComponentInstance(ci, ep);
    for (ErrorFlow ef : outefs) {
        if (ef instanceof ErrorSink && Util.conditionHolds(ef, ci)) {
            /**
             * We try to find additional error propagation for this error sink.
             * For example, if the error sink triggers to switch to
             * another behavior state and that states is used to propagate
             * an error through an error source. Then, we do not consider
             * it as an error sink but as an error path and continue
             * to trace the flow using this additional error propagation.
             */
            if (EMV2TypeSetUtil.contains(ef.getTypeTokenConstraint(), tt)) {
                String maskText = ", " + generateFailureModeText(ci, ep, tt) + " [Masked],";
                reportEntry(entryText + maskText, depth);
                handled = true;
            } else {
                Collection<TypeToken> intersection = EMV2TypeSetUtil.getConstrainedTypeTokens(ef.getTypeTokenConstraint(), tt);
                for (TypeToken typeToken : intersection) {
                    String maskText = ", " + generateFailureModeText(ci, ep, typeToken) + " [Masked],";
                    reportEntry(entryText + maskText, depth);
                    handled = true;
                }
            }
        } else if (ef instanceof ErrorPath) {
            // error path
            Collection<ErrorPropagation> eplist = EMV2Util.getOutgoingPropagationOrAll((ErrorPath) ef);
            ErrorPropagation inep = ((ErrorPath) ef).getIncoming();
            if (ef.getTypeTokenConstraint() != null ? EMV2TypeSetUtil.contains(ef.getTypeTokenConstraint(), tt) : (inep != null ? EMV2TypeSetUtil.contains(inep.getTypeSet(), tt) : ((ErrorPath) ef).isAllIncoming())) {
                TypeToken newtt = EMV2Util.mapToken(tt, ef);
                for (ErrorPropagation outp : eplist) {
                    traceErrorPaths(ci, outp, newtt, depth + 1, entryText + ", " + generateFailureModeText(ci, ep, tt));
                    handled = true;
                }
            } else {
                Collection<TypeToken> intersection = Collections.emptyList();
                TypeSet ts = null;
                if (ef.getTypeTokenConstraint() != null) {
                    ts = ef.getTypeTokenConstraint();
                } else if (inep != null) {
                    ts = inep.getTypeSet();
                }
                if (ts != null) {
                    intersection = EMV2TypeSetUtil.getConstrainedTypeTokens(ts, tt);
                }
                for (TypeToken typeToken : intersection) {
                    TypeToken newtt = EMV2Util.mapToken(typeToken, ef);
                    for (ErrorPropagation outp : eplist) {
                        traceErrorPaths(ci, outp, newtt, depth + 1, entryText + ",\"" + generateFailureModeText(ci, ep, typeToken) + " [Subtype]\"");
                        handled = true;
                    }
                }
            }
        }
    }
    if (!handled) {
        // no error flows:. and no flows condition
        // try flows or propagate to all outgoing error propagations
        EList<FlowSpecificationInstance> flowlist = ci.getFlowSpecifications();
        if (!flowlist.isEmpty()) {
            for (FlowSpecificationInstance flowSpecificationInstance : flowlist) {
                if (flowSpecificationInstance.getSource() != null && flowSpecificationInstance.getSource().getFeature() == EMV2Util.getErrorPropagationFeature(ep, ci)) {
                    FeatureInstance outfi = flowSpecificationInstance.getDestination();
                    if (outfi != null) {
                        ErrorPropagation outp = EMV2Util.getOutgoingErrorPropagation(outfi);
                        if (outp != null) {
                            TypeToken newtt = EMV2Util.mapToken(tt, flowSpecificationInstance);
                            if (EMV2TypeSetUtil.contains(outp.getTypeSet(), newtt)) {
                                traceErrorPaths(ci, outp, newtt, depth + 1, entryText + ", " + generateFailureModeText(ci, ep, tt) + " [FlowPath]");
                                handled = true;
                            } else {
                                Collection<TypeToken> intersection = EMV2TypeSetUtil.getConstrainedTypeTokens(outp.getTypeSet(), newtt);
                                for (TypeToken typeToken : intersection) {
                                    traceErrorPaths(ci, outp, typeToken, depth + 1, entryText + ", " + generateFailureModeText(ci, ep, tt) + " [FlowPath TypeSubset]");
                                    handled = true;
                                }
                            }
                        }
                    } else {
                        // do all since we have a flow sink
                        EList<FeatureInstance> filist = ci.getFeatureInstances();
                        boolean res = doAllOutPropagationsOrFeatures(ci, filist, ep, tt, depth, entryText);
                        if (res) {
                            handled = true;
                        }
                    }
                }
            }
        } else {
            // now all outgoing propagations or features since we did not find flows
            EList<FeatureInstance> filist = ci.getFeatureInstances();
            boolean res = doAllOutPropagationsOrFeatures(ci, filist, ep, tt, depth, entryText);
            if (res) {
                handled = true;
            }
        }
    }
    if (!handled) {
        String errorText = "," + generateFailureModeText(ci, ep, tt) + " [Unhandled Failure Effect]";
        reportEntry(entryText + errorText, depth);
    }
}
Also used : FeatureInstance(org.osate.aadl2.instance.FeatureInstance) ErrorFlow(org.osate.xtext.aadl2.errormodel.errorModel.ErrorFlow) FlowSpecificationInstance(org.osate.aadl2.instance.FlowSpecificationInstance) ErrorSink(org.osate.xtext.aadl2.errormodel.errorModel.ErrorSink) TypeToken(org.osate.xtext.aadl2.errormodel.errorModel.TypeToken) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet) ErrorPath(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPath) Collection(java.util.Collection) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)

Example 3 with ErrorPath

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

the class PropagationGraphBackwardTraversal method traverseOutgoingErrorPropagation.

/**
 * process an Outgoing Error Propagation by going backwards in the propagation graph
 * if preProcessOutgoingerrorPropagation returns non-null return its value as traverse result.
 * First we attempt to go backwards according to the component error behavior, i.e., the OutgoingPropagationCondition.
 * If subresults is non-null then return value of postProcessingErrorPropagationCOndition.
 * If not present we do it according to error flow specifications.
 *
 * @param component ComponentInstance
 * @param errorPropagation outgoing ErrorPropagation
 * @param type ErrorTypes
 * @return EObject (can be null)
 */
public EObject traverseOutgoingErrorPropagation(final ComponentInstance component, final ErrorPropagation errorPropagation, TypeToken proptype, BigDecimal scale) {
    List<EObject> subResults = new LinkedList<EObject>();
    Collection<TypeToken> filteredTypes = filterTokenThroughConstraint(errorPropagation.getTypeSet(), proptype);
    if (filteredTypes.isEmpty()) {
        return null;
    }
    HashMultimap<ErrorPropagation, String> handledEOPs = HashMultimap.create();
    boolean traverse = false;
    boolean hasCycle = false;
    for (TypeToken type : filteredTypes) {
        // we did follow an OPC.
        boolean didProp = false;
        EObject found = preProcessOutgoingErrorPropagation(component, errorPropagation, type, scale);
        if (found != null) {
            addSubresult(subResults, found);
            // found common event
            continue;
        }
        // we want to track cycles.
        // we do that by tagging the feature instance of the error propagation with the error type (as token)
        ErrorModelState st = null;
        FeatureInstance fi = EMV2Util.findFeatureInstance(errorPropagation, component);
        if (fi != null) {
            st = (ErrorModelState) ErrorModelStateAdapterFactory.INSTANCE.adapt(fi, ErrorModelState.class);
        } else {
            st = (ErrorModelState) ErrorModelStateAdapterFactory.INSTANCE.adapt(component, ErrorModelState.class);
        }
        if (st.visited(errorPropagation, type)) {
            // we were there before.
            hasCycle = true;
            continue;
        } else {
            st.setVisitToken(errorPropagation, type);
        }
        // processing call has to be after the preproccessing call so it is not found and we proceed in processing.
        // On the other hand it needs to be called here so the event exists in ftamodel and is found the next time around.
        // Originally we were creating the events bottom up thus the loop did not find the event.
        // EObject myEvent = processOutgoingErrorPropagation(component, errorPropagation, type, scale);
        Collection<ErrorFlow> errorFlows = EMV2Util.getAllErrorFlows(component);
        Collection<OutgoingPropagationCondition> opcs = EMV2Util.getAllOutgoingPropagationConditions(component);
        for (OutgoingPropagationCondition opc : opcs) {
            if ((opc.getTypeToken() != null && !isNoError(opc.getTypeToken())) || opc.getTypeToken() == null) {
                if (opc.isAllPropagations() || (EMV2Util.isSame(opc.getOutgoing(), errorPropagation))) {
                    // opc token if OPC token is subtype or same type
                    Collection<TypeToken> opcFilteredTypes = filterTokenThroughConstraint(opc.getTypeToken(), type);
                    for (TypeToken opctype : opcFilteredTypes) {
                        if (contains(opc.getTypeToken(), opctype)) {
                            EObject res = handleOutgoingErrorPropagationCondition(component, opc, opctype, handledEOPs, scale);
                            addSubresult(subResults, res);
                            didProp = true;
                        }
                    }
                }
            }
        }
        // try to find a path from an outer to an inner out error propagation
        EList<PropagationPathEnd> propagationSources = Util.getAllPropagationSourceEnds(currentAnalysisModel, component, errorPropagation);
        for (PropagationPathEnd ppe : propagationSources) {
            ComponentInstance componentSource = ppe.getComponentInstance();
            ErrorPropagation propagationSource = ppe.getErrorPropagation();
            if (propagationSource.getDirection() == DirectionType.OUT) {
                Set<ErrorPropagation> eops = handledEOPs.keySet();
                if (!containsEOP(eops, propagationSource)) {
                    // if not already handled by a opc
                    EObject res = traverseOutgoingErrorPropagation(componentSource, propagationSource, type, scale);
                    addSubresult(subResults, res);
                    didProp = true;
                }
            }
        }
        for (ErrorFlow ef : errorFlows) {
            if (ef instanceof ErrorPath) {
                ErrorPath ep = (ErrorPath) ef;
                if (handledEOPs.containsEntry(ep.getIncoming(), EMV2Util.getPrintName(type))) {
                    // already handled by a opc
                    continue;
                }
                if (Util.conditionHolds(ef, component)) {
                    /**
                     * Make sure that the error type we are looking for is contained
                     * in the error types for the out propagation.
                     * This is a fix for the JMR/SAVI WBS model.
                     */
                    if (ep.isAllOutgoing() || EMV2Util.isSame(ep.getOutgoing(), errorPropagation)) {
                        BigDecimal newscale = scale;
                        double pathprobability = EMV2Properties.getProbability(component, ep, type);
                        if (pathprobability > 0) {
                            newscale = scale.multiply(BigDecimal.valueOf((pathprobability)));
                        }
                        if (ep.getTargetToken() != null) {
                            Collection<TypeToken> mappedTypes = filterTokenThroughConstraint(ep.getTargetToken(), type);
                            for (TypeToken mappedtype : mappedTypes) {
                                // we have a type mapping
                                EList<TypeToken> result;
                                if (ep.getTypeTokenConstraint() != null) {
                                    // get type from path constraint
                                    result = mapTokenThroughConstraint(ep.getTypeTokenConstraint(), mappedtype);
                                } else {
                                    // get incoming type from propagation
                                    result = mapTokenThroughConstraint(ep.getIncoming().getTypeSet(), mappedtype);
                                }
                                for (TypeToken newToken : result) {
                                    if (ep.isAllIncoming()) {
                                        Collection<ErrorPropagation> inprops = EMV2Util.getAllIncomingErrorPropagations(component);
                                        for (ErrorPropagation eprop : inprops) {
                                            handledEOPs.put(eprop, EMV2Util.getPrintName(newToken));
                                            EObject newEvent = traverseIncomingErrorPropagation(component, eprop, newToken, newscale);
                                            addSubresult(subResults, newEvent);
                                            didProp = true;
                                        }
                                    } else {
                                        handledEOPs.put(ep.getIncoming(), EMV2Util.getPrintName(newToken));
                                        EObject newEvent = traverseIncomingErrorPropagation(component, ep.getIncoming(), newToken, newscale);
                                        addSubresult(subResults, newEvent);
                                        didProp = true;
                                    }
                                }
                            }
                        } else {
                            // no type mapping
                            if (ep.isAllIncoming()) {
                                Collection<ErrorPropagation> inprops = EMV2Util.getAllIncomingErrorPropagations(component);
                                for (ErrorPropagation eprop : inprops) {
                                    TypeSet matchtype = ep.getTypeTokenConstraint();
                                    if (matchtype == null) {
                                        matchtype = eprop.getTypeSet();
                                    }
                                    EList<TypeToken> filteredtypes = filterTokenThroughConstraint(matchtype, type);
                                    for (TypeToken subtype : filteredtypes) {
                                        handledEOPs.put(eprop, EMV2Util.getPrintName(subtype));
                                        EObject newEvent = traverseIncomingErrorPropagation(component, eprop, subtype, newscale);
                                        addSubresult(subResults, newEvent);
                                        didProp = true;
                                    }
                                }
                            } else {
                                ErrorPropagation inep = ep.getIncoming();
                                TypeSet matchtype = ep.getTypeTokenConstraint();
                                if (matchtype == null) {
                                    matchtype = inep.getTypeSet();
                                }
                                Collection<TypeToken> mappedtypes = filterTokenThroughConstraint(matchtype, type);
                                for (TypeToken subtype : mappedtypes) {
                                    handledEOPs.put(inep, EMV2Util.getPrintName(subtype));
                                    EObject newEvent = traverseIncomingErrorPropagation(component, inep, subtype, newscale);
                                    addSubresult(subResults, newEvent);
                                    didProp = true;
                                }
                            }
                        }
                    }
                }
            } else if (ef instanceof ErrorSource) {
                ErrorSource errorSource = (ErrorSource) ef;
                NamedElement src = errorSource.getSourceModelElement();
                if (src instanceof ErrorPropagation) {
                    // check if error source was already handled by opc
                    ErrorPropagation srcep = (ErrorPropagation) src;
                    if (targetsEOP(opcs, srcep, type)) {
                        // already handled by a opc with the same target
                        continue;
                    }
                }
                if (Util.conditionHolds(ef, component)) {
                    if (errorSource.isAll() || EMV2Util.isSame(errorSource.getSourceModelElement(), errorPropagation)) {
                        Collection<TypeToken> mappedTypes = filterTokenThroughConstraint(errorSource.getTypeTokenConstraint(), type);
                        for (TypeToken mappedType : mappedTypes) {
                            if (src instanceof ErrorPropagation) {
                                handledEOPs.put((ErrorPropagation) src, EMV2Util.getPrintName(mappedType));
                            }
                            if (errorSource.getFailureModeReference() != null) {
                                List<EObject> stResults = new LinkedList<EObject>();
                                ErrorBehaviorState ebs = errorSource.getFailureModeReference();
                                EObject sEvent = traverseErrorBehaviorState(component, ebs, mappedType, scale);
                                addSubresult(stResults, sEvent);
                                EObject newEvent = postProcessErrorSource(component, errorSource, proptype, stResults, scale);
                                addSubresult(subResults, newEvent);
                                didProp = true;
                            } else {
                                EObject newEvent = processErrorSource(component, errorSource, mappedType, scale);
                                addSubresult(subResults, newEvent);
                                didProp = true;
                            }
                        }
                    }
                }
            }
        }
        st.removeVisitedToken(errorPropagation, type);
        if (didProp) {
            traverse = true;
        }
    }
    if (!subResults.isEmpty()) {
        // out propagation with sub elements
        return postProcessOutgoingErrorPropagation(component, errorPropagation, proptype, subResults, scale);
    }
    if (hasCycle) {
        return null;
    }
    if (traverse && !handledEOPs.isEmpty()) {
        // we handled error out propagations
        return null;
    }
    // out propagation as end point
    return processOutgoingErrorPropagation(component, errorPropagation, proptype, scale);
}
Also used : FeatureInstance(org.osate.aadl2.instance.FeatureInstance) ErrorModelState(org.osate.xtext.aadl2.errormodel.util.ErrorModelState) ErrorSource(org.osate.xtext.aadl2.errormodel.errorModel.ErrorSource) EObject(org.eclipse.emf.ecore.EObject) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation) List(java.util.List) LinkedList(java.util.LinkedList) EList(org.eclipse.emf.common.util.EList) ErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorState) QualifiedErrorBehaviorState(org.osate.xtext.aadl2.errormodel.errorModel.QualifiedErrorBehaviorState) ErrorFlow(org.osate.xtext.aadl2.errormodel.errorModel.ErrorFlow) PropagationPathEnd(org.osate.aadl2.errormodel.PropagationGraph.PropagationPathEnd) LinkedList(java.util.LinkedList) BigDecimal(java.math.BigDecimal) TypeToken(org.osate.xtext.aadl2.errormodel.errorModel.TypeToken) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet) ErrorPath(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPath) Collection(java.util.Collection) OutgoingPropagationCondition(org.osate.xtext.aadl2.errormodel.errorModel.OutgoingPropagationCondition) NamedElement(org.osate.aadl2.NamedElement)

Example 4 with ErrorPath

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

the class CreateErrorPathPaletteCommand method getOperation.

@Override
public Optional<Operation> getOperation(final GetCreateConnectionOperationContext ctx) {
    // Check if the destination is a potential end
    if (!ErrorFlowPaletteCommandUtil.isPotentialEnd(ctx.getDestination())) {
        return Optional.empty();
    }
    // Find the common ancestor which is a source for the classifier to update
    final BusinessObjectContext classifierSourceBoc = BusinessObjectContext.getFirstCommonAncestor(ctx.getSource().getParent(), ctx.getDestination().getParent()).flatMap(ancestor -> ErrorModelGeUtil.getClassifierSourceBoc(ancestor)).orElse(null);
    if (classifierSourceBoc == null) {
        return Optional.empty();
    }
    return ErrorModelGeUtil.createErrorModelSubclausePromptAndModifyOperation(classifierSourceBoc, () -> {
        final CombinedErrorModelSubclause combined = CombinedErrorModelSubclause.create(ErrorModelGeUtil.getClassifier(classifierSourceBoc).get());
        // Validate both the source and the destination
        return (ErrorFlowPaletteCommandUtil.validateAndShowError(combined, ctx.getSource(), DirectionType.IN) && ErrorFlowPaletteCommandUtil.validateAndShowError(combined, ctx.getDestination(), DirectionType.OUT)) ? Optional.of(true) : Optional.empty();
    }, (subclause, unused) -> {
        final ErrorPath newFlow = ErrorModelFactory.eINSTANCE.createErrorPath();
        // Set name
        final String newName = ErrorModelNamingUtil.buildUniqueIdentifier(subclause.getContainingClassifier(), "new_error_flow");
        newFlow.setName(newName);
        // Set the incoming and outgoing fields of the flow
        final CombinedErrorModelSubclause combined = CombinedErrorModelSubclause.create(subclause.getContainingClassifier());
        final boolean allSrc = ErrorFlowPaletteCommandUtil.isAll(ctx.getSource());
        if (allSrc) {
            newFlow.setAllIncoming(allSrc);
        } else {
            newFlow.setIncoming(ErrorFlowPaletteCommandUtil.findErrorPropagationOrThrow(combined, ctx.getSource(), DirectionType.IN));
        }
        final boolean allDst = ErrorFlowPaletteCommandUtil.isAll(ctx.getDestination());
        if (allDst) {
            newFlow.setAllOutgoing(allDst);
        } else {
            newFlow.setOutgoing(ErrorFlowPaletteCommandUtil.findErrorPropagationOrThrow(combined, ctx.getDestination(), DirectionType.OUT));
        }
        // Add the flow to the subclause
        subclause.getFlows().add(newFlow);
        return StepResultBuilder.create().showNewBusinessObject(classifierSourceBoc, newFlow).build();
    });
}
Also used : Operation(org.osate.ge.operations.Operation) ErrorPath(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPath) CombinedErrorModelSubclause(org.osate.ge.errormodel.combined.CombinedErrorModelSubclause) GetCreateConnectionOperationContext(org.osate.ge.palette.GetCreateConnectionOperationContext) ErrorModelNamingUtil(org.osate.ge.errormodel.util.ErrorModelNamingUtil) ErrorModelFactory(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelFactory) StepResultBuilder(org.osate.ge.operations.StepResultBuilder) BusinessObjectContext(org.osate.ge.BusinessObjectContext) BasePaletteCommand(org.osate.ge.palette.BasePaletteCommand) CanStartConnectionContext(org.osate.ge.palette.CanStartConnectionContext) CreateConnectionPaletteCommand(org.osate.ge.palette.CreateConnectionPaletteCommand) ErrorModelGeUtil(org.osate.ge.errormodel.util.ErrorModelGeUtil) Optional(java.util.Optional) DirectionType(org.osate.aadl2.DirectionType) ErrorPath(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPath) CombinedErrorModelSubclause(org.osate.ge.errormodel.combined.CombinedErrorModelSubclause) BusinessObjectContext(org.osate.ge.BusinessObjectContext)

Example 5 with ErrorPath

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

the class AbstractErrorModelSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == Aadl2Package.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Aadl2Package.ARRAY_RANGE:
                sequence_ArrayRange(context, (ArrayRange) semanticObject);
                return;
            case Aadl2Package.BASIC_PROPERTY_ASSOCIATION:
                sequence_FieldPropertyAssociation(context, (BasicPropertyAssociation) semanticObject);
                return;
            case Aadl2Package.BOOLEAN_LITERAL:
                sequence_BooleanLiteral(context, (BooleanLiteral) semanticObject);
                return;
            case Aadl2Package.CLASSIFIER_VALUE:
                sequence_ComponentClassifierTerm(context, (ClassifierValue) semanticObject);
                return;
            case Aadl2Package.COMPUTED_VALUE:
                sequence_ComputedTerm(context, (ComputedValue) semanticObject);
                return;
            case Aadl2Package.CONTAINED_NAMED_ELEMENT:
                sequence_ContainmentPath(context, (ContainedNamedElement) semanticObject);
                return;
            case Aadl2Package.CONTAINMENT_PATH_ELEMENT:
                sequence_ContainmentPathElement(context, (ContainmentPathElement) semanticObject);
                return;
            case Aadl2Package.INTEGER_LITERAL:
                sequence_IntegerTerm(context, (IntegerLiteral) semanticObject);
                return;
            case Aadl2Package.LIST_VALUE:
                sequence_ListTerm(context, (ListValue) semanticObject);
                return;
            case Aadl2Package.MODAL_PROPERTY_VALUE:
                if (rule == grammarAccess.getModalPropertyValueRule()) {
                    sequence_ModalPropertyValue(context, (ModalPropertyValue) semanticObject);
                    return;
                } else if (rule == grammarAccess.getOptionalModalPropertyValueRule()) {
                    sequence_OptionalModalPropertyValue(context, (ModalPropertyValue) semanticObject);
                    return;
                } else if (rule == grammarAccess.getPropertyValueRule()) {
                    sequence_PropertyValue(context, (ModalPropertyValue) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.NAMED_VALUE:
                if (rule == grammarAccess.getConstantValueRule() || rule == grammarAccess.getNumAltRule()) {
                    sequence_ConstantValue(context, (NamedValue) semanticObject);
                    return;
                } else if (rule == grammarAccess.getPropertyExpressionRule() || rule == grammarAccess.getLiteralorReferenceTermRule()) {
                    sequence_LiteralorReferenceTerm(context, (NamedValue) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.OPERATION:
                sequence_SignedConstant(context, (Operation) semanticObject);
                return;
            case Aadl2Package.PROPERTY_ASSOCIATION:
                if (rule == grammarAccess.getBasicPropertyAssociationRule()) {
                    sequence_BasicPropertyAssociation(context, (PropertyAssociation) semanticObject);
                    return;
                } else if (rule == grammarAccess.getPModelRule() || rule == grammarAccess.getContainedPropertyAssociationRule()) {
                    sequence_ContainedPropertyAssociation(context, (PropertyAssociation) semanticObject);
                    return;
                } else if (rule == grammarAccess.getPropertyAssociationRule()) {
                    sequence_PropertyAssociation(context, (PropertyAssociation) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.RANGE_VALUE:
                sequence_NumericRangeTerm(context, (RangeValue) semanticObject);
                return;
            case Aadl2Package.REAL_LITERAL:
                sequence_RealTerm(context, (RealLiteral) semanticObject);
                return;
            case Aadl2Package.RECORD_VALUE:
                if (rule == grammarAccess.getOldRecordTermRule()) {
                    sequence_OldRecordTerm(context, (RecordValue) semanticObject);
                    return;
                } else if (rule == grammarAccess.getPropertyExpressionRule() || rule == grammarAccess.getRecordTermRule()) {
                    sequence_RecordTerm(context, (RecordValue) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.REFERENCE_VALUE:
                sequence_ReferenceTerm(context, (ReferenceValue) semanticObject);
                return;
            case Aadl2Package.STRING_LITERAL:
                sequence_StringTerm(context, (StringLiteral) semanticObject);
                return;
        }
    else if (epackage == ErrorModelPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case ErrorModelPackage.ALL_EXPRESSION:
                if (rule == grammarAccess.getElementRule() || rule == grammarAccess.getConditionExpressionRule() || action == grammarAccess.getConditionExpressionAccess().getOrExpressionOperandsAction_1_0() || rule == grammarAccess.getAndExpressionRule() || action == grammarAccess.getAndExpressionAccess().getAndExpressionOperandsAction_1_0() || rule == grammarAccess.getAllExpressionRule() || rule == grammarAccess.getConditionTermRule()) {
                    sequence_AllExpression(context, (AllExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getSConditionExpressionRule() || action == grammarAccess.getSConditionExpressionAccess().getOrExpressionOperandsAction_1_0() || rule == grammarAccess.getSAndExpressionRule() || action == grammarAccess.getSAndExpressionAccess().getAndExpressionOperandsAction_1_0() || rule == grammarAccess.getSAllExpressionRule() || rule == grammarAccess.getSConditionTermRule()) {
                    sequence_SAllExpression(context, (AllExpression) semanticObject);
                    return;
                } else
                    break;
            case ErrorModelPackage.AND_EXPRESSION:
                if (rule == grammarAccess.getElementRule() || rule == grammarAccess.getConditionExpressionRule() || action == grammarAccess.getConditionExpressionAccess().getOrExpressionOperandsAction_1_0() || rule == grammarAccess.getAndExpressionRule() || action == grammarAccess.getAndExpressionAccess().getAndExpressionOperandsAction_1_0() || rule == grammarAccess.getConditionTermRule()) {
                    sequence_AndExpression(context, (AndExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getSConditionExpressionRule() || action == grammarAccess.getSConditionExpressionAccess().getOrExpressionOperandsAction_1_0() || rule == grammarAccess.getSAndExpressionRule() || action == grammarAccess.getSAndExpressionAccess().getAndExpressionOperandsAction_1_0() || rule == grammarAccess.getSConditionTermRule()) {
                    sequence_SAndExpression(context, (AndExpression) semanticObject);
                    return;
                } else
                    break;
            case ErrorModelPackage.BRANCH_VALUE:
                sequence_BranchValue(context, (BranchValue) semanticObject);
                return;
            case ErrorModelPackage.COMPOSITE_STATE:
                sequence_CompositeState(context, (CompositeState) semanticObject);
                return;
            case ErrorModelPackage.CONDITION_ELEMENT:
                sequence_ConditionElement(context, (ConditionElement) semanticObject);
                return;
            case ErrorModelPackage.EMV2_PATH:
                if (rule == grammarAccess.getBasicEMV2PathRule()) {
                    sequence_BasicEMV2Path(context, (EMV2Path) semanticObject);
                    return;
                } else if (rule == grammarAccess.getElementRule() || rule == grammarAccess.getEMV2PathRule()) {
                    sequence_EMV2Path(context, (EMV2Path) semanticObject);
                    return;
                } else
                    break;
            case ErrorModelPackage.EMV2_PATH_ELEMENT:
                if (rule == grammarAccess.getEMV2ErrorPropagationPathRule()) {
                    sequence_EMV2ErrorPropagationPath(context, (EMV2PathElement) semanticObject);
                    return;
                } else if (rule == grammarAccess.getEMV2PathElementOrKindRule()) {
                    sequence_EMV2PathElementOrKind(context, (EMV2PathElement) semanticObject);
                    return;
                } else if (rule == grammarAccess.getElementRule() || rule == grammarAccess.getEMV2PathElementRule()) {
                    sequence_EMV2PathElement(context, (EMV2PathElement) semanticObject);
                    return;
                } else
                    break;
            case ErrorModelPackage.EMV2_PROPERTY_ASSOCIATION:
                if (rule == grammarAccess.getBasicEMV2PropertyAssociationRule()) {
                    sequence_BasicEMV2PropertyAssociation(context, (EMV2PropertyAssociation) semanticObject);
                    return;
                } else if (rule == grammarAccess.getElementRule() || rule == grammarAccess.getEMV2PropertyAssociationRule()) {
                    sequence_EMV2PropertyAssociation(context, (EMV2PropertyAssociation) semanticObject);
                    return;
                } else
                    break;
            case ErrorModelPackage.EMV2_ROOT:
                sequence_EMV2Root(context, (EMV2Root) semanticObject);
                return;
            case ErrorModelPackage.ERROR_BEHAVIOR_STATE:
                sequence_ErrorBehaviorState(context, (ErrorBehaviorState) semanticObject);
                return;
            case ErrorModelPackage.ERROR_BEHAVIOR_STATE_MACHINE:
                sequence_ErrorBehaviorStateMachine(context, (ErrorBehaviorStateMachine) semanticObject);
                return;
            case ErrorModelPackage.ERROR_BEHAVIOR_TRANSITION:
                sequence_ErrorBehaviorTransition(context, (ErrorBehaviorTransition) semanticObject);
                return;
            case ErrorModelPackage.ERROR_CODE_VALUE:
                sequence_ErrorCodeValue(context, (ErrorCodeValue) semanticObject);
                return;
            case ErrorModelPackage.ERROR_DETECTION:
                sequence_ErrorDetection(context, (ErrorDetection) semanticObject);
                return;
            case ErrorModelPackage.ERROR_EVENT:
                sequence_ErrorEvent(context, (ErrorEvent) semanticObject);
                return;
            case ErrorModelPackage.ERROR_MODEL_LIBRARY:
                if (rule == grammarAccess.getEMV2LibraryRule()) {
                    sequence_EMV2Library(context, (ErrorModelLibrary) semanticObject);
                    return;
                } else if (rule == grammarAccess.getAnnexLibraryRule() || rule == grammarAccess.getNamedElementRule() || rule == grammarAccess.getErrorModelLibraryRule()) {
                    sequence_ErrorModelLibrary(context, (ErrorModelLibrary) semanticObject);
                    return;
                } else
                    break;
            case ErrorModelPackage.ERROR_MODEL_SUBCLAUSE:
                if (rule == grammarAccess.getEMV2SubclauseRule()) {
                    sequence_EMV2Subclause(context, (ErrorModelSubclause) semanticObject);
                    return;
                } else if (rule == grammarAccess.getAnnexSubclauseRule() || rule == grammarAccess.getModalElementRule() || rule == grammarAccess.getErrorModelSubclauseRule()) {
                    sequence_ErrorModelSubclause(context, (ErrorModelSubclause) semanticObject);
                    return;
                } else
                    break;
            case ErrorModelPackage.ERROR_PATH:
                sequence_ErrorPath(context, (ErrorPath) semanticObject);
                return;
            case ErrorModelPackage.ERROR_PROPAGATION:
                sequence_ErrorPropagation(context, (ErrorPropagation) semanticObject);
                return;
            case ErrorModelPackage.ERROR_SINK:
                sequence_ErrorSink(context, (ErrorSink) semanticObject);
                return;
            case ErrorModelPackage.ERROR_SOURCE:
                sequence_ErrorSource(context, (ErrorSource) semanticObject);
                return;
            case ErrorModelPackage.ERROR_STATE_TO_MODE_MAPPING:
                sequence_ErrorStateToModeMapping(context, (ErrorStateToModeMapping) semanticObject);
                return;
            case ErrorModelPackage.ERROR_TYPE:
                sequence_TypeDefinition(context, (ErrorType) semanticObject);
                return;
            case ErrorModelPackage.FEATUREOR_PP_REFERENCE:
                sequence_FeatureorPPReference(context, (FeatureorPPReference) semanticObject);
                return;
            case ErrorModelPackage.IF_CONDITION:
                sequence_IfCondition(context, (IfCondition) semanticObject);
                return;
            case ErrorModelPackage.OR_EXPRESSION:
                if (rule == grammarAccess.getElementRule() || rule == grammarAccess.getConditionExpressionRule() || action == grammarAccess.getConditionExpressionAccess().getOrExpressionOperandsAction_1_0() || rule == grammarAccess.getAndExpressionRule() || action == grammarAccess.getAndExpressionAccess().getAndExpressionOperandsAction_1_0() || rule == grammarAccess.getConditionTermRule()) {
                    sequence_ConditionExpression(context, (OrExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getSConditionExpressionRule() || action == grammarAccess.getSConditionExpressionAccess().getOrExpressionOperandsAction_1_0() || rule == grammarAccess.getSAndExpressionRule() || action == grammarAccess.getSAndExpressionAccess().getAndExpressionOperandsAction_1_0() || rule == grammarAccess.getSConditionTermRule()) {
                    sequence_SConditionExpression(context, (OrExpression) semanticObject);
                    return;
                } else
                    break;
            case ErrorModelPackage.ORLESS_EXPRESSION:
                if (rule == grammarAccess.getElementRule() || rule == grammarAccess.getConditionExpressionRule() || action == grammarAccess.getConditionExpressionAccess().getOrExpressionOperandsAction_1_0() || rule == grammarAccess.getAndExpressionRule() || action == grammarAccess.getAndExpressionAccess().getAndExpressionOperandsAction_1_0() || rule == grammarAccess.getOrlessExpressionRule() || rule == grammarAccess.getConditionTermRule()) {
                    sequence_OrlessExpression(context, (OrlessExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getSConditionExpressionRule() || action == grammarAccess.getSConditionExpressionAccess().getOrExpressionOperandsAction_1_0() || rule == grammarAccess.getSAndExpressionRule() || action == grammarAccess.getSAndExpressionAccess().getAndExpressionOperandsAction_1_0() || rule == grammarAccess.getSOrlessExpressionRule() || rule == grammarAccess.getSConditionTermRule()) {
                    sequence_SOrlessExpression(context, (OrlessExpression) semanticObject);
                    return;
                } else
                    break;
            case ErrorModelPackage.ORMORE_EXPRESSION:
                if (rule == grammarAccess.getElementRule() || rule == grammarAccess.getConditionExpressionRule() || action == grammarAccess.getConditionExpressionAccess().getOrExpressionOperandsAction_1_0() || rule == grammarAccess.getAndExpressionRule() || action == grammarAccess.getAndExpressionAccess().getAndExpressionOperandsAction_1_0() || rule == grammarAccess.getOrmoreExpressionRule() || rule == grammarAccess.getConditionTermRule()) {
                    sequence_OrmoreExpression(context, (OrmoreExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getSConditionExpressionRule() || action == grammarAccess.getSConditionExpressionAccess().getOrExpressionOperandsAction_1_0() || rule == grammarAccess.getSAndExpressionRule() || action == grammarAccess.getSAndExpressionAccess().getAndExpressionOperandsAction_1_0() || rule == grammarAccess.getSOrmoreExpressionRule() || rule == grammarAccess.getSConditionTermRule()) {
                    sequence_SOrmoreExpression(context, (OrmoreExpression) semanticObject);
                    return;
                } else
                    break;
            case ErrorModelPackage.OUTGOING_PROPAGATION_CONDITION:
                sequence_OutgoingPropagationCondition(context, (OutgoingPropagationCondition) semanticObject);
                return;
            case ErrorModelPackage.PROPAGATION_PATH:
                sequence_PropagationPath(context, (PropagationPath) semanticObject);
                return;
            case ErrorModelPackage.PROPAGATION_POINT:
                sequence_PropagationPoint(context, (PropagationPoint) semanticObject);
                return;
            case ErrorModelPackage.QUALIFIED_ERROR_BEHAVIOR_STATE:
                sequence_QualifiedErrorBehaviorState(context, (QualifiedErrorBehaviorState) semanticObject);
                return;
            case ErrorModelPackage.QUALIFIED_ERROR_EVENT_OR_PROPAGATION:
                sequence_QualifiedErrorEventOrPropagation(context, (QualifiedErrorEventOrPropagation) semanticObject);
                return;
            case ErrorModelPackage.QUALIFIED_ERROR_PROPAGATION:
                sequence_QualifiedErrorPropagation(context, (QualifiedErrorPropagation) semanticObject);
                return;
            case ErrorModelPackage.QUALIFIED_PROPAGATION_POINT:
                sequence_QualifiedPropagationPoint(context, (QualifiedPropagationPoint) semanticObject);
                return;
            case ErrorModelPackage.RECOVER_EVENT:
                sequence_RecoverEvent(context, (RecoverEvent) semanticObject);
                return;
            case ErrorModelPackage.REPAIR_EVENT:
                sequence_RepairEvent(context, (RepairEvent) semanticObject);
                return;
            case ErrorModelPackage.REPORTING_PORT_REFERENCE:
                sequence_ReportingPortReference(context, (ReportingPortReference) semanticObject);
                return;
            case ErrorModelPackage.SCONDITION_ELEMENT:
                sequence_SConditionElement(context, (SConditionElement) semanticObject);
                return;
            case ErrorModelPackage.SUBCOMPONENT_ELEMENT:
                sequence_SubcomponentElement(context, (SubcomponentElement) semanticObject);
                return;
            case ErrorModelPackage.TRANSITION_BRANCH:
                sequence_TransitionBranch(context, (TransitionBranch) semanticObject);
                return;
            case ErrorModelPackage.TYPE_MAPPING:
                sequence_TypeMapping(context, (TypeMapping) semanticObject);
                return;
            case ErrorModelPackage.TYPE_MAPPING_SET:
                sequence_TypeMappingSet(context, (TypeMappingSet) semanticObject);
                return;
            case ErrorModelPackage.TYPE_SET:
                if (rule == grammarAccess.getNoErrorTypeSetRule()) {
                    sequence_NoErrorTypeSet(context, (TypeSet) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeTokenOrNoErrorRule() || rule == grammarAccess.getTypeTokenConstraintNoErrorRule()) {
                    sequence_NoErrorTypeSet_TypeSetConstructor(context, (TypeSet) semanticObject);
                    return;
                } else if (rule == grammarAccess.getTypeSetConstructorRule() || rule == grammarAccess.getTypeSetReferenceRule() || rule == grammarAccess.getTypeTokenRule() || rule == grammarAccess.getTypeTokenConstraintRule()) {
                    sequence_TypeSetConstructor(context, (TypeSet) semanticObject);
                    return;
                } else if (rule == grammarAccess.getNamedElementRule() || rule == grammarAccess.getErrorTypesRule() || rule == grammarAccess.getTypeSetDefinitionRule()) {
                    sequence_TypeSetDefinition(context, (TypeSet) semanticObject);
                    return;
                } else
                    break;
            case ErrorModelPackage.TYPE_TOKEN:
                if (rule == grammarAccess.getNoErrorTypeTokenRule()) {
                    sequence_NoErrorTypeToken(context, (TypeToken) semanticObject);
                    return;
                } else if (rule == grammarAccess.getElementRule() || rule == grammarAccess.getTypeSetElementRule()) {
                    sequence_TypeSetElement(context, (TypeToken) semanticObject);
                    return;
                } else
                    break;
            case ErrorModelPackage.TYPE_TRANSFORMATION:
                sequence_TypeTransformation(context, (TypeTransformation) semanticObject);
                return;
            case ErrorModelPackage.TYPE_TRANSFORMATION_SET:
                sequence_TypeTransformationSet(context, (TypeTransformationSet) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : EMV2PathElement(org.osate.xtext.aadl2.errormodel.errorModel.EMV2PathElement) ParserRule(org.eclipse.xtext.ParserRule) ComputedValue(org.osate.aadl2.ComputedValue) Action(org.eclipse.xtext.Action) ClassifierValue(org.osate.aadl2.ClassifierValue) ModalPropertyValue(org.osate.aadl2.ModalPropertyValue) ErrorModelLibrary(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelLibrary) BooleanLiteral(org.osate.aadl2.BooleanLiteral) EMV2PropertyAssociation(org.osate.xtext.aadl2.errormodel.errorModel.EMV2PropertyAssociation) PropertyAssociation(org.osate.aadl2.PropertyAssociation) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) ReferenceValue(org.osate.aadl2.ReferenceValue) AllExpression(org.osate.xtext.aadl2.errormodel.errorModel.AllExpression) OrlessExpression(org.osate.xtext.aadl2.errormodel.errorModel.OrlessExpression) ArrayRange(org.osate.aadl2.ArrayRange) NamedValue(org.osate.aadl2.NamedValue) Operation(org.osate.aadl2.Operation) OrmoreExpression(org.osate.xtext.aadl2.errormodel.errorModel.OrmoreExpression) OrExpression(org.osate.xtext.aadl2.errormodel.errorModel.OrExpression) RangeValue(org.osate.aadl2.RangeValue) EPackage(org.eclipse.emf.ecore.EPackage) RealLiteral(org.osate.aadl2.RealLiteral) EMV2Path(org.osate.xtext.aadl2.errormodel.errorModel.EMV2Path) AndExpression(org.osate.xtext.aadl2.errormodel.errorModel.AndExpression) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) IntegerLiteral(org.osate.aadl2.IntegerLiteral) ErrorModelSubclause(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause) ListValue(org.osate.aadl2.ListValue) ContainmentPathElement(org.osate.aadl2.ContainmentPathElement) RecordValue(org.osate.aadl2.RecordValue) EMV2PropertyAssociation(org.osate.xtext.aadl2.errormodel.errorModel.EMV2PropertyAssociation) StringLiteral(org.osate.aadl2.StringLiteral) TypeToken(org.osate.xtext.aadl2.errormodel.errorModel.TypeToken) TypeSet(org.osate.xtext.aadl2.errormodel.errorModel.TypeSet) Parameter(org.eclipse.xtext.Parameter) ContainedNamedElement(org.osate.aadl2.ContainedNamedElement)

Aggregations

ErrorPath (org.osate.xtext.aadl2.errormodel.errorModel.ErrorPath)11 ErrorPropagation (org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)10 ErrorFlow (org.osate.xtext.aadl2.errormodel.errorModel.ErrorFlow)8 ErrorSink (org.osate.xtext.aadl2.errormodel.errorModel.ErrorSink)6 ErrorSource (org.osate.xtext.aadl2.errormodel.errorModel.ErrorSource)5 TypeSet (org.osate.xtext.aadl2.errormodel.errorModel.TypeSet)5 TypeToken (org.osate.xtext.aadl2.errormodel.errorModel.TypeToken)5 Collection (java.util.Collection)3 BasicEList (org.eclipse.emf.common.util.BasicEList)3 Classifier (org.osate.aadl2.Classifier)3 Optional (java.util.Optional)2 EObject (org.eclipse.emf.ecore.EObject)2 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)2 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)2 DirectionType (org.osate.aadl2.DirectionType)2 NamedElement (org.osate.aadl2.NamedElement)2 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)2 Graphic (org.osate.ge.graphics.Graphic)2 StyleBuilder (org.osate.ge.graphics.StyleBuilder)2 EMV2PathElement (org.osate.xtext.aadl2.errormodel.errorModel.EMV2PathElement)2