Class DefaultChangeListener

java.lang.Object
com.day.util.diff.DefaultChangeListener
All Implemented Interfaces:
ChangeListener

public class DefaultChangeListener extends Object implements ChangeListener
Provides a default output for a diff.
  • Constructor Details

    • DefaultChangeListener

      public DefaultChangeListener(PrintWriter out)
      Creates a new default change listener that will write to the given writer.
      Parameters:
      out - the writer
    • DefaultChangeListener

      public DefaultChangeListener(PrintWriter out, boolean debug)
      Creates a new default change listener that will write to the given writer. if debug is true the line numbers are also included in the output.
      Parameters:
      out - the writer
      debug - flag
  • Method Details

    • onDocumentsStart

      public void onDocumentsStart(Document left, Document right)
      Invoked before the iteration over the changes start.
      Specified by:
      onDocumentsStart in interface ChangeListener
      Parameters:
      left - the left document
      right - the right document
    • onDocumentsEnd

      public void onDocumentsEnd(Document left, Document right)
      Invoked after the iteration over the changes finished.
      Specified by:
      onDocumentsEnd in interface ChangeListener
      Parameters:
      left - the left document
      right - the right document
    • onChangeStart

      public void onChangeStart(int leftLine, int leftLen, int rightLine, int rightLen)
      Invoked before a change starts.
      Specified by:
      onChangeStart in interface ChangeListener
      Parameters:
      leftLine - the index of the left element of this change.
      leftLen - the number of changed left elements.
      rightLine - the index of the right element of this change.
      rightLen - the number of changed right elements.
    • onChangeEnd

      public void onChangeEnd()
      Invoked after a change finished.
      Specified by:
      onChangeEnd in interface ChangeListener
    • onUnmodified

      public void onUnmodified(int leftLine, int rightLine, Document.Element text)
      Invoked for an unmodified element
      Specified by:
      onUnmodified in interface ChangeListener
      Parameters:
      leftLine - the index of the left element
      rightLine - the index of the right element
      text - the element
    • onDeleted

      public void onDeleted(int leftLine, int rightLine, Document.Element text)
      Invoked for a deleted element
      Specified by:
      onDeleted in interface ChangeListener
      Parameters:
      leftLine - the index of the left element
      rightLine - the index of the right element
      text - the element
    • onInserted

      public void onInserted(int leftLine, int rightLine, Document.Element text)
      Invoked for an inserted element
      Specified by:
      onInserted in interface ChangeListener
      Parameters:
      leftLine - the index of the left element
      rightLine - the index of the right element
      text - the element