Class DefaultChangeListener
- java.lang.Object
-
- org.apache.jackrabbit.vault.util.diff.DefaultChangeListener
-
- All Implemented Interfaces:
ChangeListener
public class DefaultChangeListener extends Object implements ChangeListener
Provides a default output for a diff.
-
-
Constructor Summary
Constructors Constructor Description DefaultChangeListener(PrintWriter out)
Creates a new default change listener that will write to the given writer.DefaultChangeListener(PrintWriter out, boolean debug)
Creates a new default change listener that will write to the given writer. if debug istrue
the line numbers are also included in the output.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onChangeEnd()
Invoked after a change finished.void
onChangeStart(int leftLine, int leftLen, int rightLine, int rightLen)
Invoked before a change starts.void
onDeleted(int leftLine, int rightLine, Document.Element text)
Invoked for a deleted elementvoid
onDocumentsEnd(Document left, Document right)
Invoked after the iteration over the changes finished.void
onDocumentsStart(Document left, Document right)
Invoked before the iteration over the changes start.void
onInserted(int leftLine, int rightLine, Document.Element text)
Invoked for an inserted elementvoid
onUnmodified(int leftLine, int rightLine, Document.Element text)
Invoked for an unmodified element
-
-
-
Constructor Detail
-
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 istrue
the 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:
onDocumentsStart
in 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:
onDocumentsEnd
in 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:
onChangeStart
in 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:
onChangeEnd
in interfaceChangeListener
-
onUnmodified
public void onUnmodified(int leftLine, int rightLine, Document.Element text)
Invoked for an unmodified element- Specified by:
onUnmodified
in 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:
onDeleted
in 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:
onInserted
in interfaceChangeListener
- Parameters:
leftLine
- the index of the left elementrightLine
- the index of the right elementtext
- the element
-
-