From 307ba53eb65f616252567bfc6b8c52703a192be1 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 6 Sep 2010 13:33:31 -0700 Subject: Define DiffAlgorithm as an abstract function This makes it easier to parametrize DiffFormatter with a different implementation, as we later plan to add PatienceDiff to JGit. Change-Id: Id35ef478d5fa20fe10a1ba297f9436fd7adde9ce Signed-off-by: Shawn O. Pearce --- .../tst/org/eclipse/jgit/diff/MyersDiffPerformanceTest.java | 6 +++--- org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffTest.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'org.eclipse.jgit.test') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffPerformanceTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffPerformanceTest.java index 38fac3cc96..a3f9c22e31 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffPerformanceTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffPerformanceTest.java @@ -164,14 +164,14 @@ public class MyersDiffPerformanceTest extends TestCase { CharArray ac = new CharArray(a); CharArray bc = new CharArray(b); CharCmp cmp = new CharCmp(); - MyersDiff myersDiff = null; + int D = 0; int cpuTimeChanges = 0; long lastReadout = 0; long interimTime = 0; int repetitions = 0; stopwatch.start(); while (cpuTimeChanges < minCPUTimerTicks && interimTime < longTaskBoundary) { - myersDiff = new MyersDiff(cmp, ac, bc); + D = MyersDiff.INSTANCE.diff(cmp, ac, bc).size(); repetitions++; interimTime = stopwatch.readout(); if (interimTime != lastReadout) { @@ -181,7 +181,7 @@ public class MyersDiffPerformanceTest extends TestCase { } ret.runningTime = stopwatch.stop() / repetitions; ret.N = ac.size() + bc.size(); - ret.D = myersDiff.getEdits().size(); + ret.D = D; return ret; } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffTest.java index 60c1b47280..2410e8eabd 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffTest.java @@ -63,9 +63,9 @@ public class MyersDiffTest extends TestCase { } public void assertDiff(String a, String b, String edits) { - MyersDiff diff = new MyersDiff(new CharCmp(), + EditList editList = MyersDiff.INSTANCE.diff(new CharCmp(), toCharArray(a), toCharArray(b)); - assertEquals(edits, toString(diff.getEdits())); + assertEquals(edits, toString(editList)); } private static String toString(EditList list) { -- cgit v1.2.3