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

Merge branch '4257' into 'master'

4257

Closes af3#4257

See merge request !191
parents 6e0ed0cc a71eff00
No related branches found
No related tags found
1 merge request!1914257
VariabilityUtils.java 6f2ffd231c27f5f7ab8c62d05350c0a92392eaf8 GREEN VariabilityUtils.java fcaa561bdbe6bd9d6fff4312086a6c97177301f8 GREEN
...@@ -18,6 +18,8 @@ package org.fortiss.tooling.ext.variability.util; ...@@ -18,6 +18,8 @@ package org.fortiss.tooling.ext.variability.util;
import static org.fortiss.tooling.ext.variability.model.VariabilityModelElementFactory.createOptionalVariationPointSpecification; import static org.fortiss.tooling.ext.variability.model.VariabilityModelElementFactory.createOptionalVariationPointSpecification;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstChildWithType; import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstChildWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf; import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
import static org.fortiss.variability.util.VariabilityUtils.FEATURE_LITERAL_LEGAL_CHAR_REGEX;
import static org.fortiss.variability.util.VariabilityUtils.PRESENCE_CONDITIONS_KEYWORDS;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.element.IModelElement; import org.fortiss.tooling.base.model.element.IModelElement;
...@@ -35,6 +37,12 @@ import org.fortiss.variability.presence.compiler.PresenceConditionCompiler; ...@@ -35,6 +37,12 @@ import org.fortiss.variability.presence.compiler.PresenceConditionCompiler;
*/ */
public class VariabilityUtils { public class VariabilityUtils {
/** Failure message for incorrect Feature names. */
public final static String FEATURE_NAME_ERROR_MSG = "Feature names may only contain " +
FEATURE_LITERAL_LEGAL_CHAR_REGEX.replaceAll("\\\\", "") +
", must not be empty and must be different from the keywords " +
PRESENCE_CONDITIONS_KEYWORDS.replaceAll("\\|", ", ") + ".";
/** /**
* Checks for the given {@link EObject} whether it has been deactivated by a * Checks for the given {@link EObject} whether it has been deactivated by a
* {@link DeactivationSpecification}. * {@link DeactivationSpecification}.
......
FeatureModelTransformationUtils.java b38702296dcb48ff311b382bb9c05d2590e2dfac GREEN FeatureModelTransformationUtils.java b38702296dcb48ff311b382bb9c05d2590e2dfac GREEN
Pair.java 2dfd7dc65f7b9ba09a120f1a6058d1e8e9556a37 GREEN Pair.java 2dfd7dc65f7b9ba09a120f1a6058d1e8e9556a37 GREEN
VariabilityUtils.java e4a05e235eaf8585676fe1fe7971f4b759d1a64f GREEN VariabilityUtils.java 3e57a37ced6396076c71227aea8de534381b6ace GREEN
VariabilityUtilsInternal.java 9c781a47513bb0c4ddcd13be1c27d62b70f25998 GREEN VariabilityUtilsInternal.java 9c781a47513bb0c4ddcd13be1c27d62b70f25998 GREEN
...@@ -165,14 +165,15 @@ public class VariabilityUtils { ...@@ -165,14 +165,15 @@ public class VariabilityUtils {
* *
* @param literalName * @param literalName
* {@link String} with the name to be checked. * {@link String} with the name to be checked.
* @return Whether the given name is compatible with the presence condition systax. * @return Whether the given name is compatible with the presence condition syntax.
*/ */
public static boolean isNameLegalInPresenceCondition(String literalName) { public static boolean isNameLegalInPresenceCondition(String literalName) {
if(literalName.matches(PRESENCE_CONDITIONS_KEYWORDS)) { if(literalName.matches(PRESENCE_CONDITIONS_KEYWORDS)) {
return false; return false;
} }
return literalName.matches(FEATURE_LITERAL_LEGAL_CHAR_REGEX + "*"); // Add "+" to regex to make only non-empty names legal (instead of "*")
return literalName.matches(FEATURE_LITERAL_LEGAL_CHAR_REGEX + "+");
} }
/** /**
......
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