diff --git a/flamapy/metamodels/fm_metamodel/models/feature_model.py b/flamapy/metamodels/fm_metamodel/models/feature_model.py index 4909165..5f666aa 100644 --- a/flamapy/metamodels/fm_metamodel/models/feature_model.py +++ b/flamapy/metamodels/fm_metamodel/models/feature_model.py @@ -214,6 +214,13 @@ def get_features(self) -> list[str]: stack.append(node.left) return list(features) + def is_single_feature_constraint(self) -> bool: + """Return true if the constraint is a single feature or its negation.""" + root_op = self._ast.root + return (root_op.is_term() or + root_op.is_unary_op() and root_op.left.is_term() or + root_op.is_unary_op() and root_op.right.is_term()) + def is_simple_constraint(self) -> bool: """Return true if the constraint is a simple constraint (requires or excludes).""" return self.is_requires_constraint() or self.is_excludes_constraint()