org.xwiki.diff.display
Class UnifiedDiffBlock<E,F>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<UnifiedDiffElement<E,F>>
              extended by org.xwiki.diff.display.UnifiedDiffBlock<E,F>
Type Parameters:
E - the type of elements that are compared to produce the first level diff
F - 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 of UnifiedDiffElements 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
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
UnifiedDiffBlock()
           
 
Method Summary
 int getNextSize()
           
 int getNextStart()
           
 int getPreviousSize()
           
 int getPreviousStart()
           
 String toString()
           
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

UnifiedDiffBlock

public UnifiedDiffBlock()
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

toString

public String toString()
Overrides:
toString in class AbstractCollection<UnifiedDiffElement<E,F>>