File tree Expand file tree Collapse file tree
src/main/java/org/variantsync/diffdetective/variation/diff Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424import org .variantsync .diffdetective .variation .diff .traverse .VariationDiffTraversal ;
2525import org .variantsync .diffdetective .variation .diff .traverse .VariationDiffVisitor ;
2626import org .variantsync .diffdetective .variation .tree .VariationTree ;
27+ import org .variantsync .diffdetective .util .fide .FixTrueFalse ;
2728import org .variantsync .functjonal .Cast ;
2829import org .variantsync .functjonal .Result ;
2930
@@ -374,6 +375,25 @@ public int count(final Predicate<DiffNode<L>> nodesToCount) {
374375 return count .get ();
375376 }
376377
378+
379+ /**
380+ * Returns all variable names occurring in annotations (i.e., formulas of mapping nodes) in this variation diff.
381+ * This method is deterministic: It will return the feature names always in the same order, assuming the variation diff is not changed inbetween.
382+ * @return A list of every occuring feature name.
383+ */
384+ public List <String > computeAllFeatureNames () {
385+ List <String > features = new ArrayList <>();
386+ forAll (node -> {
387+ if (node .isConditionalAnnotation ()) {
388+ features .addAll (node .getFormula ().getUniqueContainedFeatures ());
389+ }
390+ });
391+ // Since FeatureIDE falsely reports constants "True" and "False" as feature names, we have to remove them from the resulting set.
392+ features .removeIf (FixTrueFalse ::isTrueLiteral );
393+ features .removeIf (FixTrueFalse ::isFalseLiteral );
394+ return features ;
395+ }
396+
377397 /**
378398 * Sets the source of this VariationDiff.
379399 * @see VariationDiffSource
You can’t perform that action at this time.
0 commit comments