Class UnifiedDiffElement<E,​F>

  • Type Parameters:
    E - the type of elements that are compared to produce the first-level diff
    F - 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 $
    • Constructor Detail

      • UnifiedDiffElement

        public UnifiedDiffElement​(int index,
                                  UnifiedDiffElement.Type type,
                                  E value)
        Creates a new element in a unified diff.
        Parameters:
        index - the element index
        type - the element type
        value - the wrapped element
    • Method Detail

      • getIndex

        public int getIndex()
        Returns:
        the element index
      • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object