Package org.xwiki.diff.display
Class UnifiedDiffBlock<E,F>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<UnifiedDiffElement<E,F>>
-
- org.xwiki.diff.display.UnifiedDiffBlock<E,F>
-
- Type Parameters:
E
- the type of elements that are compared to produce the first level diffF
- the type of sub-element that are compared to produce the second level diff
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<UnifiedDiffElement<E,F>>
,Collection<UnifiedDiffElement<E,F>>
,List<UnifiedDiffElement<E,F>>
,RandomAccess
public class UnifiedDiffBlock<E,F> extends ArrayList<UnifiedDiffElement<E,F>>
Represents a list ofUnifiedDiffElement
s that share the same context. The context is defined based on the distance between changes. Changes that are close to each other are grouped in a single block. A block can contain both added and removed elements. Blocks also contain unmodified elements that put changes in context.- Since:
- 4.1RC1
- Version:
- $Id: dbabad58f7203345ace61bc95d92a578ff65e056 $
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description UnifiedDiffBlock()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UnifiedDiffConflictElement<E>
getConflict()
int
getNextSize()
int
getNextStart()
int
getPreviousSize()
int
getPreviousStart()
boolean
isConflicting()
void
setConflict(Conflict<E> conflict)
Sets the conflict related to this block element.String
toString()
-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.util.AbstractCollection
containsAll
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.List
containsAll
-
-
-
-
Method Detail
-
getPreviousStart
public int getPreviousStart()
- Returns:
- the index where this block starts in the previous version; since blocks are most of the time not empty, the returned value is the index of the first unmodified or removed element in this group
-
getPreviousSize
public int getPreviousSize()
- Returns:
- the size of this block (number of elements) in the previous version; unmodified elements and elements marked as removed are counted only
-
getNextStart
public int getNextStart()
- Returns:
- the index where this block starts in the next version; since blocks are most of the time not empty, the returned value is the index of the first unmodified or added element in this group
-
getNextSize
public int getNextSize()
- Returns:
- the size of this block (number of elements) in the next version; unmodified elements and elements marked as added are counted only
-
isConflicting
public boolean isConflicting()
- Returns:
true
if this block is part of a conflict.- Since:
- 11.7RC1
-
getConflict
public UnifiedDiffConflictElement<E> getConflict()
- Returns:
- the
UnifiedDiffConflictElement
or null if there is no conflict. - Since:
- 11.8RC1
-
setConflict
public void setConflict(Conflict<E> conflict)
Sets the conflict related to this block element.- Parameters:
conflict
- the conflict to be registered.- Since:
- 11.8RC1
-
toString
public String toString()
- Overrides:
toString
in classAbstractCollection<UnifiedDiffElement<E,F>>
-
-