Package org.xwiki.diff.display
Class UnifiedDiffElement<E,F>
- java.lang.Object
-
- org.xwiki.diff.display.UnifiedDiffElement<E,F>
-
- Type Parameters:
E
- the type of elements that are compared to produce the first-level diffF
- the type of sub-elements that are compared to produce the second-level diff
public class UnifiedDiffElement<E,F> extends Object
Wraps the elements that are compared to produce a diff, holding information like their index and type of change (added, removed, unmodified) to simplify the process of displaying them in an unified diff. If the wrapped element is a composite element (can be split in sub-elements) and was modified (replaced by another element) then this class can also store information about changes at the level of sub-elements.- Since:
- 4.1RC1
- Version:
- $Id: f3d1115b5e3028caebb66374ccd7a0fef48c3c3f $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UnifiedDiffElement.Type
The possible types of elements you can find within a unified diff.
-
Constructor Summary
Constructors Constructor Description UnifiedDiffElement(int index, UnifiedDiffElement.Type type, E value)
Creates a new element in a unified diff.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
List<InlineDiffChunk<F>>
getChunks()
int
getIndex()
UnifiedDiffElement.Type
getType()
E
getValue()
int
hashCode()
boolean
isAdded()
boolean
isDeleted()
void
setChunks(List<InlineDiffChunk<F>> chunks)
Sets the list of chunks of sub-elements that form this element.String
toString()
-
-
-
Constructor Detail
-
UnifiedDiffElement
public UnifiedDiffElement(int index, UnifiedDiffElement.Type type, E value)
Creates a new element in a unified diff.- Parameters:
index
- the element indextype
- the element typevalue
- the wrapped element
-
-
Method Detail
-
getIndex
public int getIndex()
- Returns:
- the element index
-
getType
public UnifiedDiffElement.Type getType()
- Returns:
- the element type
-
getValue
public E getValue()
- Returns:
- the wrapped element
-
getChunks
public List<InlineDiffChunk<F>> getChunks()
- Returns:
- the list of chunks of sub-elements that form this element
-
setChunks
public void setChunks(List<InlineDiffChunk<F>> chunks)
Sets the list of chunks of sub-elements that form this element.- Parameters:
chunks
- the list of chunks
-
isAdded
public boolean isAdded()
- Returns:
true
if this element was added,false
otherwise
-
isDeleted
public boolean isDeleted()
- Returns:
true
if this element was deleted,false
otherwise
-
-