Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unified Interface for Differencers #146

Open
pmbittner opened this issue Jul 11, 2024 · 0 comments
Open

Unified Interface for Differencers #146

pmbittner opened this issue Jul 11, 2024 · 0 comments

Comments

@pmbittner
Copy link
Member

Currently, accessing different differencers is a bit messy:

VariationTree<DiffLinesLabel> s1 = VariationTree.fromFile(pathBefore);
VariationTree<DiffLinesLabel> s2 = VariationTree.fromFile(pathAfter);

VariationDiff<DiffLinesLabel> diffViaGit, diffViaGumTree, diffViaTrueDiff;
diffViaGit = VariationDiff.fromFiles(pathBefore, pathAfter,
    DiffAlgorithm.SupportedAlgorithm.MYERS,
    VariationDiffParseOptions.Default);
diffViaGumTree  = VariationDiff.fromTrees(s1, s2);
diffViaTrueDiff = TrueDiffDetective.compare(s1, s2);

It would be more transparent if we would have unified interfaces for differencing algorithms such as this for example:

public interface TextBasedDifferencer<L extends Label> {
    public VariationDiff<L> diff(String before, String after);
}
public interface TreeBasedDifferencer<L extends Label> {
    public VariationDiff<L> diff(VariationTree<L> before, VariationTree<L> after);
}

Then methods could rely on these differencers instead of having lots of convencience methods all around the place as of now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant