Interface UnifiedDiffDisplayer
-
@Role public interface UnifiedDiffDisplayer
Displays aDiffResult
as a unified diff. The unified diff consists in a sequence of blocks, each having elements marked as either added or removed, padded with unmodified elements that put changes in context.- Since:
- 4.1RC1
- Version:
- $Id: a3b22bd6bc6c580465bd7d3d5011d6250be5cb2c $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <E,F>
List<UnifiedDiffBlock<E,F>>display(DiffResult<E> diffResult)
Displays the given diff result as an unified diff using the default configuration.default <E,F>
List<UnifiedDiffBlock<E,F>>display(DiffResult<E> diffResult, List<Conflict<E>> conflicts)
Displays the given diff result as an unified diff using the default configuration and the list of conflicts.default <E,F>
List<UnifiedDiffBlock<E,F>>display(DiffResult<E> diffResult, List<Conflict<E>> conflicts, UnifiedDiffConfiguration<E,F> config)
Displays the given diff result as an unified diff using the provided configuration.<E,F>
List<UnifiedDiffBlock<E,F>>display(DiffResult<E> diffResult, UnifiedDiffConfiguration<E,F> config)
Displays the given diff result as an unified diff using the provided configuration.<E,F>
UnifiedDiffConfiguration<E,F>getDefaultConfiguration()
-
-
-
Method Detail
-
getDefaultConfiguration
<E,F> UnifiedDiffConfiguration<E,F> getDefaultConfiguration()
- Type Parameters:
E
- the type of elements that are compared to produce the diffF
- the type of sub-elements that can be compared to produce an in-line diff when an element is modified- Returns:
- the default configuration for this displayer
-
display
<E,F> List<UnifiedDiffBlock<E,F>> display(DiffResult<E> diffResult)
Displays the given diff result as an unified diff using the default configuration.- Type Parameters:
E
- the type of elements that are compared to produce the diffF
- the type of sub-elements that can be compared to produce an in-line diff when an element is modified- Parameters:
diffResult
- the diff result- Returns:
- the list of blocks that form the unified diff
- See Also:
display(DiffResult, UnifiedDiffConfiguration)
-
display
default <E,F> List<UnifiedDiffBlock<E,F>> display(DiffResult<E> diffResult, List<Conflict<E>> conflicts)
Displays the given diff result as an unified diff using the default configuration and the list of conflicts.- Type Parameters:
E
- the type of elements that are compared to produce the diffF
- the type of sub-elements that can be compared to produce an in-line diff when an element is modified- Parameters:
diffResult
- the diff resultconflicts
- theConflict
to take into consideration for the display.- Returns:
- the list of blocks that form the unified diff
- Since:
- 11.7RC1
- See Also:
display(DiffResult, UnifiedDiffConfiguration)
-
display
<E,F> List<UnifiedDiffBlock<E,F>> display(DiffResult<E> diffResult, UnifiedDiffConfiguration<E,F> config)
Displays the given diff result as an unified diff using the provided configuration. An unified diff consists in a list of blocks, each block grouping changes that are close to each other. The distance between two changes in a block is less than2 * context size
, where context size represents the number of unmodified elements to include before and after a change in order to place that change in context.If the elements can be split in sub-elements, i.e. if a splitter is provided through the configuration, then the unified diff displays also the changes inside the modified elements.
If changes are computed at the line level in a text, i.e. the elements that are compared to produce the diff are lines of text, and a word splitter is provided through configuration then the following is a block from a unified diff:
@@ -81,5 +85,5 @@ first line of context another unmodified line -this line <del>has been removed</del> +this line <ins>replaced the previous line</ins> close the block with unmodified lines last line of context
- Type Parameters:
E
- the type of elements that were compared to produce the diffF
- the type of sub-elements that can be compared to produce an in-line diff when an element is modified- Parameters:
diffResult
- the diff resultconfig
- the configuration- Returns:
- the list of blocks that form the unified diff
-
display
default <E,F> List<UnifiedDiffBlock<E,F>> display(DiffResult<E> diffResult, List<Conflict<E>> conflicts, UnifiedDiffConfiguration<E,F> config)
Displays the given diff result as an unified diff using the provided configuration. An unified diff consists in a list of blocks, each block grouping changes that are close to each other. The distance between two changes in a block is less than2 * context size
, where context size represents the number of unmodified elements to include before and after a change in order to place that change in context.If the elements can be split in sub-elements, i.e. if a splitter is provided through the configuration, then the unified diff displays also the changes inside the modified elements.
If changes are computed at the line level in a text, i.e. the elements that are compared to produce the diff are lines of text, and a word splitter is provided through configuration then the following is a block from a unified diff:
@@ -81,5 +85,5 @@ first line of context another unmodified line -this line <del>has been removed</del> +this line <ins>replaced the previous line</ins> close the block with unmodified lines last line of context
If a change is part of a merge conflict, then the block elements contain the information for solving the conflicts.
- Type Parameters:
E
- the type of elements that were compared to produce the diffF
- the type of sub-elements that can be compared to produce an in-line diff when an element is modified- Parameters:
diffResult
- the diff resultconfig
- the configurationconflicts
- theConflict
to take into consideration for the display.- Returns:
- the list of blocks that form the unified diff
- Since:
- 11.7RC1
-
-