Class DiffRowGenerator
java.lang.Object
com.github.difflib.text.DiffRowGenerator
This class for generating DiffRows for side-by-sidy view. You can customize
the way of generating. For example, show inline diffs on not, ignoring white
spaces or/and blank lines and so on. All parameters for generating are
optional. If you do not specify them, the class will use the default values.
These values are: showInlineDiffs = false; ignoreWhiteSpaces = true;
ignoreBlankLines = true; ...
For instantiating the DiffRowGenerator you should use the its builder. Like
in example
DiffRowGenerator generator = new DiffRowGenerator.Builder().showInlineDiffs(true).
ignoreWhiteSpaces(true).columnWidth(100).build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class used for building the DiffRowGenerator. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BiPredicate<String, String> static final BiPredicate<String, String> static final PatternSplitting lines by character to achieve char by char diff checking.Splitting lines by word to achieve word by word diff checking.static final Pattern -
Method Summary
Modifier and TypeMethodDescriptionstatic DiffRowGenerator.Buildercreate()generateDiffRows(List<String> original, Patch<String> patch) Generates the DiffRows describing the difference between original and revised texts using the given patch.generateDiffRows(List<String> original, List<String> revised) Get the DiffRows describing the difference between original and revised texts using the given patch.splitStringPreserveDelimiter(String str, Pattern SPLIT_PATTERN)
-
Field Details
-
DEFAULT_EQUALIZER
-
IGNORE_WHITESPACE_EQUALIZER
-
LINE_NORMALIZER_FOR_HTML
-
SPLITTER_BY_CHARACTER
-
SPLIT_BY_WORD_PATTERN
-
SPLITTER_BY_WORD
-
WHITESPACE_PATTERN
-
-
Method Details
-
create
-
splitStringPreserveDelimiter
-
generateDiffRows
Get the DiffRows describing the difference between original and revised texts using the given patch. Useful for displaying side-by-side diff.- Parameters:
original- the original textrevised- the revised text- Returns:
- the DiffRows between original and revised texts
-
generateDiffRows
Generates the DiffRows describing the difference between original and revised texts using the given patch. Useful for displaying side-by-side diff.- Parameters:
original- the original textpatch- the given patch- Returns:
- the DiffRows between original and revised texts
-