org.netbeans.junit.diff
Class LineDiff
java.lang.Object
org.netbeans.junit.diff.LineDiff
- All Implemented Interfaces:
- Diff
- public class LineDiff
- extends Object
- implements Diff
Slow diff with better user-friendly output format.
Compares whole lines. Built on "Weighted matching in graphs".
Constructor Summary |
LineDiff()
Creates a new instance of LineDiff |
LineDiff(boolean ignoreCase)
|
LineDiff(boolean ignoreCase,
boolean ignoreEmptyLines)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LineDiff
public LineDiff()
- Creates a new instance of LineDiff
LineDiff
public LineDiff(boolean ignoreCase)
LineDiff
public LineDiff(boolean ignoreCase,
boolean ignoreEmptyLines)
getIgnoreCase
public boolean getIgnoreCase()
compareLines
protected boolean compareLines(String l1,
String l2)
- Parameters:
l1
- first line to comparel2
- second line to compare
- Returns:
- true if lines equal
diff
public boolean diff(String first,
String second,
String diff)
throws IOException
- Specified by:
diff
in interface Diff
- Parameters:
first
- first file to comparesecond
- second file to comparediff
- difference file, caller can pass null value, when results are not needed.
- Returns:
- true iff files differ
- Throws:
IOException
diff
public boolean diff(File firstFile,
File secondFile,
File diffFile)
throws IOException
- Specified by:
diff
in interface Diff
- Parameters:
firstFile
- first file to compare -- refsecondFile
- second file to compare -- goldendiffFile
- difference file, caller can pass null value, when results are not needed.
- Returns:
- true iff files differ
- Throws:
IOException
formatOutput
public String formatOutput(boolean positive,
int lineIndex,
String line)
main
public static void main(String[] argv)