|
ESC/Java2 © 2003,2004,2005,2006 David Cok and Joseph Kiniry © 2005,2006 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjunitutils.Diff
Class for calculating a (somewhat) detailed comparison of two strings.
| Field Summary | |
private boolean |
_areDifferent
This is set to true if the oldText and newText are not the same |
private static java.lang.String |
DELIM
This string holds line delimiters |
private java.lang.String |
differences
This output String holds the description of the differences between the old and new text. |
private static java.lang.String |
NEW_CH
This string is used to mark lines of new text |
private static java.lang.String |
NEWLINE
This is the system new line character |
private java.lang.String |
newText
This is the supplied new text, to be compared against the old text |
private static java.lang.String |
OLD_CH
This string is used to mark lines of old text |
private java.lang.String |
oldText
This is the supplied old text, to be compared against the new text |
| Constructor Summary | |
Diff(java.lang.String oldTextLabel,
java.lang.String oldText,
java.lang.String newTextLabel,
java.lang.String newText)
Calculate a difference between the given strings. |
|
| Method Summary | |
boolean |
areDifferent()
Returns true if strings on which this was constructed are different. |
private void |
calculate(java.lang.String oldTextLabel,
java.lang.String newTextLabel)
Sets the values of _areDifferent and differences according to a comparison between oldText and newText |
private void |
calculateDiffs(java.lang.StringBuffer differencesSB)
|
java.lang.String |
result()
Returns the differences between the given strings. |
private java.lang.String[] |
splitByLine(java.lang.String text)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.lang.String oldText
private java.lang.String newText
private boolean _areDifferent
private java.lang.String differences
private static final java.lang.String DELIM
private static final java.lang.String NEWLINE
private static final java.lang.String OLD_CH
private static final java.lang.String NEW_CH
| Constructor Detail |
public Diff(java.lang.String oldTextLabel,
java.lang.String oldText,
java.lang.String newTextLabel,
java.lang.String newText)
oldTextLabel - a label for the oldText parameteroldText - a value to be comparednewTextLabel - a label for the newText parameternewText - a value to be compared| Method Detail |
private void calculate(java.lang.String oldTextLabel,
java.lang.String newTextLabel)
oldTextLabel - a label for the oldText parameternewTextLabel - a label for the newText parameterprivate void calculateDiffs(java.lang.StringBuffer differencesSB)
private java.lang.String[] splitByLine(java.lang.String text)
public boolean areDifferent()
public java.lang.String result()
|
ESC/Java2 © 2003,2004,2005,2006 David Cok and Joseph Kiniry © 2005,2006 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||