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

Merge remote-tracking branch 'remotes/origin/master' into 4257

parents 88dada09 6e0ed0cc
No related branches found
No related tags found
1 merge request!1914257
Pipeline #38473 passed
Pipeline: maven-releng

#38474

    FeatureModelTransformationUtils.java b38702296dcb48ff311b382bb9c05d2590e2dfac GREEN
    Pair.java 2dfd7dc65f7b9ba09a120f1a6058d1e8e9556a37 GREEN
    VariabilityUtils.java 13eea14d9d8683d8c566b6f355cece77eaf916dd GREEN
    VariabilityUtils.java 3e57a37ced6396076c71227aea8de534381b6ace 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;
    ......@@ -193,4 +195,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