Skip to content

Unified Interface for Differencers #146

Open
@pmbittner

Description

@pmbittner

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions