Package com.github.difflib.text
Class DiffRowGenerator.Builder
java.lang.Object
com.github.difflib.text.DiffRowGenerator.Builder
- Enclosing class:
- DiffRowGenerator
This class used for building the DiffRowGenerator.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private boolean
private BiPredicate<String,
String> private boolean
private boolean
private BiFunction<DiffRow.Tag,
Boolean, String> private BiFunction<DiffRow.Tag,
Boolean, String> private boolean
private boolean
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build the DiffRowGenerator.columnWidth
(int width) Set the column width of generated lines of original and revised texts.decompressDeltas
(boolean decompressDeltas) Deltas could be in a state, that would produce some unreasonable results within an inline diff.equalizer
(BiPredicate<String, String> equalizer) Provide an equalizer for diff processing.ignoreWhiteSpaces
(boolean val) Ignore white spaces in generating diff rows or not.inlineDiffBySplitter
(Function<String, List<String>> inlineDiffSplitter) To provide some customized splitting a splitter can be provided.inlineDiffByWord
(boolean inlineDiffByWord) Per default each character is separatly processed.lineNormalizer
(Function<String, String> lineNormalizer) By default DiffRowGenerator preprocesses lines for HTML output.mergeOriginalRevised
(boolean mergeOriginalRevised) Merge the complete result within the original text.newTag
(BiFunction<DiffRow.Tag, Boolean, String> generator) Generator for New-Text-Tags.Generator for New-Text-Tags.oldTag
(BiFunction<DiffRow.Tag, Boolean, String> generator) Generator for Old-Text-Tags.Generator for Old-Text-Tags.processDiffs
(Function<String, String> processDiffs) Processor for diffed text parts.replaceOriginalLinefeedInChangesWithSpaces
(boolean replace) Sometimes it happens that a change contains multiple lines.reportLinesUnchanged
(boolean val) Give the originial old and new text lines to Diffrow without any additional processing and without any tags to highlight the change.showInlineDiffs
(boolean val) Show inline diffs in generating diff rows or not.
-
Field Details
-
showInlineDiffs
private boolean showInlineDiffs -
ignoreWhiteSpaces
private boolean ignoreWhiteSpaces -
decompressDeltas
private boolean decompressDeltas -
oldTag
-
newTag
-
columnWidth
private int columnWidth -
mergeOriginalRevised
private boolean mergeOriginalRevised -
reportLinesUnchanged
private boolean reportLinesUnchanged -
inlineDiffSplitter
-
lineNormalizer
-
processDiffs
-
equalizer
-
replaceOriginalLinefeedInChangesWithSpaces
private boolean replaceOriginalLinefeedInChangesWithSpaces
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
showInlineDiffs
Show inline diffs in generating diff rows or not.- Parameters:
val
- the value to set. Default: false.- Returns:
- builder with configured showInlineDiff parameter
-
ignoreWhiteSpaces
Ignore white spaces in generating diff rows or not.- Parameters:
val
- the value to set. Default: true.- Returns:
- builder with configured ignoreWhiteSpaces parameter
-
reportLinesUnchanged
Give the originial old and new text lines to Diffrow without any additional processing and without any tags to highlight the change.- Parameters:
val
- the value to set. Default: false.- Returns:
- builder with configured reportLinesUnWrapped parameter
-
oldTag
Generator for Old-Text-Tags.- Parameters:
generator
- the tag generator- Returns:
- builder with configured ignoreBlankLines parameter
-
oldTag
Generator for Old-Text-Tags.- Parameters:
generator
- the tag generator- Returns:
- builder with configured ignoreBlankLines parameter
-
newTag
Generator for New-Text-Tags.- Parameters:
generator
-- Returns:
-
newTag
Generator for New-Text-Tags.- Parameters:
generator
-- Returns:
-
processDiffs
Processor for diffed text parts. Here e.g. whitecharacters could be replaced by something visible.- Parameters:
processDiffs
-- Returns:
-
columnWidth
Set the column width of generated lines of original and revised texts.- Parameters:
width
- the width to set. Making it < 0 doesn't make any sense. Default 80.- Returns:
- builder with config of column width
-
build
Build the DiffRowGenerator. If some parameters is not set, the default values are used.- Returns:
- the customized DiffRowGenerator
-
mergeOriginalRevised
Merge the complete result within the original text. This makes sense for one line display.- Parameters:
mergeOriginalRevised
-- Returns:
-
decompressDeltas
Deltas could be in a state, that would produce some unreasonable results within an inline diff. So the deltas are decompressed into smaller parts and rebuild. But this could result in more differences.- Parameters:
decompressDeltas
-- Returns:
-
inlineDiffByWord
Per default each character is separatly processed. This variant introduces processing by word, which does not deliver in word changes. Therefore the whole word will be tagged as changed:false: (aBa : aba) -- changed: a(B)a : a(b)a true: (aBa : aba) -- changed: (aBa) : (aba)
-
inlineDiffBySplitter
public DiffRowGenerator.Builder inlineDiffBySplitter(Function<String, List<String>> inlineDiffSplitter) To provide some customized splitting a splitter can be provided. Here someone could think about sentence splitter, comma splitter or stuff like that.- Parameters:
inlineDiffSplitter
-- Returns:
-
lineNormalizer
By default DiffRowGenerator preprocesses lines for HTML output. Tabs and special HTML characters like "<" are replaced with its encoded value. To change this you can provide a customized line normalizer here.- Parameters:
lineNormalizer
-- Returns:
-
equalizer
Provide an equalizer for diff processing.- Parameters:
equalizer
- equalizer for diff processing.- Returns:
- builder with configured equalizer parameter
-
replaceOriginalLinefeedInChangesWithSpaces
Sometimes it happens that a change contains multiple lines. If there is no correspondence in old and new. To keep the merged line more readable the linefeeds could be replaced by spaces.- Parameters:
replace
-- Returns:
-