mirror of
https://github.com/java-diff-utils/java-diff-utils.git
synced 2026-03-13 10:11:17 +08:00
renamed class
This commit is contained in:
@@ -24,7 +24,6 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import org.eclipse.jgit.diff.Edit;
|
||||
import org.eclipse.jgit.diff.EditList;
|
||||
import org.eclipse.jgit.diff.HistogramDiff;
|
||||
import org.eclipse.jgit.diff.Sequence;
|
||||
import org.eclipse.jgit.diff.SequenceComparator;
|
||||
|
||||
@@ -34,14 +33,14 @@ import org.eclipse.jgit.diff.SequenceComparator;
|
||||
*
|
||||
* @author toben
|
||||
*/
|
||||
public class JGitDiff<T> implements DiffAlgorithm<T> {
|
||||
public class HistogramDiff<T> implements DiffAlgorithm<T> {
|
||||
|
||||
@Override
|
||||
public List<Change> diff(List<T> original, List<T> revised) throws DiffException {
|
||||
Objects.requireNonNull(original, "original list must not be null");
|
||||
Objects.requireNonNull(revised, "revised list must not be null");
|
||||
EditList diffList = new EditList();
|
||||
diffList.addAll(new HistogramDiff().diff(new DataListComparator<>(), new DataList<>(original), new DataList<>(revised)));
|
||||
diffList.addAll(new org.eclipse.jgit.diff.HistogramDiff().diff(new DataListComparator<>(), new DataList<>(original), new DataList<>(revised)));
|
||||
List<Change> patch = new ArrayList<>();
|
||||
for (Edit edit : diffList) {
|
||||
DeltaType type = DeltaType.EQUAL;
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.github.difflib.algorithm.jgit;
|
||||
|
||||
import com.github.difflib.algorithm.jgit.JGitDiff;
|
||||
import com.github.difflib.algorithm.jgit.HistogramDiff;
|
||||
import static com.github.difflib.DiffUtilsTest.readStringListFromInputStream;
|
||||
import com.github.difflib.TestConstants;
|
||||
import com.github.difflib.algorithm.DiffException;
|
||||
@@ -36,9 +36,9 @@ import static org.junit.Assert.*;
|
||||
*
|
||||
* @author toben
|
||||
*/
|
||||
public class JGitDiffTest {
|
||||
public class HistogramDiffTest {
|
||||
|
||||
public JGitDiffTest() {
|
||||
public HistogramDiffTest() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
@@ -58,13 +58,13 @@ public class JGitDiffTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of diff method, of class JGitDiff.
|
||||
* Test of diff method, of class HistogramDiff.
|
||||
*/
|
||||
@Test
|
||||
public void testDiff() throws DiffException, PatchFailedException {
|
||||
List<String> orgList = Arrays.asList("A","B","C","A","B","B","A");
|
||||
List<String> revList = Arrays.asList("C","B","A","B","A","C");
|
||||
final Patch<String> patch = Patch.generate(orgList, revList, new JGitDiff().diff(orgList, revList));
|
||||
final Patch<String> patch = Patch.generate(orgList, revList, new HistogramDiff().diff(orgList, revList));
|
||||
System.out.println(patch);
|
||||
assertNotNull(patch);
|
||||
assertEquals(3, patch.getDeltas().size());
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.github.difflib.algorithm.jgit;
|
||||
|
||||
import com.github.difflib.algorithm.jgit.JGitDiff;
|
||||
import com.github.difflib.algorithm.jgit.HistogramDiff;
|
||||
import static com.github.difflib.DiffUtilsTest.readStringListFromInputStream;
|
||||
import com.github.difflib.TestConstants;
|
||||
import com.github.difflib.algorithm.DiffException;
|
||||
@@ -36,9 +36,9 @@ import static org.junit.Assert.*;
|
||||
*
|
||||
* @author toben
|
||||
*/
|
||||
public class LRJGitDiffTest {
|
||||
public class LRHistogramDiffTest {
|
||||
|
||||
public LRJGitDiffTest() {
|
||||
public LRHistogramDiffTest() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
@@ -64,7 +64,7 @@ public class LRJGitDiffTest {
|
||||
List<String> original = readStringListFromInputStream(zip.getInputStream(zip.getEntry("ta")));
|
||||
List<String> revised = readStringListFromInputStream(zip.getInputStream(zip.getEntry("tb")));
|
||||
|
||||
Patch<String> patch = Patch.generate(original, revised, new JGitDiff().diff(original, revised));
|
||||
Patch<String> patch = Patch.generate(original, revised, new HistogramDiff().diff(original, revised));
|
||||
|
||||
assertEquals(34, patch.getDeltas().size());
|
||||
|
||||
Reference in New Issue
Block a user