Class DocumentDiff3


  • public class DocumentDiff3
    extends Object
    Implements a tree-way diff between a base document and 2 dervied ones. The result of the diff operation is a list of Hunk3 that can record the changes and conflicts.
    • Constructor Detail

      • DocumentDiff3

        public DocumentDiff3​(Document base,
                             Document left,
                             Document right)
        Creates a new document diff 3 object.
        Parameters:
        base - the base document
        left - the left document
        right - the right document
    • Method Detail

      • getHunks

        public Hunk3 getHunks()
        Returns a chain of Hunk3s that contain the modifications.
        Returns:
        a chain of Hunk3s.
      • hasConflicts

        public boolean hasConflicts()
        Indicates if any of the hunks has a conflict.
        Returns:
        true if any of the hunks has a conflict.
      • write

        public void write​(StringBuffer buf,
                          String lineSeparator,
                          boolean showBase)
        Writes the resulting document to the given string buffer. this may include conflicting regions.
        Parameters:
        buf - the string buffer to write to
        lineSeparator - the line separator to use
        showBase - if set to true the base section of a conflict is also included in the output.
      • write

        public void write​(DiffWriter w,
                          boolean showBase)
                   throws IOException
        Writes the resulting document to the given write. this may include conflicting regions.
        Parameters:
        w - the writer to write to
        showBase - if set to true the base section of a conflict is also included in the output.
        Throws:
        IOException - if an I/O error occurs