Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alexander Diewald
AF3-new
Commits
3fd69b8b
Commit
3fd69b8b
authored
Sep 29, 2020
by
Simon Barner
Browse files
Merge branch 'master' of
https://git.fortiss.org/af3/af3.git
into 4063
parents
912aa441
4cf97247
Changes
14
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.component/src/org/fortiss/af3/component/utils/.ratings
View file @
3fd69b8b
...
...
@@ -3,7 +3,7 @@ ComponentArchitectureTransformationBase.java da3a674974ee3304af109357e674ab7d6e0
ComponentArchitectureUtils.java 8a894320e5aa34ea2078601ca47ccabdd082d544 GREEN
ComponentModelElementFactory.java 7d73764f4ebc3a45bcd2833c68a06213109784a0 GREEN
ComponentProgramUtils.java 71faad6256159ee2d59843fcde83ac6995dff0fe GREEN
ComponentUtils.java
1f953d77153e94f2282c2ba7a9c6cf176f9449b7
GREEN
ComponentUtils.java
dc418cfee11790155ab24215be481b162f93f4c3
GREEN
GeneratorModelElementFactory.java 7fdb75341336fe579d4338a53c99df2f091c2b09 GREEN
IComponentArchitectureTransformation.java da70307771248f1d95e2fcd68e86fd68327f9df0 GREEN
SimulationUtils.java a28590d89ed92d862bf7b657b9dfc4784545e36a GREEN
org.fortiss.af3.component/src/org/fortiss/af3/component/utils/ComponentUtils.java
View file @
3fd69b8b
...
...
@@ -194,7 +194,7 @@ public class ComponentUtils {
/** True iff the component is the top component of the architecture. */
public
static
boolean
isTopComponent
(
Component
c
)
{
return
!(
c
.
e
Container
()
instanceof
Component
)
;
return
c
.
get
Container
()
instanceof
Component
Architecture
;
}
/** Cleans-up the dummy element from the top level elements. */
...
...
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/perspective/dashboard/projectwizard/.ratings
View file @
3fd69b8b
DashboardWizard.java 54a59a31d442eea46281a26649e4572d46e071bb GREEN
DashboardWizardRootElementSelectionBase.java
1fe550598f11da4cdcf1ecc02173dfc2b992b669
GREEN
DashboardWizardRootElementSelectionBase.java
e7218b31a2e5cae269b118dfac6c90db906c1f63
GREEN
DashboardWizardSelectAllocation.java 53ce55400b0d00ea1ce232fc97d51ba90c5f476f GREEN
DashboardWizardSelectComponentArchitecture.java f0fd7beb28cb98e1174e2a2b730b0985bd792f7b GREEN
DashboardWizardSelectDataDictionary.java 8348827dd9b64c899b901eb5c3880a1be7128803 GREEN
DashboardWizardSelectPlatformArchitecture.java
03d5a1e1878ea5fa9e4a7a47da1b43edb7868775
GREEN
DashboardWizardSelectPlatformArchitecture.java
a0532f3cde0b7f980a7f87e8c627ae9352e1eb57
GREEN
DashboardWizardSelectProjectSource.java 9463d2a5fc69c015ae487606fa529b888b4f9e7c GREEN
DashboardWizardSelectTaskArchitecture.java 79f8aa8279aa6a54e4b6b54639925c06365d43fb GREEN
DashboardWizardSelectTimingSpecification.java 2315d36aa8b45cde7838e342e308d9e7027ea87e GREEN
...
...
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/perspective/dashboard/projectwizard/DashboardWizardRootElementSelectionBase.java
View file @
3fd69b8b
...
...
@@ -15,9 +15,12 @@
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.exploration.ui.perspective.dashboard.projectwizard
;
import
static
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isEmpty
;
import
static
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNoneEmpty
;
import
static
org
.
eclipse
.
jface
.
viewers
.
AbstractTreeViewer
.
ALL_LEVELS
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
SelectionUtils
.
checkAndPickFirst
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
KernelModelElementUtils
.
getParentElement
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
LoggingUtils
.
showWarning
;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.jface.viewers.ISelectionChangedListener
;
...
...
@@ -34,6 +37,7 @@ import org.eclipse.swt.layout.GridLayout;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Tree
;
import
org.eclipse.wb.swt.SWTResourceManager
;
import
org.fortiss.af3.exploration.model.project.DSE
;
import
org.fortiss.af3.exploration.ui.perspective.generic.HierarchicElementContentProvider
;
import
org.fortiss.tooling.kernel.model.IProjectRootElement
;
import
org.fortiss.tooling.kernel.ui.presentation.ModelElementLabelProvider
;
...
...
@@ -80,6 +84,22 @@ public abstract class DashboardWizardRootElementSelectionBase<T extends IProject
/** Predicate if the given {@link IProjectRootElement} and may be selected. */
protected
abstract
boolean
isRelevantRootElement
(
T
rootElement
);
/**
* Optional method to notice the user about reduced functionality when importing the given
* {@link IProjectRootElement}. Thus, he or she can decide whether to adjust the model
* beforehand.
*
* @param rootElement
* element to examin whether its selection implies reduced functionality of the
* {@link DSE}.
*
* @return a string to notify the user about reduced functionality for the selected element.
*/
protected
String
noticeReducedFunctionality
(
T
rootElement
)
{
// Optional implementation by children.
return
null
;
}
/** Returns the content provider to be used for the {@link TreeViewer} shown in this page. */
protected
ITreeContentProvider
createContentProvider
()
{
return
new
HierarchicElementContentProvider
();
...
...
@@ -116,6 +136,9 @@ public abstract class DashboardWizardRootElementSelectionBase<T extends IProject
});
treeViewer
.
addSelectionChangedListener
(
new
ISelectionChangedListener
()
{
/** Predicate to avoid blocking the UI for double clicks. */
private
boolean
userNoticeShown
=
false
;
/** {@inheritDoc} */
@Override
public
void
selectionChanged
(
SelectionChangedEvent
event
)
{
...
...
@@ -140,6 +163,16 @@ public abstract class DashboardWizardRootElementSelectionBase<T extends IProject
setErrorMessage
(
errorMessage
);
selectedRootElement
=
rootElement
;
// Shows a user notice about reduced functionality if needed and if no severe error
// was detected in the model.
if
(
isEmpty
(
errorMessage
))
{
String
noticeMessage
=
noticeReducedFunctionality
(
rootElement
);
if
(
isNoneEmpty
(
noticeMessage
)
&&
!
userNoticeShown
)
{
showWarning
(
noticeMessage
);
userNoticeShown
=
true
;
}
}
treeViewer
.
refresh
(
true
);
setPageComplete
(
rootElement
!=
null
||
!
isRequired
());
}
...
...
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/perspective/dashboard/projectwizard/DashboardWizardSelectPlatformArchitecture.java
View file @
3fd69b8b
...
...
@@ -19,6 +19,7 @@ import static org.fortiss.af3.exploration.util.ModelSnapshotExtractUtils.createP
import
static
org
.
fortiss
.
af3
.
platform
.
utils
.
PlatformArchitectureUtils
.
findAllGatewayUnits
;
import
static
org
.
fortiss
.
af3
.
platform
.
utils
.
PlatformArchitectureUtils
.
findAtomicTransmissionUnits
;
import
static
org
.
fortiss
.
af3
.
task
.
util
.
TaskArchitectureUtils
.
findTargetExecutionUnits
;
import
static
org
.
fortiss
.
tooling
.
base
.
utils
.
AnnotationUtils
.
getAnnotation
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
pickInstanceOf
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
KernelModelElementUtils
.
getParentElement
;
...
...
@@ -29,6 +30,8 @@ import java.util.function.BiFunction;
import
org.eclipse.emf.ecore.EObject
;
import
org.fortiss.af3.exploration.model.project.ModelSnapshot
;
import
org.fortiss.af3.platform.model.PlatformArchitecture
;
import
org.fortiss.af3.safety.model.SafetyStandard
;
import
org.fortiss.af3.safety.model.annotation.SafetyIntegrityLevel
;
import
org.fortiss.tooling.kernel.model.IProjectRootElement
;
/**
...
...
@@ -62,6 +65,18 @@ public class DashboardWizardSelectPlatformArchitecture
return
!
findTargetExecutionUnits
(
platformArchitecture
).
isEmpty
();
}
/** {@inheritDoc} */
@Override
protected
String
noticeReducedFunctionality
(
PlatformArchitecture
rootElement
)
{
SafetyIntegrityLevel
sil
=
getAnnotation
(
rootElement
,
SafetyIntegrityLevel
.
class
);
if
(
sil
.
getSafetyStandard
()
==
SafetyStandard
.
UNDEFINED
)
{
return
"The safety standard of the platform architecture is not defined.\n"
+
"To use the safety level constraints, please define the safety standard"
+
" and the level in the modelling perspective."
;
}
return
null
;
}
/** {@inheritDoc} */
@Override
public
BiFunction
<
PlatformArchitecture
,
Collection
<
ModelSnapshot
>,
ModelSnapshot
>
...
...
org.fortiss.af3.safety/model/.ratings
View file @
3fd69b8b
safety.ecore
547666b5e7c414c92ba5cc693b71a86f9ca9a4f2
GREEN
safety.ecore
3f106ac2ad3de683c0f888988e2cfcb404d6d07a
GREEN
org.fortiss.af3.safety/model/safety.ecore
View file @
3fd69b8b
...
...
@@ -89,7 +89,7 @@
<eOperations
name=
"isUserAnnotatedValuePreferred"
eType=
"ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
>
<eAnnotations
source=
"http://www.eclipse.org/emf/2002/GenModel"
>
<details
key=
"documentation"
value=
"{@inheritDoc}"
/>
<details
key=
"body"
value=
"return
tru
e;"
/>
<details
key=
"body"
value=
"return
fals
e;"
/>
</eAnnotations>
</eOperations>
<eStructuralFeatures
xsi:type=
"ecore:EAttribute"
name=
"safetyStandard"
eType=
"#//SafetyStandard"
>
...
...
org.fortiss.af3.safety/model/safety.genmodel
View file @
3fd69b8b
...
...
@@ -80,7 +80,7 @@
<genParameters
ecoreParameter=
"safety.ecore#//annotation/SafetyIntegrityLevel/setValue/value"
/>
</genOperations>
<genOperations
ecoreOperation=
"safety.ecore#//annotation/SafetyIntegrityLevel/isUserAnnotatedValuePreferred"
body=
"return
tru
e;"
/>
body=
"return
fals
e;"
/>
</genClasses>
<genClasses
ecoreClass=
"safety.ecore#//annotation/ProbabilisticMetricHardwareFailure"
>
<genFeatures
createChild=
"false"
ecoreFeature=
"ecore:EAttribute safety.ecore#//annotation/ProbabilisticMetricHardwareFailure/pmhfValue"
/>
...
...
org.fortiss.af3.safety/src/org/fortiss/af3/safety/annotation/valueprovider/.ratings
View file @
3fd69b8b
HwComplexityValueProvider.java 23583ed930bbd942485e317ecf485323c7152a4f GREEN
SafetyIntegrityLevelValueProvider.java
ca2f9f0a95a09407f9967c41d027eb2a66826c1b
GREEN
SafetyIntegrityLevelValueProvider.java
69f1c7371043a6f2edd44f83274a9ebbfbb85123
GREEN
org.fortiss.af3.safety/src/org/fortiss/af3/safety/annotation/valueprovider/SafetyIntegrityLevelValueProvider.java
View file @
3fd69b8b
...
...
@@ -17,6 +17,7 @@ package org.fortiss.af3.safety.annotation.valueprovider;
import
static
org
.
fortiss
.
af3
.
safety
.
utils
.
SafetyUtils
.
haveDirectChildsSpecifiedSIL
;
import
static
org
.
fortiss
.
af3
.
safety
.
utils
.
SafetyUtils
.
isElementTopElement
;
import
static
org
.
fortiss
.
af3
.
safety
.
utils
.
SafetyUtils
.
isParentLevelSet
;
import
org.eclipse.emf.common.util.Enumerator
;
import
org.fortiss.af3.platform.hierarchic.model.node.INodeDomain
;
...
...
@@ -61,7 +62,7 @@ public class SafetyIntegrityLevelValueProvider
return
false
;
}
return
super
.
canEdi
t
(
specification
);
return
!
isParentLevelSe
t
(
specification
);
}
/** {@inheritDoc} */
...
...
org.fortiss.af3.safety/src/org/fortiss/af3/safety/model/annotation/impl/.ratings
View file @
3fd69b8b
HwComplexityStaticImpl.java c2831359544871abc99c4b64d671090c5adb01cb GREEN
SafetyIntegrityLevelStaticImpl.java
95e8723f5edd03a72fab2c4fab01cc74585c61d
9 GREEN
SafetyIntegrityLevelStaticImpl.java
6d71daabcb65e04ca232290c0edd37b6b94fb6f
9 GREEN
org.fortiss.af3.safety/src/org/fortiss/af3/safety/model/annotation/impl/SafetyIntegrityLevelStaticImpl.java
View file @
3fd69b8b
...
...
@@ -22,9 +22,12 @@ import static org.fortiss.af3.safety.utils.SafetyUtils.getSafetyIntegrityLevelEn
import
static
org
.
fortiss
.
af3
.
safety
.
utils
.
SafetyUtils
.
getSafetyStandardOf
;
import
static
org
.
fortiss
.
af3
.
safety
.
utils
.
SafetyUtils
.
haveDirectChildsSpecifiedSIL
;
import
static
org
.
fortiss
.
af3
.
safety
.
utils
.
SafetyUtils
.
isElementTopElement
;
import
static
org
.
fortiss
.
af3
.
safety
.
utils
.
SafetyUtils
.
isSafetyStandardElement
;
import
static
org
.
fortiss
.
af3
.
safety
.
utils
.
SafetyUtils
.
isUserSafetyLevelPresent
;
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
.
getFirstParentWith
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
KernelModelElementUtils
.
getParentElement
;
import
java.util.HashMap
;
...
...
@@ -152,6 +155,11 @@ public class SafetyIntegrityLevelStaticImpl {
*/
public
static
Enumerator
getDerivedValue
(
SafetyIntegrityLevel
specification
)
{
IModelElement
modelElement
=
specification
.
getSpecificationOf
();
if
(
isSafetyStandardElement
(
modelElement
))
{
return
null
;
}
if
(
modelElement
instanceof
INodeDomain
)
{
if
(
modelElement
instanceof
IHierarchicElementContainer
)
{
if
(
haveDirectChildsSpecifiedSIL
(
modelElement
))
{
...
...
@@ -178,13 +186,23 @@ public class SafetyIntegrityLevelStaticImpl {
}
}
return
specification
.
getUserAnnotatedValue
();
Enumerator
thisValue
=
specification
.
getUserAnnotatedValue
();
if
(
modelElement
instanceof
IHierarchicElement
)
{
IModelElement
parent
=
(
IModelElement
)
getFirstParentWith
(
modelElement
,
isUserSafetyLevelPresent
());
if
(
parent
!=
null
&&
!
isSafetyStandardElement
(
parent
))
{
return
getAnnotationValue
(
parent
,
SafetyIntegrityLevel
.
class
,
Enumerator
.
class
);
}
}
return
thisValue
;
}
/** Returns the user annotated value based on the root {@link SafetyStandard}. */
public
static
Enumerator
getUserAnnotatedValue
(
SafetyIntegrityLevelImpl
specification
)
{
SafetyStandard
safetyStandard
=
getSafetyStandardOf
(
specification
);
return
specification
.
isIsSafetyValueSet
()
return
(
safetyStandard
!=
SafetyStandard
.
UNDEFINED
&&
specification
.
isIsSafetyValueSet
())
?
(
Enumerator
)
specification
.
eGet
(
getSafetyEnumeratorOf
(
safetyStandard
))
:
null
;
}
...
...
@@ -225,8 +243,9 @@ public class SafetyIntegrityLevelStaticImpl {
if
(
specification
==
null
)
{
return
null
;
}
IModelElement
modelElement
=
specification
.
getSpecificationOf
();
if
(
value
instanceof
SafetyStandard
)
{
if
(
isSafetyStandardElement
(
modelElement
)
&&
value
instanceof
SafetyStandard
)
{
return
setSafetyStandard
(
specification
,
(
SafetyStandard
)
value
);
}
...
...
org.fortiss.af3.safety/src/org/fortiss/af3/safety/utils/.ratings
View file @
3fd69b8b
SafetyUtils.java
7c920d22d4432cdebc7493a968e32035fd21c32a
GREEN
SafetyUtils.java
33cf2819c7c033bb4f984a05801cdceb2cd59818
GREEN
org.fortiss.af3.safety/src/org/fortiss/af3/safety/utils/SafetyUtils.java
View file @
3fd69b8b
...
...
@@ -2,11 +2,13 @@ package org.fortiss.af3.safety.utils;
import
static
java
.
lang
.
Math
.
max
;
import
static
java
.
util
.
stream
.
Collectors
.
toList
;
import
static
org
.
fortiss
.
af3
.
component
.
utils
.
ComponentUtils
.
isTopComponent
;
import
static
org
.
fortiss
.
tooling
.
base
.
utils
.
AnnotationUtils
.
getAnnotation
;
import
static
org
.
fortiss
.
tooling
.
base
.
utils
.
AnnotationUtils
.
getAnnotationValue
;
import
static
org
.
fortiss
.
tooling
.
base
.
utils
.
AnnotationUtils
.
getParentAnnotationsWithType
;
import
static
org
.
fortiss
.
tooling
.
common
.
util
.
LambdaUtils
.
filterByType
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
getChildrenWithType
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
getFirstParentWith
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
KernelModelElementUtils
.
getParentElement
;
import
java.util.ArrayList
;
...
...
@@ -16,23 +18,22 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.function.Predicate
;
import
org.conqat.lib.commons.collections.Pair
;
import
org.eclipse.emf.common.util.EList
;
import
org.eclipse.emf.common.util.Enumerator
;
import
org.eclipse.emf.ecore.EAttribute
;
import
org.eclipse.emf.ecore.EObject
;
import
org.fortiss.af3.component.model.Component
;
import
org.fortiss.af3.component.model.ComponentArchitecture
;
import
org.fortiss.af3.platform.model.ExecutionUnit
;
import
org.fortiss.af3.platform.model.generic.GenericExecutionUnit
;
import
org.fortiss.af3.platform.model.generic.GenericTransmissionUnit
;
import
org.fortiss.af3.safety.model.ASIL
;
import
org.fortiss.af3.safety.model.DAL
;
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.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.kernel.model.IProjectRootElement
;
...
...
@@ -103,11 +104,6 @@ public class SafetyUtils {
EObject
parentElement
=
currentModelElement
;
SafetyStandard
safetyStandard
=
specification
.
getSafetyStandard
();
// For Generic Hardware Components only IEC61508 Standard is used.
if
(
currentModelElement
instanceof
GenericTransmissionUnit
||
currentModelElement
instanceof
GenericExecutionUnit
)
{
return
SafetyStandard
.
IEC61508
;
}
while
(
parentElement
!=
null
&&
safetyStandard
==
SafetyStandard
.
UNDEFINED
)
{
if
(
parentElement
instanceof
IModelElement
)
{
currentModelElement
=
(
IModelElement
)
parentElement
;
...
...
@@ -146,27 +142,35 @@ public class SafetyUtils {
}
/**
* Returns the dominant(largest) safety level of the given specification and
* Returns
integer value of
the dominant(largest) safety level of the given specification and
* its parents.
*
* This method is used in the reuse plugin.
*/
public
static
Integer
getLargestParentSafetyLevelValue
(
SafetyIntegrityLevel
specification
)
{
IModelElement
element
=
specification
.
getSpecificationOf
();
EList
<
SafetyIntegrityLevel
>
parentSilAnnotations
=
getParentAnnotationsWithType
(
element
,
SafetyIntegrityLevel
.
class
);
List
<
SafetyIntegrityLevel
>
silAnnotations
=
new
ArrayList
<>(
parentSilAnnotations
);
silAnnotations
.
add
(
specification
);
return
getLargestParentSafetyLevel
(
specification
).
getFirst
();
}
return
getLargestSafetyLevelValue
(
silAnnotations
).
getFirst
();
/**
* Returns the dominant(largest) safety level of the given specification and
* its parents.
*
* This method is used in the reuse plugin.
*/
public
static
Enumerator
getLargestParentSafetyLevelEnum
(
SafetyIntegrityLevel
specification
)
{
return
getLargestParentSafetyLevel
(
specification
).
getSecond
().
getValue
();
}
/** Returns the dominant(largest) safety level in the given list of specifications. */
p
ublic
static
Pair
<
Integer
,
SafetyIntegrityLevel
>
getLargestSafetyLevel
Value
(
List
<
SafetyIntegrityLevel
>
parentSilAnnot
ation
s
)
{
p
rivate
static
Pair
<
Integer
,
SafetyIntegrityLevel
>
getLargest
Parent
SafetyLevel
(
SafetyIntegrityLevel
specific
ation
)
{
int
largestLevelInHierarchy
=
0
;
SafetyIntegrityLevel
largestSIL
=
null
;
for
(
SafetyIntegrityLevel
currentSIL
:
parentSilAnnotations
)
{
List
<
SafetyIntegrityLevel
>
silAnnotations
=
getParentAnnotationsWithType
(
specification
.
getSpecificationOf
(),
SafetyIntegrityLevel
.
class
);
for
(
SafetyIntegrityLevel
currentSIL
:
silAnnotations
)
{
int
currentLevel
=
getSafetyLevelValueOf
(
currentSIL
);
largestSIL
=
largestLevelInHierarchy
<
currentLevel
?
currentSIL
:
largestSIL
;
largestLevelInHierarchy
=
max
(
largestLevelInHierarchy
,
currentLevel
);
...
...
@@ -175,6 +179,51 @@ public class SafetyUtils {
return
new
Pair
<>(
largestLevelInHierarchy
,
largestSIL
);
}
/**
* Determines whether the {@link SafetyIntegrityLevel} has been set for a parent
* {@link IModelElement} of the {@link IModelElement} of the given specification.
*/
public
static
boolean
isParentLevelSet
(
SafetyIntegrityLevel
specification
)
{
IModelElement
element
=
specification
.
getSpecificationOf
();
if
(
element
instanceof
IHierarchicElement
)
{
IModelElement
parent
=
(
IModelElement
)
getFirstParentWith
(
element
,
isUserSafetyLevelPresent
());
if
(
parent
!=
null
)
{
return
true
;
}
}
return
false
;
}
/**
* Returns a {@link Predicate} that determies whether the {@link SafetyIntegrityLevel} has been
* defined for an potentially underlying {@link IModelElement}.
*/
public
static
Predicate
<
EObject
>
isUserSafetyLevelPresent
()
{
return
obj
->
{
if
(
obj
instanceof
IModelElement
&&
!
isSafetyStandardElement
((
IModelElement
)
obj
))
{
SafetyIntegrityLevel
sil
=
getAnnotation
((
IModelElement
)
obj
,
SafetyIntegrityLevel
.
class
);
if
(
sil
!=
null
)
{
return
sil
.
getUserAnnotatedValue
()
!=
null
;
}
}
return
false
;
};
}
/**
* Predicate whether the given {@link IModelElement} defines a safety standard or an integrity
* level.
*/
public
static
boolean
isSafetyStandardElement
(
IModelElement
modelElement
)
{
boolean
isTopComponent
=
modelElement
instanceof
Component
&&
isTopComponent
((
Component
)
modelElement
);
return
modelElement
instanceof
IProjectRootElement
||
isTopComponent
;
}
/** Returns the proper string depending on the safety standard. */
public
static
String
toString
(
SafetyIntegrityLevel
sil
)
{
if
(
sil
.
getSafetyStandard
().
equals
(
SafetyStandard
.
IEC61508
))
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment