/** * Creates a new MergeAlgorithm which uses * {@link org.eclipse.jgit.diff.HistogramDiff} as diff algorithm */ public MergeAlgorithm() { this(new HistogramDiff()); }
/** * Get diff algorithm * * @param alg * the diff algorithm for which an implementation should be * returned * @return an implementation of the specified diff algorithm */ public static DiffAlgorithm getAlgorithm(SupportedAlgorithm alg) { switch (alg) { case MYERS: return MyersDiff.INSTANCE; case HISTOGRAM: return new HistogramDiff(); default: throw new IllegalArgumentException(); } }
/** * Creates a new MergeAlgorithm which uses * {@link org.eclipse.jgit.diff.HistogramDiff} as diff algorithm */ public MergeAlgorithm() { this(new HistogramDiff()); }
/** * Creates a new MergeAlgorithm which uses {@link HistogramDiff} as diff * algorithm */ public MergeAlgorithm() { this(new HistogramDiff()); }
/** * @param alg * the diff algorithm for which an implementation should be * returned * @return an implementation of the specified diff algorithm */ public static DiffAlgorithm getAlgorithm(SupportedAlgorithm alg) { switch (alg) { case MYERS: return MyersDiff.INSTANCE; case HISTOGRAM: return new HistogramDiff(); default: throw new IllegalArgumentException(); } }
/** * Get diff algorithm * * @param alg * the diff algorithm for which an implementation should be * returned * @return an implementation of the specified diff algorithm */ public static DiffAlgorithm getAlgorithm(SupportedAlgorithm alg) { switch (alg) { case MYERS: return MyersDiff.INSTANCE; case HISTOGRAM: return new HistogramDiff(); default: throw new IllegalArgumentException(); } }
DiffAlgorithm create() { HistogramDiff d = new HistogramDiff(); d.setFallbackAlgorithm(null); return d; } };
DiffAlgorithm create() { HistogramDiff d = new HistogramDiff(); d.setFallbackAlgorithm(MyersDiff.INSTANCE); return d; } };
/** * Get the differences in git format. * * @param string1 the string1 * @param string2 the string2 * @return the diff * @throws IOException Signals that an I/O exception has occurred. */ private String getDiffinGitFormat(String string1, String string2) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); RawText rt1 = new RawText(string1.getBytes(Charsets.UTF_8)); RawText rt2 = new RawText(string2.getBytes(Charsets.UTF_8)); EditList diffList = new EditList(); diffList.addAll(new HistogramDiff().diff(RawTextComparator.DEFAULT, rt1, rt2)); new DiffFormatter(out).format(diffList, rt1, rt2); return out.toString(Charsets.UTF_8.name()); }
/** * Get the differences in git format. * * @param string1 the string1 * @param string2 the string2 * @return the diff * @throws IOException Signals that an I/O exception has occurred. */ private String getDiffinGitFormat(String string1, String string2) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); RawText rt1 = new RawText(string1.getBytes(Charsets.UTF_8)); RawText rt2 = new RawText(string2.getBytes(Charsets.UTF_8)); EditList diffList = new EditList(); diffList.addAll(new HistogramDiff().diff(RawTextComparator.DEFAULT, rt1, rt2)); new DiffFormatter(out).format(diffList, rt1, rt2); return out.toString(Charsets.UTF_8.name()); }
data2 = new byte[0]; return new HistogramDiff().diff(comparator, // data1.length > 0 ? new RawText(data1) : EMPTY_TEXT, // data2.length > 0 ? new RawText(data2) : EMPTY_TEXT);
data2 = new byte[0]; return new HistogramDiff().diff(comparator, // data1.length > 0 ? new RawText(data1) : EMPTY_TEXT, // data2.length > 0 ? new RawText(data2) : EMPTY_TEXT);