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

Merge branch '4278' into 'master'

4278

Closes af3#4278

See merge request !188
parents 606b1118 c9280e68
No related branches found
No related tags found
1 merge request!1884278
FeatureModelTransformationUtils.java b38702296dcb48ff311b382bb9c05d2590e2dfac GREEN
Pair.java 2dfd7dc65f7b9ba09a120f1a6058d1e8e9556a37 GREEN
VariabilityUtils.java 66a727bdb58715dc7b1bd0ce320bd647f374f7d6 GREEN
VariabilityUtils.java e4a05e235eaf8585676fe1fe7971f4b759d1a64f GREEN
VariabilityUtilsInternal.java 9c781a47513bb0c4ddcd13be1c27d62b70f25998 GREEN
......@@ -17,6 +17,7 @@ package org.fortiss.variability.util;
import static java.util.stream.Collectors.toList;
import static org.fortiss.variability.model.VariabilityModelElementFactory.createFeatureConfigurationForFeature;
import static org.fortiss.variability.util.VariabilityUtilsInternal.getAllElementsFromSameContainmentTree;
import static org.fortiss.variability.util.VariabilityUtilsInternal.getAllReferences;
import static org.fortiss.variability.util.VariabilityUtilsInternal.getParentsWithType;
......@@ -27,6 +28,7 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.variability.model.features.AbstractCompositionalFeature;
import org.fortiss.variability.model.features.AbstractCrossFeatureConstraint;
import org.fortiss.variability.model.features.AbstractFeature;
......@@ -192,4 +194,22 @@ public class VariabilityUtils {
features.removeAll(getParentsWithType(constraint, AbstractFeature.class));
return features;
}
/**
* Retrieves all literals with the given name from the whole containment tree in which 'context'
* is contained in.
*
* Note, that the resulting {@link List} should usually contain at most one literal, as literal
* names should be unique.
*
* @param context
* Any {@link EObject} in the containment tree to search in.
* @param name
* The name of the literal which is searched.
* @return A {@link List} of all literals with the given name.
*/
public static List<ILiteralReferencable> getLiteralsWithName(EObject context, String name) {
return getAllElementsFromSameContainmentTree(context, ILiteralReferencable.class).stream()
.filter(l -> l.getName().equals(name)).collect(toList());
}
}
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