|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--JLibDiff.GnuDiffAlgorithm
Title: $FileName: GnuDiffAlgorithm.java$
change
objects which form an
edit script. The objects compared are traditionally lines
of text from two files. Comparison options such as "ignore
whitespace" are implemented by modifying the equals
and hashcode
methods for the objects compared.
The basic algorithm is described in: "An O(ND) Difference Algorithm and its Variations", Eugene Myers, Algorithmica Vol. 1 No. 2, 1986, p 251.
This class outputs different results from GNU diff 1.15 on some inputs. Our results are actually better (smaller change list, smaller total size of changes), but it would be nice to know why. Perhaps there is a memory overwrite bug in GNU diff 1.15., Stuart D. Gathman, translated from GNU diff 1.15 Copyright (C) 2000 Business Management Systems, Inc.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Field Summary | |
private int[] |
bdiag
|
private int |
bdiagoff
|
private int |
cost
|
private int |
equivMax
|
private int[] |
fdiag
|
private int |
fdiagoff
|
private FileData[] |
fileInfo
|
boolean |
heuristic
|
private boolean |
noDiscards
|
private int[] |
xvec
|
private int[] |
yvec
|
Constructor Summary | |
GnuDiffAlgorithm()
|
Method Summary | |
private java.util.Vector |
buildChangeList(java.lang.String[] A,
java.lang.String[] B)
|
private void |
compareseq(int xoff,
int xlim,
int yoff,
int ylim)
|
private int |
diag(int xoff,
int xlim,
int yoff,
int ylim)
|
private void |
discardConfusingLines()
|
int |
getEquivMax()
Returns the equivMax. |
private java.lang.Object[] |
getLines(int firstLine,
int numLines,
java.lang.Object[] parent)
|
void |
incrimentEquivMax()
|
boolean |
isNoDiscards()
Returns the noDiscards. |
java.util.Vector |
makeDiff(java.lang.String[] A,
java.lang.String[] B)
|
void |
setEol(java.lang.String s)
|
private void |
shiftBoundaries()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private int equivMax
private boolean noDiscards
private FileData[] fileInfo
private int[] xvec
private int[] yvec
private int[] fdiag
private int[] bdiag
private int fdiagoff
private int bdiagoff
private int cost
public boolean heuristic
Constructor Detail |
public GnuDiffAlgorithm()
Method Detail |
public java.util.Vector makeDiff(java.lang.String[] A, java.lang.String[] B)
makeDiff
in interface DiffAlgorithm
DiffAlgorithm.makeDiff(String[], String[])
public void setEol(java.lang.String s)
setEol
in interface DiffAlgorithm
private void compareseq(int xoff, int xlim, int yoff, int ylim)
private int diag(int xoff, int xlim, int yoff, int ylim)
private void discardConfusingLines()
private void shiftBoundaries()
private java.lang.Object[] getLines(int firstLine, int numLines, java.lang.Object[] parent)
private java.util.Vector buildChangeList(java.lang.String[] A, java.lang.String[] B)
public int getEquivMax()
getEquivMax
in interface DiffMaker
public void incrimentEquivMax()
incrimentEquivMax
in interface DiffMaker
public boolean isNoDiscards()
isNoDiscards
in interface DiffMaker
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |