Skip to content
Snippets Groups Projects
Commit b41ae985 authored by Andreas Bayha's avatar Andreas Bayha
Browse files

Merge branch '4328' into 'master'

4328

Closes af3#4328

See merge request !214
parents 124a12d5 c1bf57af
No related branches found
No related tags found
1 merge request!2144328
OptimizedProductLineAnalysisBase.java 35a40c860cc8a9774a894600935c1ae89a5681a0 GREEN
OptimizedProductLineTranslation.java 415361dd35a04db219b06a1e40079452d7079b34 GREEN
ProductLineAnalysisBase.java 891235573a2102279256585f8dc31934240b8dc1 GREEN
ProductLineTranslationBase.java f24fb9343003c025bc4d2292d15bca543a548749 GREEN
/*-------------------------------------------------------------------------+
| Copyright 2022 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.tooling.ext.variability.analysis;
import static java.util.Arrays.asList;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.layout.LayoutPackage;
import org.fortiss.tooling.kernel.model.IProjectRootElement;
import org.fortiss.variability.analysis.GenericProductLineAnalysis;
import org.fortiss.variability.analysis.GenericProductLineTranslation;
import org.fortiss.variability.analysis.ProductLineConstraintViolation;
/**
* Base class for all tooling kernel based product-line analyses.
*
* @deprecated
*
* TODO: To be removed completely #4328 (https://git.fortiss.org/af3/af3/-/issues/4328)
*
* @author bayha
*/
public abstract class ProductLineAnalysisBase extends GenericProductLineAnalysis {
/**
* Constructor.
*/
public ProductLineAnalysisBase(EObject model) {
this(model, new ProductLineTranslationBase());
((ProductLineTranslationBase)translation)
.addExcludedClasses(asList(LayoutPackage.eINSTANCE.getILayoutData()));
}
/**
* Constructor.
*/
protected ProductLineAnalysisBase(EObject model, GenericProductLineTranslation translation) {
super(model, translation);
}
/** {@inheritDoc} */
@Override
public List<ProductLineConstraintViolation> doCheck() {
List<Class<? extends IProjectRootElement>> scope = getScope();
Collection<EClass> excludedClasses = new ArrayList<EClass>();
for(IProjectRootElement rootElement : pickInstanceOf(IProjectRootElement.class,
model.eContents())) {
for(Class<?> c : scope) {
if(!c.isAssignableFrom(rootElement.getClass())) {
excludedClasses.add(rootElement.eClass());
}
}
}
((ProductLineTranslationBase)translation).addExcludedClasses(excludedClasses);
return super.doCheck();
}
/**
* Determines the scope of this analysis. I.e. which subclasses of {@link IProjectRootElement}
* are translated and included to the check.
*
* The default implementation will translate all {@link IProjectRootElement}.
* This method might be overwritten in order to optimize the analysis and runtime.
*
* @return A {@link List} of {@link Class} elements for subclasses of
* {@link IProjectRootElement}.
*/
protected List<Class<? extends IProjectRootElement>> getScope() {
return asList(IProjectRootElement.class);
}
}
/*-------------------------------------------------------------------------+
| Copyright 2022 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.tooling.ext.variability.analysis;
import static org.fortiss.tooling.ext.variability.util.VariabilityUtils.calculateGlobalPresenceCondition;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.element.IModelElementSpecification;
import org.fortiss.variability.analysis.GenericProductLineTranslation;
import org.fortiss.variability.model.presence.PresenceConditionTerm;
/**
* Adjusts the generic implementation of the translation to the variation point translation with
* {@link IModelElementSpecification}s.
*
* @deprecated
*
* TODO: To be removed completely #4328 (https://git.fortiss.org/af3/af3/-/issues/4328)
*
* @author bayha
*/
public class ProductLineTranslationBase extends GenericProductLineTranslation {
/** {@inheritDoc} */
@Override
protected PresenceConditionTerm getGlobalPresenceConditionForEObject(EObject eo) {
return calculateGlobalPresenceCondition(eo);
}
}
......@@ -2,7 +2,6 @@ BucketSetMap.java 665a28c80a9693b9b9e31b7ebe59f2de4195d56c GREEN
DualKeyMap.java 75fbe85a54e5a655aaf67108ae004f98ed2879d8 GREEN
EMFProductLineTranslation.java b590fbf053c21d9e6b0ee6d0818779e4adb1fe0b GREEN
GenericProductLineAnalysis.java 1026cd6d7d0286c0f2402c5918d83cf7dc84407b GREEN
GenericProductLineTranslation.java 2df1a1c1363cb93b6f498308e575833cf705e2fd GREEN
IProductLineConstraint.java 1b0e1231cc578a6e7e544441ac33533b4feafeb1 GREEN
IProductLineTranslation.java 733dae03e2baae237b6f0b33f0dd618a4f47cf73 GREEN
ProductLineConstraintBase.java 04097c7c31367fdd11a054ba2b259a0535a313f4 GREEN
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment