Class EliminateEmptyAlternatives
java.lang.Object
org.variantsync.diffdetective.variation.diff.transform.EliminateEmptyAlternatives
- All Implemented Interfaces:
Transformer<VariationTree<DiffLinesLabel>>
public class EliminateEmptyAlternatives
extends Object
implements Transformer<VariationTree<DiffLinesLabel>>
This transformer simplifies annotations such that empty alternatives do not appear in choices.
This means, that nestings without any siblings such as
#if A
#elif B
#elif C
#else
foo
#endif
will be simplified to
#if !A && !B && !C
foo
#endif
Annotations without any children also get eliminated.- Author:
- Paul Bittner
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidelim(VariationTreeNode<DiffLinesLabel> subtree) voidtransform(VariationTree<DiffLinesLabel> tree) Apply a transformation to the given Object inplace.private static DiffLinesLabelupdatedLabel(DiffLinesLabel l, org.prop4j.Node formula) Creates a copy of the given label but where the formula is set to the given formula.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.variantsync.diffdetective.variation.diff.transform.Transformer
getDependencies
-
Constructor Details
-
EliminateEmptyAlternatives
public EliminateEmptyAlternatives()
-
-
Method Details
-
updatedLabel
Creates a copy of the given label but where the formula is set to the given formula. This method also updates the text in the DiffLinesLabel accordingly so that the text is consistent with the formula. This method assumes that the label has at least one line of text, otherwise the given label could not have a formula. -
elim
-
transform
Description copied from interface:TransformerApply a transformation to the given Object inplace. The object will be changed.- Specified by:
transformin interfaceTransformer<VariationTree<DiffLinesLabel>>- Parameters:
tree- The T object to transform.
-