|
4 | 4 | import com.github.gumtreediff.matchers.Matcher; |
5 | 5 | import com.github.gumtreediff.matchers.Matchers; |
6 | 6 | import com.github.gumtreediff.tree.Tree; |
| 7 | +import com.github.gumtreediff.matchers.heuristic.*; |
| 8 | +import com.github.gumtreediff.matchers.heuristic.cd.*; |
| 9 | +import com.github.gumtreediff.matchers.*; |
| 10 | +import com.github.gumtreediff.matchers.optimizations.*; |
7 | 11 |
|
8 | 12 | import org.variantsync.diffdetective.diff.text.DiffLineNumber; |
9 | 13 | import org.variantsync.diffdetective.gumtree.VariationDiffAdapter; |
|
18 | 22 | import org.variantsync.diffdetective.variation.tree.VariationTree; |
19 | 23 | import org.variantsync.functjonal.Cast; |
20 | 24 |
|
21 | | -import java.util.HashMap; |
22 | | -import java.util.Map; |
| 25 | +import java.util.*; |
23 | 26 |
|
24 | 27 | import static org.variantsync.diffdetective.variation.diff.DiffType.ADD; |
25 | 28 | import static org.variantsync.diffdetective.variation.diff.DiffType.REM; |
@@ -86,14 +89,26 @@ public static <A extends VariationNode<A, L>, B extends VariationNode<B, L>, L e |
86 | 89 | public static <B extends VariationNode<B, L>, L extends Label> DiffNode<L> diffUsingMatching( |
87 | 90 | DiffNode<L> before, |
88 | 91 | VariationNode<B, L> after, |
89 | | - Matcher matcher |
| 92 | + Matcher matcherOld |
90 | 93 | ) { |
91 | 94 | var src = new VariationDiffAdapter<L>(before, BEFORE); |
92 | 95 | var dst = new VariationTreeAdapter<L>(after); |
93 | 96 |
|
94 | | - MappingStore matching = matcher.match(src, dst); |
95 | | - for (var mapping : matching) { |
96 | | - System.out.println(mapping.first + " <-> " + mapping.second); |
| 97 | + MappingStore matching = new MappingStore(src, dst); |
| 98 | + List<Matcher> matchers = List.of(new IdenticalSubtreeMatcherThetaA(), new ChangeDistillerParallelLeavesMatcher(), |
| 99 | + new ChangeDistillerBottomUpMatcher(), new LcsOptMatcherThetaB(), new UnmappedLeavesMatcherThetaC(), |
| 100 | + new InnerNodesMatcherThetaD(), new LeafMoveMatcherThetaE(), new CrossMoveMatcherThetaF()); |
| 101 | + for (var matcher : matchers) { |
| 102 | + matcher.match(src, dst, matching); |
| 103 | + |
| 104 | + System.out.format("Matching after %s\n", matcher.getClass().getName()); |
| 105 | + for (var mapping : matching) { |
| 106 | + System.out.println(mapping.first + " <-> " + mapping.second); |
| 107 | + } |
| 108 | + matching.assertConsistency(); |
| 109 | + System.out.println(); |
| 110 | + System.out.println(); |
| 111 | + System.out.println(); |
97 | 112 | } |
98 | 113 |
|
99 | 114 | // We assume that the root nodes are matched. |
|
0 commit comments