Skip to content

Commit

Permalink
Add check for single feature constraints not covered by simple or com…
Browse files Browse the repository at this point in the history
…plex
  • Loading branch information
jmhorcas committed Oct 4, 2024
1 parent ecc876b commit ed9f087
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flamapy/metamodels/fm_metamodel/models/feature_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ed9f087

Please sign in to comment.