Commit 45c4599c authored by Johannes Eder's avatar Johannes Eder
Browse files

removed constraint references

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

Signed-off-by: Johannes Eder's avatarJohannes Eder <eder@fortiss.org>
parent 179bf027
......@@ -32,7 +32,6 @@ Export-Package: org.fortiss.af3.requirementspatterns.model,
org.fortiss.af3.safetyargumentationpackage.utils,
org.fortiss.af3.safetycases,
org.fortiss.af3.safetycases.compose,
org.fortiss.af3.safetycases.constraint,
org.fortiss.af3.safetycases.model,
org.fortiss.af3.safetycases.model.impl,
org.fortiss.af3.safetycases.model.util,
......
AF3SafetyCasesActivator.java 959a0de5d69856468c4dabd2e184fbedc662bc27 YELLOW
AF3SafetyCasesActivator.java 414777e12757652b2229cc88bad0301cf988d669 GREEN
......@@ -16,26 +16,6 @@
package org.fortiss.af3.safetycases;
import org.eclipse.core.runtime.Plugin;
import org.fortiss.af3.safetycases.constraint.ArgumentElementBaseInterconnectionConstraint;
import org.fortiss.af3.safetycases.constraint.ArgumentElementBaseNameConstraint;
import org.fortiss.af3.safetycases.constraint.ArgumentElementInstantiatedConstraint;
import org.fortiss.af3.safetycases.constraint.ArgumentModuleInstantiatedConstraint;
import org.fortiss.af3.safetycases.constraint.AwayArgumentElementReferenceConstraint;
import org.fortiss.af3.safetycases.constraint.ConnectionIsOptionalConstraint;
import org.fortiss.af3.safetycases.constraint.ConnectionMultiplicityConstraint;
import org.fortiss.af3.safetycases.constraint.GoalContextConstraint;
import org.fortiss.af3.safetycases.constraint.GoalDevelopmentConstraint;
import org.fortiss.af3.safetycases.constraint.GoalJustificationConstraint;
import org.fortiss.af3.safetycases.constraint.GoalSupportingSolutionConstraint;
import org.fortiss.af3.safetycases.constraint.OptionEntityExistanceConstraint;
import org.fortiss.af3.safetycases.constraint.OptionEntityOptionsConstraint;
import org.fortiss.af3.safetycases.constraint.SolutionReferenceToEvidenceConstraint;
import org.fortiss.af3.safetycases.constraint.SolutionUpToDate;
import org.fortiss.af3.safetycases.constraint.StrategyContextConstraint;
import org.fortiss.af3.safetycases.constraint.StrategyJustificationConstraint;
import org.fortiss.af3.safetycases.constraint.StrategyResolvedToGoalConstraint;
import org.fortiss.af3.safetycases.constraint.StrategySubgoalsConstraint;
import org.fortiss.tooling.kernel.service.IConstraintService;
import org.osgi.framework.BundleContext;
/**
......@@ -56,32 +36,6 @@ public class AF3SafetyCasesActivator extends Plugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
// Activating the model constraints.
IConstraintService cs = IConstraintService.getInstance();
cs.registerConstraint(ArgumentElementBaseNameConstraint.class);
cs.registerConstraint(ArgumentElementBaseInterconnectionConstraint.class);
cs.registerConstraint(ArgumentElementInstantiatedConstraint.class);
cs.registerConstraint(AwayArgumentElementReferenceConstraint.class);
cs.registerConstraint(ConnectionIsOptionalConstraint.class);
cs.registerConstraint(ConnectionMultiplicityConstraint.class);
cs.registerConstraint(GoalSupportingSolutionConstraint.class);
cs.registerConstraint(OptionEntityExistanceConstraint.class);
cs.registerConstraint(OptionEntityOptionsConstraint.class);
cs.registerConstraint(SolutionReferenceToEvidenceConstraint.class);
cs.registerConstraint(StrategySubgoalsConstraint.class);
cs.registerConstraint(SolutionUpToDate.class);
cs.registerConstraint(ArgumentModuleInstantiatedConstraint.class);
cs.registerConstraint(StrategyContextConstraint.class);
cs.registerConstraint(GoalDevelopmentConstraint.class);
cs.registerConstraint(GoalContextConstraint.class);
cs.registerConstraint(GoalJustificationConstraint.class);
cs.registerConstraint(StrategyJustificationConstraint.class);
cs.registerConstraint(StrategyResolvedToGoalConstraint.class);
}
/** {@inheritDoc} */
......
ArgumentElementBaseInterconnectionConstraint.java cb170f832ee1f2eb9d70c1b47c6b70322aeddf9e GREEN
ArgumentElementBaseNameConstraint.java a93008dc124ecf751fe6783a0d292d756bed5957 GREEN
ArgumentElementInstantiatedConstraint.java de18f64551805be91aee086bea22609c55860013 GREEN
ArgumentModuleInstantiatedConstraint.java 58fcf81fc9e8198bf12728aca6c12ed7fb4e5be8 GREEN
AwayArgumentElementReferenceConstraint.java 57c9d22e19bdc728a6eeb779f26c9e3ca44f228a GREEN
ConnectionIsOptionalConstraint.java 03205a40b07618474de37b42f12d268ceb077b43 GREEN
ConnectionMultiplicityConstraint.java 2edee3025b6cd6926716f478bf0adb0f531b896b GREEN
GoalContextConstraint.java e2ca647f32ae4b2021f816b90cad22ec3da17bc0 GREEN
GoalDevelopmentConstraint.java debef782acfbe2a217b726de78aeeeaedf99813d GREEN
GoalJustificationConstraint.java d0cc7acd0ba6a2d9f0ebce4fd9c807ce7d2a6252 GREEN
GoalSupportingSolutionConstraint.java cfa6fc921783b2064332dead9bf42e1ce7e1522f GREEN
OptionEntityExistanceConstraint.java 69ee132c4a996f2440b1d59a3da3558cccc9ae2c GREEN
OptionEntityOptionsConstraint.java 59d194f5cf047fb2d491aa7b6cdf613308ee8dba GREEN
SafetyConstraintGroup.java 34c9d202494e98a344d0c878289d8077345fa317 GREEN
SolutionReferenceToEvidenceConstraint.java 3ea233ad9c08f058b7aca39931796eaa3a56c244 GREEN
SolutionTestCoverageOutdatedConstraint.java 0677e4208187b1f977e58c557cefed8fcddac63f GREEN
SolutionUpToDate.java cea2a857e7f37fc3900419d86c3a8db248d4a332 GREEN
StrategyContextConstraint.java 7bcadcfdec1dc2e4bf1e2056f3e3d5d119ee327b GREEN
StrategyJustificationConstraint.java de1191c3e10243504a25e101fe35fcb4c0db92e9 GREEN
StrategyResolvedToGoalConstraint.java aa23332687211ab3c15fed4d346947b3189a384b GREEN
StrategySubgoalsConstraint.java 8d8d0769efaf8aeacbf2ad8ff5206c5972c90b6d GREEN
/*-------------------------------------------------------------------------+
| Copyright 2014 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.safetycases.constraint;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.successIfTrue;
import org.fortiss.af3.safetycases.model.ArgumentElementBase;
import org.fortiss.af3.safetycases.model.ContextualElement;
import org.fortiss.af3.safetycases.model.SpinalElement;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
/**
* A constraint checker for {@link ArgumentElementBase}s. Checks if the inspected argument element
* is connected to the whole argumentation structure.
*
* @author carlan
*/
public class ArgumentElementBaseInterconnectionConstraint extends SafetyConstraintGroup {
/** {@inheritDoc} */
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
ArgumentElementBase argumentElement = (ArgumentElementBase)constrained;
return successIfTrue(!argumentElement.getConnectors().isEmpty());
}
/** {@inheritDoc} */
@Override
public boolean isApplicable(IConstrained constrained) {
return constrained instanceof ContextualElement || constrained instanceof SpinalElement;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.safetycases.constraint;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.successIfTrue;
import org.fortiss.af3.safetycases.model.ArgumentElementBase;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
/**
* A constraint checker for {@link ArgumentElementBase}s. Checks if the inspected argument element
* base has a designated GSN name.
*
* @author carlan
*/
public class ArgumentElementBaseNameConstraint extends SafetyConstraintGroup {
/** {@inheritDoc} */
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
ArgumentElementBase argumentElement = (ArgumentElementBase)constrained;
return successIfTrue(
argumentElement.getName() != null && !argumentElement.getName().trim().isEmpty() &&
!argumentElement.getName().trim().equals("null"));
}
/** {@inheritDoc} */
@Override
public boolean isApplicable(IConstrained constrained) {
return constrained instanceof ArgumentElementBase;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.safetycases.constraint;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.successIfTrue;
import org.fortiss.af3.safetycases.model.ArgumentElement;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
/**
* A constraint checker for {@link ArgumentElement}s. Checks if the inspected argument element is
* still to be instantiated.
*
* @author carlan
*/
public class ArgumentElementInstantiatedConstraint extends SafetyConstraintGroup {
/** {@inheritDoc} */
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
ArgumentElement argumentElement = (ArgumentElement)constrained;
return successIfTrue(argumentElement.isToBeInstantiated());
}
/** {@inheritDoc} */
@Override
public boolean isApplicable(IConstrained constrained) {
return constrained instanceof ArgumentElement;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.safetycases.constraint;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.successIfTrue;
import org.fortiss.af3.safetycases.model.ArgumentModule;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
/**
* A constraint checker for {@link ArgumentModule}s. Checks if the inspected argument module is
* still to be instantiated.
*/
public class ArgumentModuleInstantiatedConstraint extends SafetyConstraintGroup {
/** {@inheritDoc} */
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
ArgumentModule argumentModule = (ArgumentModule)constrained;
return successIfTrue(!argumentModule.getAddressedGoals().isEmpty());
}
/** {@inheritDoc} */
@Override
public boolean isApplicable(IConstrained constrained) {
return constrained instanceof ArgumentModule;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.safetycases.constraint;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.successIfTrue;
import org.fortiss.af3.safetycases.model.AwayArgumentElement;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
/**
* A constraint checker for {@link AwayArgumentElement}s. Checks if the inspected away argument
* element references an argument element located in another module.
*
* @author carlan
*/
public class AwayArgumentElementReferenceConstraint extends SafetyConstraintGroup {
/** {@inheritDoc} */
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
AwayArgumentElement awayArgumentElement = (AwayArgumentElement)constrained;
return successIfTrue(awayArgumentElement.getPointsTo() != null);
}
/** {@inheritDoc} */
@Override
public boolean isApplicable(IConstrained constrained) {
return constrained instanceof AwayArgumentElement;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.safetycases.constraint;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.successIfTrue;
import org.fortiss.af3.safetycases.model.SafetyCasesConnection;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
/**
* A constraint checker for {@link SafetyCasesConnection}s. Checks if the inspected argument element
* the given safety case connection is marked as optional.
*
* @author carlan
*/
public class ConnectionIsOptionalConstraint extends SafetyConstraintGroup {
/** {@inheritDoc} */
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
SafetyCasesConnection connection = (SafetyCasesConnection)constrained;
return successIfTrue(!connection.isOptional());
}
/** {@inheritDoc} */
@Override
public boolean isApplicable(IConstrained constrained) {
return constrained instanceof SafetyCasesConnection;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.safetycases.constraint;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.successIfTrue;
import org.fortiss.af3.safetycases.model.SafetyCasesConnection;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
/**
* A constraint checker for {@link SafetyCasesConnection}s. Checks if the inspected safety case
* connection is marked with multiplicity.
*
* @author carlan
*/
public class ConnectionMultiplicityConstraint extends SafetyConstraintGroup {
/** {@inheritDoc} */
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
SafetyCasesConnection connection = (SafetyCasesConnection)constrained;
return successIfTrue(connection.getMultiplicity() == 0);
}
/** {@inheritDoc} */
@Override
public boolean isApplicable(IConstrained constrained) {
return constrained instanceof SafetyCasesConnection;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.safetycases.constraint;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.successIfTrue;
import org.fortiss.af3.safetycases.model.ArgumentElement;
import org.fortiss.af3.safetycases.model.Context;
import org.fortiss.af3.safetycases.model.ExitConnector;
import org.fortiss.af3.safetycases.model.Goal;
import org.fortiss.tooling.base.model.element.IConnection;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
/**
* A constraint checker for {@link Goal}s. Checks if the inspected goal is
* explained by a {@link Context}.
*/
public class GoalContextConstraint extends SafetyConstraintGroup {
/** {@inheritDoc} */
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
Goal goal = (Goal)constrained;
return successIfTrue(goalIsExplained(goal));
}
/** {@inheritDoc} */
@Override
public boolean isApplicable(IConstrained constrained) {
return constrained instanceof Goal;
}
/**
* This method determines if the given {@link Goal} is explained by a goal.
*
* @param argEle
* The given argument element.
* @return True if the given goal is solved, false otherwise.
*/
private boolean goalIsExplained(ArgumentElement argEle) {
boolean isExplained = false;
for(ExitConnector exitConnector : argEle.getExitConnectors()) {
if(exitConnector.getOutgoing().size() != 0) {
// A connector may only have one outgoing connection.
IConnection connection = exitConnector.getOutgoing().get(0);
IHierarchicElement owner = connection.getTarget().getOwner();
if(owner instanceof Context) {
return true;
}
}
}
return isExplained;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.safetycases.constraint;
import static org.fortiss.tooling.kernel.utils.ConstraintsUtils.successIfTrue;
import org.fortiss.af3.safetycases.model.ArgumentElement;
import org.fortiss.af3.safetycases.model.ExitConnector;
import org.fortiss.af3.safetycases.model.Goal;
import org.fortiss.af3.safetycases.model.Solution;
import org.fortiss.af3.safetycases.model.Strategy;
import org.fortiss.tooling.base.model.element.IConnection;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.kernel.model.constraints.IConstrained;
import org.fortiss.tooling.kernel.model.constraints.IConstraintInstanceStatus;
/**
* A constraint checker for {@link Goal}s. Checks if the inspected goal is
* further developed by a strategy or solution.
*/
public class GoalDevelopmentConstraint extends SafetyConstraintGroup {
/** {@inheritDoc} */
@Override
public IConstraintInstanceStatus verify(IConstrained constrained) {
Goal goal = (Goal)constrained;
return successIfTrue(goalIsSolved(goal));
}
/** {@inheritDoc} */
@Override
public boolean isApplicable(IConstrained constrained) {
return constrained instanceof Goal;
}
/**
* This method determines if the given {@link Goal} is further developed by a strategy or a
* solution.
*
* @param argEle
* The given argument element.
* @return True if the given goal is solved, false otherwise.
*/
private boolean goalIsSolved(ArgumentElement argEle) {
boolean isSolved = false;
for(ExitConnector exitConnector : argEle.getExitConnectors()) {
if(exitConnector.getOutgoing().size() != 0) {
// A connector may only have one outgoing connection.
IConnection connection = exitConnector.getOutgoing().get(0);
IHierarchicElement owner = connection.getTarget().getOwner();
if(owner instanceof Strategy || owner instanceof Solution) {
return true;
}
}
}
return isSolved;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |