@@ -494,7 +494,7 @@ public String toString() {
494494 * Create a {@link DiffTree} by matching nodes between {@code before} and {@code after} with the
495495 * default GumTree matcher.
496496 *
497- * @see compareUsingMatching(VariationTree, VariationTree , Matcher)
497+ * @see compareUsingMatching(VariationNode, VariationNode , Matcher)
498498 */
499499 public static DiffTree compareUsingMatching (VariationTree before , VariationTree after ) {
500500 DiffNode root = compareUsingMatching (
@@ -507,13 +507,14 @@ public static DiffTree compareUsingMatching(VariationTree before, VariationTree
507507 }
508508
509509 /**
510- * Create a {@link DiffTree} by matching nodes between {@code before} and {@code after} with
511- * {@code matcher}.
510+ * Create a {@link DiffNode} by matching nodes between {@code before} and {@code after} with
511+ * {@code matcher}. The arguments of this function aren't modified (note the
512+ * {@link compareUsingMatching(DiffNode, VariationNode, Matcher) overload} which modifies
513+ * {@code before} in-place.
512514 *
513- * Note: There are currently no guarantees about the line numbers. But it is guaranteed that
514- * {@link DiffNode#getID} is unique.
515- *
516- * @param TODO
515+ * @param before the variation tree before an edit
516+ * @param after the variation tree after an edit
517+ * @see compareUsingMatching(DiffNode, VariationNode, Matcher)
517518 */
518519 public static <A extends VariationNode <A >, B extends VariationNode <B >> DiffNode compareUsingMatching (
519520 VariationNode <A > before ,
@@ -523,6 +524,17 @@ public static <A extends VariationNode<A>, B extends VariationNode<B>> DiffNode
523524 return compareUsingMatching (DiffNode .unchanged (before ), after , matcher );
524525 }
525526
527+ /**
528+ * Create a {@link DiffNode} by matching nodes between {@code before} and {@code after} with
529+ * {@code matcher}. The result of this function is {@code before} which is modified in-place. In
530+ * contrast, {@code after} is kept in tact.
531+ *
532+ * Note: There are currently no guarantees about the line numbers. But it is guaranteed that
533+ * {@link DiffNode#getID} is unique.
534+ *
535+ * @param before the variation tree before an edit
536+ * @param after the variation tree after an edit
537+ */
526538 public static <B extends VariationNode <B >> DiffNode compareUsingMatching (
527539 DiffNode before ,
528540 VariationNode <B > after ,
@@ -591,10 +603,18 @@ private static void addUnmapped(MappingStore mappings, DiffNode parent, WrappedV
591603 }
592604 }
593605
606+ /**
607+ * Run {@code matcher} on the implicit matching of this variation diff and update this variation
608+ * tree in-place to reflect the new matching.
609+ */
594610 public void improveMatching (Matcher matcher ) {
595611 improveMatching (getRoot (), matcher );
596612 }
597613
614+ /**
615+ * Run {@code matcher} on the matching extracted from {@code tree} and modify {@code tree}
616+ * in-place to reflect the new matching.
617+ */
598618 public static DiffNode improveMatching (DiffNode tree , Matcher matcher ) {
599619 var src = new WrappedDiffTree (tree , BEFORE );
600620 var dst = new WrappedDiffTree (tree , AFTER );
0 commit comments