Package com.day.util.diff
Class DefaultChangeListener
- java.lang.Object
-
- com.day.util.diff.DefaultChangeListener
-
- All Implemented Interfaces:
ChangeListener
public class DefaultChangeListener extends java.lang.Object implements ChangeListener
Provides a default output for a diff.
-
-
Field Summary
-
Fields inherited from interface com.day.util.diff.ChangeListener
CVS_ID
-
-
Constructor Summary
Constructors Constructor Description DefaultChangeListener(java.io.PrintWriter out)Creates a new default change listener that will write to the given writer.DefaultChangeListener(java.io.PrintWriter out, boolean debug)Creates a new default change listener that will write to the given writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonChangeEnd()Invoked after a change finished.voidonChangeStart(int leftLine, int leftLen, int rightLine, int rightLen)Invoked before a change starts.voidonDeleted(int leftLine, int rightLine, Document.Element text)Invoked for a deleted elementvoidonDocumentsEnd(Document left, Document right)Invoked after the iteration over the changes finished.voidonDocumentsStart(Document left, Document right)Invoked before the iteration over the changes start.voidonInserted(int leftLine, int rightLine, Document.Element text)Invoked for an inserted elementvoidonUnmodified(int leftLine, int rightLine, Document.Element text)Invoked for an unmodified element
-
-
-
Constructor Detail
-
DefaultChangeListener
public DefaultChangeListener(java.io.PrintWriter out)
Creates a new default change listener that will write to the given writer.- Parameters:
out- the writer
-
DefaultChangeListener
public DefaultChangeListener(java.io.PrintWriter out, boolean debug)Creates a new default change listener that will write to the given writer. if debug istruethe line numbers are also included in the output.- Parameters:
out- the writerdebug- flag
-
-
Method Detail
-
onDocumentsStart
public void onDocumentsStart(Document left, Document right)
Invoked before the iteration over the changes start.- Specified by:
onDocumentsStartin interfaceChangeListener- Parameters:
left- the left documentright- the right document
-
onDocumentsEnd
public void onDocumentsEnd(Document left, Document right)
Invoked after the iteration over the changes finished.- Specified by:
onDocumentsEndin interfaceChangeListener- Parameters:
left- the left documentright- the right document
-
onChangeStart
public void onChangeStart(int leftLine, int leftLen, int rightLine, int rightLen)Invoked before a change starts.- Specified by:
onChangeStartin interfaceChangeListener- 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:
onChangeEndin interfaceChangeListener
-
onUnmodified
public void onUnmodified(int leftLine, int rightLine, Document.Element text)Invoked for an unmodified element- Specified by:
onUnmodifiedin interfaceChangeListener- Parameters:
leftLine- the index of the left elementrightLine- the index of the right elementtext- the element
-
onDeleted
public void onDeleted(int leftLine, int rightLine, Document.Element text)Invoked for a deleted element- Specified by:
onDeletedin interfaceChangeListener- Parameters:
leftLine- the index of the left elementrightLine- the index of the right elementtext- the element
-
onInserted
public void onInserted(int leftLine, int rightLine, Document.Element text)Invoked for an inserted element- Specified by:
onInsertedin interfaceChangeListener- Parameters:
leftLine- the index of the left elementrightLine- the index of the right elementtext- the element
-
-