Commit a866c9f9 authored by Alexander Diewald's avatar Alexander Diewald
Browse files

YELLOW

Issue-Ref: 3859
Issue-Url: https://af3-developer.fortiss.org/issues/3859

Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent 8a9bf66b
safety.ecore 6394bb80e33ae0d0720bbd0ecea7164ab5c5d275 RED
safety.ecore 6394bb80e33ae0d0720bbd0ecea7164ab5c5d275 YELLOW
HwComplexityValueProvider.java 23583ed930bbd942485e317ecf485323c7152a4f GREEN
SafetyIntegrityLevelValueProvider.java 1d61a51eced9f7602a4b0d7aca0824c1963857e6 RED
SafetyIntegrityLevelValueProvider.java 1d61a51eced9f7602a4b0d7aca0824c1963857e6 YELLOW
HwComplexityStaticImpl.java c2831359544871abc99c4b64d671090c5adb01cb GREEN
SafetyIntegrityLevelStaticImpl.java 47b5ec543370f5eca1697e266d46a959c191a408 RED
SafetyIntegrityLevelStaticImpl.java 9783e771570bb8b6ac6bbd0eceea7a139ce3be67 YELLOW
......@@ -19,9 +19,12 @@ import static org.fortiss.af3.safety.utils.SafetyUtils.getLowestChildSafetyLevel
import static org.fortiss.af3.safety.utils.SafetyUtils.getSafetyEnumeratorOf;
import static org.fortiss.af3.safety.utils.SafetyUtils.getSafetyIntegrityLevelEnumOf;
import static org.fortiss.af3.safety.utils.SafetyUtils.getSafetyStandardOf;
import static org.fortiss.af3.safety.utils.SafetyUtils.getStandardSpecificValue;
import static org.fortiss.af3.safety.utils.SafetyUtils.haveDirectChildsSpecifiedSIL;
import static org.fortiss.af3.safety.utils.SafetyUtils.isElementTopElement;
import static org.fortiss.tooling.base.utils.AnnotationUtils.getAnnotation;
import static org.fortiss.tooling.base.utils.AnnotationUtils.getAnnotationValue;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement;
import java.util.Collections;
......@@ -42,11 +45,10 @@ import org.fortiss.af3.safety.model.SIL;
import org.fortiss.af3.safety.model.SafetyStandard;
import org.fortiss.af3.safety.model.annotation.SafetyAnnotationPackage;
import org.fortiss.af3.safety.model.annotation.SafetyIntegrityLevel;
import org.fortiss.af3.safety.utils.SafetyUtils;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.element.IHierarchicElementContainer;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.utils.AnnotationUtils;
import org.fortiss.tooling.base.model.element.IModelElementSpecification;
import org.fortiss.tooling.kernel.model.IProjectRootElement;
/**
......@@ -146,11 +148,16 @@ public class SafetyIntegrityLevelStaticImpl {
}
});
/**
* Determines the {@link SafetyStandard}-specific Enumerator that encodes the safety level of
* the given {@link SafetyIntegrityLevel} {@link IModelElementSpecification}. Here, a
* distinction for the achievable safety level of HW elements is done.
*/
public static Enumerator getDerivedValue(SafetyIntegrityLevel specification) {
IModelElement modelElement = specification.getSpecificationOf();
if(modelElement instanceof INodeDomain) {
if(modelElement instanceof IHierarchicElementContainer) {
if(SafetyUtils.haveDirectChildsSpecifiedSIL(modelElement)) {
if(haveDirectChildsSpecifiedSIL(modelElement)) {
Integer lowestChildSIL = getLowestChildSafetyLevelValue(specification, false);
return (Enumerator)getSafetyIntegrityLevelEnumOf(specification)[lowestChildSIL];
}
......@@ -163,15 +170,14 @@ public class SafetyIntegrityLevelStaticImpl {
if(value == null && modelElement instanceof IHierarchicElement) {
IModelElement parent =
(IModelElement)((IHierarchicElement)modelElement).getContainer();
return pickFirstInstanceOf(SafetyIntegrityLevel.class, parent.getSpecifications())
.getUserAnnotatedValue();
SafetyIntegrityLevel parentAnn = getAnnotation(parent, SafetyIntegrityLevel.class);
return parentAnn.getUserAnnotatedValue();
}
} else if(modelElement instanceof IProcessorDomain) {
if(modelElement instanceof IHierarchicElement) {
IModelElement parent =
(IModelElement)((IHierarchicElement)modelElement).getContainer();
return AnnotationUtils.getAnnotationValue(parent, SafetyIntegrityLevel.class,
Enumerator.class);
return getAnnotationValue(parent, SafetyIntegrityLevel.class, Enumerator.class);
}
}
......@@ -180,7 +186,7 @@ public class SafetyIntegrityLevelStaticImpl {
/** Returns the user annotated value based on the root {@link SafetyStandard}. */
public static Enumerator getUserAnnotatedValue(SafetyIntegrityLevelImpl specification) {
return SafetyUtils.getStandardSpecificValue(specification);
return getStandardSpecificValue(specification);
}
/**
......
SafetyUtils.java f2d5401ba9b5de84d9a6e861c551bbc29695165f RED
SafetyUtils.java 16d1b500acf4932f12eeb5a88e8a7e11483e46ce YELLOW
......@@ -35,7 +35,6 @@ import org.fortiss.af3.safety.model.annotation.SafetyAnnotationPackage;
import org.fortiss.af3.safety.model.annotation.SafetyIntegrityLevel;
import org.fortiss.tooling.base.model.element.IHierarchicElementContainer;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.utils.AnnotationUtils;
import org.fortiss.tooling.kernel.model.IProjectRootElement;
/**
......@@ -212,8 +211,8 @@ public class SafetyUtils {
Collection<ExecutionUnit> directChildExUs =
filterByType(((IHierarchicElementContainer)modelElement).getContainedElements(),
ExecutionUnit.class);
List<Enumerator> safetyEnums = directChildExUs.stream().map(e -> AnnotationUtils
.getAnnotation(e, SafetyIntegrityLevel.class).getUserAnnotatedValue())
List<Enumerator> safetyEnums = directChildExUs.stream()
.map(e -> getAnnotation(e, SafetyIntegrityLevel.class).getUserAnnotatedValue())
.collect(toList());
// get(0): safe due to size check.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment