Class GumTreeDiff
java.lang.Object
org.variantsync.diffdetective.variation.diff.construction.GumTreeDiff
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static <L extends Label>
voidaddUnmapped(com.github.gumtreediff.matchers.MappingStore mappings, DiffNode<L> parent, VariationTreeAdapter<L> afterNode) Recursively addsafterNodetoparentreusing matched nodes.static <B extends VariationNode<B,L>, L extends Label>
DiffNode<L> diffUsingMatching(DiffNode<L> before, VariationNode<B, L> after, com.github.gumtreediff.matchers.Matcher matcher) static <A extends VariationNode<A,L>, B extends VariationNode<B, L>, L extends Label>
DiffNode<L> diffUsingMatching(VariationNode<A, L> before, VariationNode<B, L> after, com.github.gumtreediff.matchers.Matcher matcher) static <L extends Label>
VariationDiff<L> diffUsingMatching(VariationTree<L> before, VariationTree<L> after) static <L extends Label>
VariationDiff<L> diffUsingMatching(VariationTree<L> before, VariationTree<L> after, com.github.gumtreediff.matchers.Matcher matcher) private static voidensureMapping(com.github.gumtreediff.matchers.MappingStore matching, com.github.gumtreediff.tree.Tree src, com.github.gumtreediff.tree.Tree dst) Add a mapping betweensrcanddst.private static <L extends Label>
voidextractMatching(VariationDiffAdapter<L> src, VariationDiffAdapter<L> dst, com.github.gumtreediff.matchers.MappingStore result) Makes the implicit matching of aVariationDiffexplicit.improveMatching(DiffNode<L> tree, com.github.gumtreediff.matchers.Matcher matcher) Runmatcheron the matching extracted fromtreeand modifytreein-place to reflect the new matching.private static <L extends Label>
voidremoveUnmapped(com.github.gumtreediff.matchers.MappingStore mappings, VariationDiffAdapter<L> root) Remove all nodes from theBEFOREprojection which aren't part of a mapping.
-
Constructor Details
-
GumTreeDiff
public GumTreeDiff()
-
-
Method Details
-
diffUsingMatching
public static <L extends Label> VariationDiff<L> diffUsingMatching(VariationTree<L> before, VariationTree<L> after) - See Also:
-
diffUsingMatching
public static <L extends Label> VariationDiff<L> diffUsingMatching(VariationTree<L> before, VariationTree<L> after, com.github.gumtreediff.matchers.Matcher matcher) -
diffUsingMatching
public static <A extends VariationNode<A,L>, DiffNode<L> diffUsingMatchingB extends VariationNode<B, L>, L extends Label> (VariationNode<A, L> before, VariationNode<B, L> after, com.github.gumtreediff.matchers.Matcher matcher) Create aDiffNodeby matching nodes betweenbeforeandafterwithmatcher. The arguments of this function aren't modified (note theoverloadwhich modifiesbeforein-place.- Parameters:
before- the variation tree before an editafter- the variation tree after an edit- See Also:
-
diffUsingMatching
public static <B extends VariationNode<B,L>, DiffNode<L> diffUsingMatchingL extends Label> (DiffNode<L> before, VariationNode<B, L> after, com.github.gumtreediff.matchers.Matcher matcher) Create aDiffNodeby matching nodes betweenbeforeandafterwithmatcher. The result of this function isbeforewhich is modified in-place. In contrast,afteris kept in tact. Warning: Modifications tobeforeshouldn't concurrently modifyafter. Note: There are currently no guarantees about the line numbers. But it is guaranteed thatDiffNode.getID()is unique.- Parameters:
before- the variation tree before an editafter- the variation tree after an edit- See Also:
-
removeUnmapped
private static <L extends Label> void removeUnmapped(com.github.gumtreediff.matchers.MappingStore mappings, VariationDiffAdapter<L> root) Remove all nodes from theBEFOREprojection which aren't part of a mapping.- Parameters:
mappings- the matching between theBEFOREprojection ofrootsome variation treeroot- the variation diff whose before projection is modified
-
addUnmapped
private static <L extends Label> void addUnmapped(com.github.gumtreediff.matchers.MappingStore mappings, DiffNode<L> parent, VariationTreeAdapter<L> afterNode) Recursively addsafterNodetoparentreusing matched nodes. The variation diffparentis modified in-place such that itsAFTERprojection contains a child equivalent toafterNodewhich shares matched nodes with theBEFOREprojection ofparent.- Parameters:
mappings- the matching between theBEFOREprojection ofrootand a variation tree containingafterNodeparent- the variation diff whoseAFTERprojection is modifiedafterNode- a desired child ofparent'sAFTERprojection
-
improveMatching
public static <L extends Label> DiffNode<L> improveMatching(DiffNode<L> tree, com.github.gumtreediff.matchers.Matcher matcher) Runmatcheron the matching extracted fromtreeand modifytreein-place to reflect the new matching. This is equivalent todiffUsingMatchingexcept that the existing implicit matching isextractedand used as basis for the new matching. Hence, this method is mostly an optimisation to avoid a copy of theAFTERprojection oftree.- See Also:
-
extractMatching
private static <L extends Label> void extractMatching(VariationDiffAdapter<L> src, VariationDiffAdapter<L> dst, com.github.gumtreediff.matchers.MappingStore result) Makes the implicit matching of aVariationDiffexplicit.- Parameters:
src- the source nodes of the matching, must be of the sameVariationDiffasdst.dst- the destination nodes of the matching, must be of the sameVariationDiffassrcresult- the destination where the matching betweensrcand is added.
-
ensureMapping
private static void ensureMapping(com.github.gumtreediff.matchers.MappingStore matching, com.github.gumtreediff.tree.Tree src, com.github.gumtreediff.tree.Tree dst) Add a mapping betweensrcanddst. In casesrcordstare mapped to some other nodes, these mappings are removed.
-