Commit 3858c473 authored by Alexander Diewald's avatar Alexander Diewald
Browse files

Platform Synthesis: Remove transformation-only specifications fully

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

Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent b4926945
PlatformConnectorInstanceConverter.java 073e050ad673f41e9d012de01c1aee6fdd04e4ce GREEN
PlatformExecUnitInstantiationConverter.java a0426a3ad7d2efac9b0f73ddb76ee2060d4101e5 GREEN
PlatformExecUnitInstantiationConverter.java 6a003e2fbc3fc115ad39578c87ddd64f23da9593 YELLOW
PlatformTransmissionConnectionConverter.java 365a2fb563e4ed36a1b159dfa3bcce47216a935c GREEN
......@@ -16,7 +16,7 @@
package org.fortiss.af3.exploration.solutionconverter.platform;
import static java.util.Arrays.asList;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
import static org.fortiss.af3.exploration.util.DSESolutionConversionUtils.getAndRemoveSpec;
import java.util.ArrayList;
import java.util.Collection;
......@@ -72,8 +72,7 @@ public class PlatformExecUnitInstantiationConverter
for(ExecutionUnit instExecUnit : fromSuperSet.getEntries()) {
// Fetch the template element such that it can be removed after the instances were
// added.
InstanceOfElement instSpec =
pickFirstInstanceOf(InstanceOfElement.class, instExecUnit.getSpecifications());
InstanceOfElement instSpec = getAndRemoveSpec(instExecUnit, InstanceOfElement.class);
ExecutionUnit templateExecUnit = (ExecutionUnit)instSpec.getTemplateElement();
templateExecUnits.add(templateExecUnit);
......
DSEProjectModelElementFactory.java a56e2cd564383726898336469ebc3203186e992f GREEN
DSESolutionConversionUtils.java d97459e189370cbfc202201832ed060e25564607 GREEN
DSESolutionConversionUtils.java a6ccbba92864c653d1518a92455e87c17f7cc72b YELLOW
DSMLModelElementFactory.java 24b8cf9c900e948dcc71eb2a7fa26232baa6f7a5 GREEN
DSMLUtils.java c07eeef09787cea9db98533d346e3e384a232593 GREEN
ExplorationModelElementFactory.java bb48b2d09b92efcb1b2d3e382555089bb7ed5db5 GREEN
......
......@@ -19,6 +19,7 @@ import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.showError;
import org.fortiss.af3.exploration.model.specification.ContainedByElement;
import org.fortiss.af3.exploration.model.specification.IVolatileModelElementSpecification;
import org.fortiss.af3.exploration.solutionconverter.IDSESolutionConverter;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.element.IModelElement;
......@@ -36,18 +37,31 @@ public class DSESolutionConversionUtils {
// Prevent instantiation.
}
/**
* Returns the given {@link IModelElementSpecification} if it is attached to the given
* {@link IModelElement} and deletes it. If no such {@link IModelElementSpecification} exists,
* {@code null} is returned.
*/
public static <T extends IVolatileModelElementSpecification> T
getAndRemoveSpec(IModelElement element, Class<? extends T> specType) {
T spec = pickFirstInstanceOf(specType, element.getSpecifications());
if(spec == null) {
return null;
}
element.getSpecifications().remove(spec);
return spec;
}
/**
* Returns the container element referenced by the {@link ContainedByElement}
* {@link IModelElementSpecification} and removes the {@link IModelElementSpecification} form
* the element. Returns {@code null} if no such {@link IModelElementSpecification} is found.
*/
public static IHierarchicElement getContainedByAndRemoveSpec(IModelElement element) {
ContainedByElement containmentSpec =
pickFirstInstanceOf(ContainedByElement.class, element.getSpecifications());
ContainedByElement containmentSpec = getAndRemoveSpec(element, ContainedByElement.class);
if(containmentSpec == null) {
return null;
}
element.getSpecifications().remove(containmentSpec);
return containmentSpec.getFutureContainerRef();
}
......
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