Class WordDiffer
java.lang.Object
generic.algorithms.WordDiffer
Finds differences between two words (any two Strings). The results are available via
getParts().-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassclassA String that is part of a larger String. -
Constructor Summary
ConstructorsConstructorDescriptionWordDiffer(String oldWord, String newWord) Diffs the text between the old and new word. -
Method Summary
Modifier and TypeMethodDescriptiongetMergedParts(int maxSize) The same asgetParts()except that this method will merge differences that are separated only bymaxSizeor less characters.getParts()Returns the 'new word' broken into Strings with offsets, with each part being the same text or different text.toString()
-
Constructor Details
-
WordDiffer
-
-
Method Details
-
getParts
Returns the 'new word' broken into Strings with offsets, with each part being the same text or different text.- Returns:
- the parts; empty if the LCS could not be created
-
getMergedParts
The same asgetParts()except that this method will merge differences that are separated only bymaxSizeor less characters. This method allows clients to combine many smaller differences into larger differences that span similar characters. Merging parts can reduce visual clutter when displaying the differences, at the expense of accuracy.- Parameters:
maxSize- the maximum span of characters past which not to merge two differences- Returns:
- the parts
-
toString
-