Class CutNonEditedSubtrees<L extends Label>
java.lang.Object
org.variantsync.diffdetective.variation.diff.transform.CutNonEditedSubtrees<L>
- All Implemented Interfaces:
VariationDiffTransformer<L>
,VariationDiffVisitor<L>
public class CutNonEditedSubtrees<L extends Label>
extends Object
implements VariationDiffTransformer<L>, VariationDiffVisitor<L>
This transformer removes all subtrees from a VariationDiff that are non-edited.
A subtree is unedited, if all nodes in it are unchanged and all nodes have the same
before and after parent.
Such subtrees just model state but not an edit and thus are removed from the validation
of our edit classes in our ESEC/FSE'22 paper.
- Author:
- Paul Bittner
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <L extends Label>
voidgenericTransform
(boolean keepDummy, VariationDiff<L> variationDiff) static <L extends Label>
voidgenericTransform
(VariationDiff<L> variationDiff) toString()
void
transform
(VariationDiff<L> variationDiff) Apply a transformation to the given VariationDiff inplace.void
visit
(VariationDiffTraversal<L> traversal, DiffNode<L> subtree) Invoked by a traversal when a node is visited.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.variantsync.diffdetective.variation.diff.transform.VariationDiffTransformer
getDependencies
-
Field Details
-
keepDummy
private final boolean keepDummy
-
-
Constructor Details
-
CutNonEditedSubtrees
public CutNonEditedSubtrees(boolean keepDummy) - Parameters:
keepDummy
- The transformation will keep the root of any removed subtree if this is true. Otherwise the entire subtree is removed. Default is false inCutNonEditedSubtrees()
.
-
CutNonEditedSubtrees
public CutNonEditedSubtrees()
-
-
Method Details
-
genericTransform
-
genericTransform
public static <L extends Label> void genericTransform(boolean keepDummy, VariationDiff<L> variationDiff) -
transform
Description copied from interface:VariationDiffTransformer
Apply a transformation to the given VariationDiff inplace. The given tree will be changed.- Specified by:
transform
in interfaceVariationDiffTransformer<L extends Label>
- Parameters:
variationDiff
- The VariationDiff to transform.
-
visit
Description copied from interface:VariationDiffVisitor
Invoked by a traversal when a node is visited. The traversal might be continued by invoking respective methods on the given traversal object again. However, any node that was already visited, will not be visited again.- Specified by:
visit
in interfaceVariationDiffVisitor<L extends Label>
- Parameters:
traversal
- The current traversal. May be instructed on how to continue traversal.subtree
- The node that is currently visited.- See Also:
-
toString
-