Search in sources :

Example 16 with ErrorModelSubclause

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

the class EMV2Util method getAllErrorDetections.

/**
 * return list of OutgoingPropagationCondition including those inherited from classifiers being extended
 * @param cl Classifier
 * @param unnamed Collection of unnamed OutgoingPropagationCondition
 * @return Collection<ErrorBehaviorTransition> list of OutgoingPropagationCondition as HashMap for quick lookup of names
 */
public static HashMap<String, ErrorDetection> getAllErrorDetections(Classifier cl, Collection<ErrorDetection> unnamed) {
    HashMap<String, ErrorDetection> result = new LinkedHashMap<>();
    EList<ErrorModelSubclause> emslist = getAllContainingClassifierEMV2Subclauses(cl);
    for (ErrorModelSubclause errorModelSubclause : emslist) {
        EList<ErrorDetection> eflist = errorModelSubclause.getErrorDetections();
        for (ErrorDetection ebt : eflist) {
            if (ebt.getName() == null) {
                unnamed.add(ebt);
            } else {
                if (!result.containsKey(ebt.getName())) {
                    result.put(ebt.getName(), ebt);
                }
            }
        }
    }
    return result;
}
Also used : ErrorModelSubclause(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause) ErrorDetection(org.osate.xtext.aadl2.errormodel.errorModel.ErrorDetection) LinkedHashMap(java.util.LinkedHashMap)

Example 17 with ErrorModelSubclause

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

the class EMV2Util method getAllErrorFlows.

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

Example 18 with ErrorModelSubclause

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

the class EMV2Util method getAllErrorSources.

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

Example 19 with ErrorModelSubclause

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

the class EMV2Util method getAllOutgoingPropagationConditions.

/**
 * return list of OutgoingPropagationCondition including those inherited from classifiers being extended
 * @param cl Classifier
 * @param unnamed Collection of unnamed OutgoingPropagationCondition
 * @return Collection<ErrorBehaviorTransition> list of OutgoingPropagationCondition as HashMap for quick lookup of names
 */
private static HashMap<String, OutgoingPropagationCondition> getAllOutgoingPropagationConditions(Classifier cl, Collection<OutgoingPropagationCondition> unnamed) {
    HashMap<String, OutgoingPropagationCondition> result = new LinkedHashMap<>();
    EList<ErrorModelSubclause> emslist = getAllContainingClassifierEMV2Subclauses(cl);
    for (ErrorModelSubclause errorModelSubclause : emslist) {
        EList<OutgoingPropagationCondition> eflist = errorModelSubclause.getOutgoingPropagationConditions();
        for (OutgoingPropagationCondition ebt : eflist) {
            if (ebt.getName() == null) {
                unnamed.add(ebt);
            } else {
                if (!result.containsKey(ebt.getName())) {
                    result.put(ebt.getName(), ebt);
                }
            }
        }
    }
    return result;
}
Also used : ErrorModelSubclause(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause) OutgoingPropagationCondition(org.osate.xtext.aadl2.errormodel.errorModel.OutgoingPropagationCondition) LinkedHashMap(java.util.LinkedHashMap)

Example 20 with ErrorModelSubclause

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

the class EMV2Util method getAllErrorBehaviorEvents.

/**
 * return list of ErrorBehaviorEvents including those inherited from classifiers being extended
 * @param cl Classifier
 * @return Collection<ErrorBehaviorEvent> list of ErrorBehaviorEvents as HashMap for quick lookup of names
 */
public static Collection<ErrorBehaviorEvent> getAllErrorBehaviorEvents(Classifier cl) {
    HashMap<String, ErrorBehaviorEvent> result = new LinkedHashMap<>();
    EList<ErrorModelSubclause> emslist = getAllContainingClassifierEMV2Subclauses(cl);
    boolean foundEBSM = false;
    for (ErrorModelSubclause errorModelSubclause : emslist) {
        ErrorBehaviorStateMachine ebsm = errorModelSubclause.getUseBehavior();
        EList<ErrorBehaviorEvent> eflist = errorModelSubclause.getEvents();
        for (ErrorBehaviorEvent ebe : eflist) {
            if (!result.containsKey(ebe.getName())) {
                result.put(ebe.getName(), ebe);
            }
        }
        if (!foundEBSM && ebsm != null) {
            foundEBSM = true;
            eflist = ebsm.getEvents();
            for (ErrorBehaviorEvent ebe : eflist) {
                if (!result.containsKey(ebe.getName())) {
                    result.put(ebe.getName(), ebe);
                }
            }
        }
    }
    return result.values();
}
Also used : ErrorBehaviorEvent(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorEvent) ErrorModelSubclause(org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause) ErrorBehaviorStateMachine(org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorStateMachine) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

ErrorModelSubclause (org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelSubclause)32 LinkedHashMap (java.util.LinkedHashMap)15 Classifier (org.osate.aadl2.Classifier)9 ErrorBehaviorStateMachine (org.osate.xtext.aadl2.errormodel.errorModel.ErrorBehaviorStateMachine)7 NamedElement (org.osate.aadl2.NamedElement)6 ErrorPropagation (org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)5 URI (org.eclipse.emf.common.util.URI)4 ComponentClassifier (org.osate.aadl2.ComponentClassifier)4 ComponentImplementation (org.osate.aadl2.ComponentImplementation)4 EObject (org.eclipse.emf.ecore.EObject)3 AadlPackage (org.osate.aadl2.AadlPackage)3 ComponentType (org.osate.aadl2.ComponentType)3 Subcomponent (org.osate.aadl2.Subcomponent)3 AadlGraphicalEditorException (org.osate.ge.aadl2.AadlGraphicalEditorException)3 EMV2PropertyAssociation (org.osate.xtext.aadl2.errormodel.errorModel.EMV2PropertyAssociation)3 ErrorFlow (org.osate.xtext.aadl2.errormodel.errorModel.ErrorFlow)3 List (java.util.List)2 Optional (java.util.Optional)2 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)2 ErrorModelLibrary (org.osate.xtext.aadl2.errormodel.errorModel.ErrorModelLibrary)2