Commit f1a8d629 authored by Ashmi Banerjee's avatar Ashmi Banerjee
Browse files

Issue# 3462: FTA Aspect implementation



* Implemented the FTA aspect (WIP)
Signed-off-by: default avatarAshmi Banerjee <ashmi.banerjee@tum.de>
parent 5f1be414
......@@ -124,6 +124,12 @@
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.safety.MooNSolutionRequirementSpecification">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mira.ui.handler.AspectHandlers$FTASolutionHandler">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.safety.FTASolutionRequirementSpecification">
</modelElementClass>
</modelElementHandler>
<modelElementHandler
handler="org.fortiss.af3.mira.ui.handler.AspectHandlers$AssetsHandler">
......@@ -349,7 +355,13 @@
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.Requirement">
</modelElementClass>
</modelEditorBinding>
</modelEditorBinding>
<modelEditorBinding
binding="org.fortiss.af3.mira.ui.editorbinding.AspectBindings$FTASolutionAspectBinding">
<modelElementClass
modelElementClass="org.fortiss.af3.mira.model.Requirement">
</modelElementClass>
</modelEditorBinding>
<modelEditorBinding
binding="org.fortiss.af3.mira.ui.editorbinding.AspectBindings$AssetsBinding">
<modelElementClass
......
......@@ -26,6 +26,7 @@ import org.fortiss.af3.mira.model.SafetyLevelRequirementSpecification;
import org.fortiss.af3.mira.model.functional.FormalSpecification;
import org.fortiss.af3.mira.model.functional.FunctionalSpecification;
import org.fortiss.af3.mira.model.functional.SignalContainerSpecification;
import org.fortiss.af3.mira.model.safety.FTASolutionRequirementSpecification;
import org.fortiss.af3.mira.model.safety.HazardRequirementSpecification;
import org.fortiss.af3.mira.model.safety.MooNSolutionRequirementSpecification;
import org.fortiss.af3.mira.model.security.Assets;
......@@ -36,6 +37,7 @@ import org.fortiss.af3.mira.model.timing.TimingRequirement;
import org.fortiss.af3.mira.ui.editor.AssetsEditor;
import org.fortiss.af3.mira.ui.editor.CounterMeasuresEditor;
import org.fortiss.af3.mira.ui.editor.DerivedRequirementEditor;
import org.fortiss.af3.mira.ui.editor.FTASolutionRequirementEditor;
import org.fortiss.af3.mira.ui.editor.FunctionalRequirementEditor;
import org.fortiss.af3.mira.ui.editor.HazardRequirementEditor;
import org.fortiss.af3.mira.ui.editor.InterfaceEditor;
......@@ -185,6 +187,32 @@ public class AspectBindings {
}
}
/** Binding for FTA aspect. */
public static class FTASolutionAspectBinding extends ModelEditorBindingBase<Requirement> {
/** {@inheritDoc} */
@Override
public Class<? extends IEditorPart> getEditorClass(Requirement obj) {
if(pickFirstInstanceOf(FTASolutionRequirementSpecification.class,
obj.getSpecifications()) == null) {
return null;
}
return FTASolutionRequirementEditor.class;
}
/** {@inheritDoc} */
@Override
public String getLabel() {
return "FTA Solution definition";
}
/** {@inheritDoc} */
@Override
public int getPriority() {
return SECONDEDITORPRIORITY;
}
}
/** Binding for Assets aspect. */
public static class AssetsBinding extends ModelEditorBindingBase<Requirement> {
......
......@@ -30,6 +30,7 @@ import org.fortiss.af3.mira.model.SafetyLevelRequirementSpecification;
import org.fortiss.af3.mira.model.functional.FormalSpecification;
import org.fortiss.af3.mira.model.functional.FunctionalSpecification;
import org.fortiss.af3.mira.model.functional.SignalContainerSpecification;
import org.fortiss.af3.mira.model.safety.FTASolutionRequirementSpecification;
import org.fortiss.af3.mira.model.safety.HazardRequirementSpecification;
import org.fortiss.af3.mira.model.safety.MooNSolutionRequirementSpecification;
import org.fortiss.af3.mira.model.security.Assets;
......@@ -126,6 +127,17 @@ public class AspectHandlers {
}
}
/** Handler for {@link FTASolutionRequirementSpecification}s. */
public static class FTASolutionHandler extends
SpecificationHandlerBase<FTASolutionRequirementSpecification> {
/** {@inheritDoc} */
@Override
public String getName(FTASolutionRequirementSpecification element) {
return "FTA aspect";
}
}
/** Handler for {@link Assets}'s. */
public static class AssetsHandler extends SpecificationHandlerBase<Assets> {
......
......@@ -32,6 +32,7 @@ import org.fortiss.af3.mira.model.SafetyLevelRequirementSpecification;
import org.fortiss.af3.mira.model.functional.FormalSpecification;
import org.fortiss.af3.mira.model.functional.FunctionalSpecification;
import org.fortiss.af3.mira.model.functional.SignalContainerSpecification;
import org.fortiss.af3.mira.model.safety.FTASolutionRequirementSpecification;
import org.fortiss.af3.mira.model.safety.HazardRequirementSpecification;
import org.fortiss.af3.mira.model.safety.MooNSolutionRequirementSpecification;
import org.fortiss.af3.mira.model.timing.TimingRequirement;
......@@ -85,6 +86,7 @@ public class RequirementHandler extends NamedCommentedModelElementHandlerBase<Re
boolean temporalAspect = false;
boolean moonSolutionAspect = false;
boolean hazardAspect = false;
boolean ftaAspect = false;
for(IModelElementSpecification spec : element.getSpecifications()) {
if(spec instanceof TimingRequirement) {
......@@ -128,6 +130,10 @@ public class RequirementHandler extends NamedCommentedModelElementHandlerBase<Re
aspectCounter++;
hazardAspect = true;
}
if(spec instanceof FTASolutionRequirementSpecification) {
aspectCounter++;
ftaAspect = true;
}
}
if(aspectCounter == 1 && signalAspect == true) {
......@@ -143,7 +149,7 @@ public class RequirementHandler extends NamedCommentedModelElementHandlerBase<Re
(paramdefCounter > 1 && parameterdefAspect == true)) {
return imageDescriptorFromPlugin(PLUGIN_ID, "icons/Icon_ReqwithParameterDef.png");
}
if(aspectCounter == 1 && (safetyAspect || moonSolutionAspect || hazardAspect)) {
if(aspectCounter == 1 && (safetyAspect || moonSolutionAspect || hazardAspect || ftaAspect)) {
return imageDescriptorFromPlugin(PLUGIN_ID, "icons/Icon_ReqwithSafety.png");
}
if(aspectCounter == 1 && formalspecAspect == true) {
......
......@@ -838,5 +838,10 @@
<eLiterals name="Hazardous" value="4"/>
<eLiterals name="Catastrophic" value="5"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FTASolutionRequirementSpecification"
eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementSpecification #//INonFunctionalRequirement platform:/resource/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="minCutSet" upperBound="-1"
eType="#//functional/Signal" containment="true"/>
</eClassifiers>
</eSubpackages>
</ecore:EPackage>
......@@ -429,6 +429,9 @@
<genFeatures notify="false" createChild="false" propertySortChoices="true"
ecoreFeature="ecore:EReference mira.ecore#//safety/MooNSolutionRequirementSpecification/inputSignals"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//safety/FTASolutionRequirementSpecification">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference mira.ecore#//safety/FTASolutionRequirementSpecification/minCutSet"/>
</genClasses>
</nestedGenPackages>
</genPackages>
</genmodel:GenModel>
......@@ -27,6 +27,7 @@ import org.fortiss.af3.mira.model.SafetyLevelRequirementSpecification;
import org.fortiss.af3.mira.model.functional.FormalSpecification;
import org.fortiss.af3.mira.model.functional.FunctionalSpecification;
import org.fortiss.af3.mira.model.functional.SignalContainerSpecification;
import org.fortiss.af3.mira.model.safety.FTASolutionRequirementSpecification;
import org.fortiss.af3.mira.model.safety.HazardRequirementSpecification;
import org.fortiss.af3.mira.model.safety.MooNSolutionRequirementSpecification;
import org.fortiss.af3.mira.model.security.Assets;
......@@ -113,6 +114,11 @@ public class RequirementCompositor extends HierarchicElementCompositorBase<Requi
if(moonsol == null && contained instanceof MooNSolutionRequirementSpecification) {
return true;
}
FTASolutionRequirementSpecification ftasol =
pickFirstInstanceOf(FTASolutionRequirementSpecification.class, specs);
if(ftasol == null && contained instanceof FTASolutionRequirementSpecification) {
return true;
}
if(contained instanceof ParameterDefinition || contained instanceof TimingRequirement) {
return true;
......
......@@ -45,6 +45,7 @@ import org.fortiss.af3.mira.model.functional.FunctionalSpecification;
import org.fortiss.af3.mira.model.functional.SignalContainerSpecification;
import org.fortiss.af3.mira.model.glossary.Glossary;
import org.fortiss.af3.mira.model.requirementSource.RequirementSource;
import org.fortiss.af3.mira.model.safety.FTASolutionRequirementSpecification;
import org.fortiss.af3.mira.model.safety.HazardRequirementSpecification;
import org.fortiss.af3.mira.model.safety.MooNSolutionRequirementSpecification;
import org.fortiss.af3.mira.model.safety.SafetyFactory;
......@@ -127,6 +128,10 @@ public class PrototypeProvider extends PrototypeProviderBase {
SafetyFactory.eINSTANCE.createMooNSolutionRequirementSpecification();
registerPrimaryPrototype("Safety - MooN Solution aspect", moonsol, CATEGORY_NAME);
FTASolutionRequirementSpecification ftasol =
SafetyFactory.eINSTANCE.createFTASolutionRequirementSpecification();
registerPrimaryPrototype("Safety - FTA Solution aspect", ftasol, CATEGORY_NAME);
Assets a = MiraModelElementFactory.createAssets();
registerPrimaryPrototype("Assets", a, CATEGORY_NAME);
......
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