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: 20e5e7e47bcbead2078242426789dade5cc08e60 $
Nested Class Summary |
static class |
UnifiedDiffElement.Type
The possible types of elements you can find within a unified diff. |
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
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
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2004-2013 XWiki. All Rights Reserved.