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 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 in CutNonEditedSubtrees().
    • CutNonEditedSubtrees

      public CutNonEditedSubtrees()
  • Method Details

    • genericTransform

      public static <L extends Label> void genericTransform(VariationDiff<L> variationDiff)
    • genericTransform

      public static <L extends Label> void genericTransform(boolean keepDummy, VariationDiff<L> variationDiff)
    • transform

      public void transform(VariationDiff<L> variationDiff)
      Description copied from interface: VariationDiffTransformer
      Apply a transformation to the given VariationDiff inplace. The given tree will be changed.
      Specified by:
      transform in interface VariationDiffTransformer<L extends Label>
      Parameters:
      variationDiff - The VariationDiff to transform.
    • visit

      public void visit(VariationDiffTraversal<L> traversal, DiffNode<L> subtree)
      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 interface VariationDiffVisitor<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

      public String toString()
      Overrides:
      toString in class Object