Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • af3/kernel
  • diewald/kernel
2 results
Show changes
Commits on Source (6)
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());
}
}