@Test public void testMove() { final String text1 = "Line1\nLine2\nDies ist ein Text.\nbla bla\nText2 Text2.1 Text2.2"; final String text2 = "Line1\nLine2\nDies ist ein Text.\nText2 Text2.1 Text2.2\nbla bla"; final List diffList = differenceService.diff(text1, text2); final int i = 1; for (final Iterator iter = diffList.iterator(); iter.hasNext();) { final ChangeInfo changeInfo = (ChangeInfo) iter.next(); assertEquals("Type must be MOVE", changeInfo.getType(), ChangeInfo.MOVE); assertEquals("Wrong line content.", changeInfo.getLines()[0], "Text2 Text2.1 Text2.2"); } }
public List diff(final String oldText, final String newText) { Node.panchor = null; oldInfo = new SourceInfo(); newInfo = new SourceInfo(); inputScan(oldText, oldInfo); inputScan(newText, newInfo); oldInfo.alloc(); newInfo.alloc(); blocklen = new int[(oldInfo.maxLine > newInfo.maxLine ? oldInfo.maxLine : newInfo.maxLine) + 2]; transform(); return printOut(); }
CookbookDiff { public List diff(final String oldText, final String newText) { Node.panchor = null; oldInfo = new SourceInfo(); newInfo = new SourceInfo(); inputScan(oldText, oldInfo); inputScan(newText, newInfo); oldInfo.alloc(); newInfo.alloc(); blocklen = new int[(oldInfo.maxLine > newInfo.maxLine ? oldInfo.maxLine : newInfo.maxLine) + 2]; transform(); return printOut(); } }
CookbookDiff { public List diff(final String oldText, final String newText) { Node.panchor = null; oldInfo = new SourceInfo(); newInfo = new SourceInfo(); inputScan(oldText, oldInfo); inputScan(newText, newInfo); oldInfo.alloc(); newInfo.alloc(); blocklen = new int[(oldInfo.maxLine > newInfo.maxLine ? oldInfo.maxLine : newInfo.maxLine) + 2]; transform(); return printOut(); }  }
CookbookDiff { public List diff(final String oldText, final String newText) { Node.panchor = null; oldInfo = new SourceInfo(); newInfo = new SourceInfo(); inputScan(oldText, oldInfo); inputScan(newText, newInfo); oldInfo.alloc(); newInfo.alloc(); blocklen = new int[(oldInfo.maxLine > newInfo.maxLine ? oldInfo.maxLine : newInfo.maxLine) + 2]; transform(); return printOut(); }  List diff(final String oldText, final String newText); }
CookbookDiff { public List diff(final String oldText, final String newText) { Node.panchor = null; oldInfo = new SourceInfo(); newInfo = new SourceInfo(); inputScan(oldText, oldInfo); inputScan(newText, newInfo); oldInfo.alloc(); newInfo.alloc(); blocklen = new int[(oldInfo.maxLine > newInfo.maxLine ? oldInfo.maxLine : newInfo.maxLine) + 2]; transform(); return printOut(); }  List diff(final String oldText, final String newText); static final int idle; }