|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.testing.Diff
Class for calculating a (somewhat) detailed comparison of two strings.
| Field Summary | |
private boolean |
areDifferent
|
private static String |
DELIM
|
private Pattern |
equivChars
|
private String |
equivReplaceChar
|
private static String |
IGNORED_CHARS_FILLER
|
private static String |
NEW_CH
|
private static String |
NEWLINE
|
private String |
newText
|
private static String |
OLD_CH
|
private String |
oldText
|
private Pattern |
regExpr
|
private String |
result
|
| Constructor Summary | |
Diff(String oldTextLabel,
String oldText,
String newTextLabel,
String newText)
Calculate a difference between the given strings. |
|
Diff(String oldTextLabel,
String oldText,
String newTextLabel,
String newText,
Pattern regExpr)
Calculate a difference between the given strings ignoring the portions of each line that match the given regular expression pattern. |
|
Diff(String oldTextLabel,
String oldText,
String newTextLabel,
String newText,
Pattern regExpr,
String equivChars)
Calculate a difference between the given strings ignoring the portions of each line that match the given regular expression pattern, and treating any character from the equivChars String as equal. |
|
| Method Summary | |
boolean |
areDifferent()
Returns true if strings on which this was constructed are different. |
private boolean |
areSame(String a,
String b)
|
private void |
calculate(String oldTextLabel,
String newTextLabel)
|
private String |
replaceChars(String s)
|
String |
result()
Returns the differences between the given strings. |
private String[] |
splitByLine(String text)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private final String oldText
private final String newText
private final Pattern regExpr
private final Pattern equivChars
private final String equivReplaceChar
private boolean areDifferent
private String result
private static final String DELIM
private static final String NEWLINE
private static final String OLD_CH
private static final String NEW_CH
private static final String IGNORED_CHARS_FILLER
| Constructor Detail |
public Diff(String oldTextLabel,
String oldText,
String newTextLabel,
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
public Diff(String oldTextLabel,
String oldText,
String newTextLabel,
String newText,
Pattern regExpr)
oldTextLabel - a label for the oldText parameteroldText - a value to be comparednewTextLabel - a label for the newText parameternewText - a value to be comparedregExpr - a regular expression, matches of which are removed from lines
before comparison
public Diff(String oldTextLabel,
String oldText,
String newTextLabel,
String newText,
Pattern regExpr,
String equivChars)
equivChars String as equal.
oldTextLabel - a label for the oldText parameteroldText - a value to be comparednewTextLabel - a label for the newText parameternewText - a value to be comparedregExpr - a regular expression, matches of which are removed from lines
before comparisonequivChars - a string whose characters are considered equivalent
for comparison purposes| Method Detail |
private boolean areSame(String a,
String b)
private String replaceChars(String s)
private void calculate(String oldTextLabel,
String newTextLabel)
private String[] splitByLine(String text)
public boolean areDifferent()
public String result()
ensures !areDifferent() <==> \result.equals( "" );
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||