LibreOffice Module xmerge (master) 1
|
This is the Difference
basic unit.
More...
Public Member Functions | |
Difference (int operation, int orgPosition, int modPosition) | |
Constructor. More... | |
int | getOperation () |
Get the operation of the Difference . More... | |
int | getOrgPosition () |
Get the original Iterator position. More... | |
int | getModPosition () |
Get the modified Iterator position. More... | |
boolean | equals (Object obj) |
Two Difference objects will equal if and only if all operation , orgPosition , modPosition and content are equal. More... | |
int | hashCode () |
String | debug () |
Display debug information. More... | |
String | toString () |
Returns position and operation values as a single string. More... | |
Static Public Attributes | |
static final int | ADD = 1 |
Add operation. More... | |
static final int | DELETE = 2 |
Delete operation. More... | |
static final int | CHANGE = 3 |
Change operation. More... | |
static final int | UNCHANGE = 4 |
Unchange operation (i.e. More... | |
Private Attributes | |
final int | operation |
The action of the diff - either ADD or DELETE . More... | |
final int | orgPosition |
The position of the content that should be operated on (original iterator ). More... | |
final int | modPosition |
The position of the content that should be operated (modified iterator). More... | |
This is the Difference
basic unit.
Used by the DiffAlgorithm
as a set of difference between two Iterators
(the original and modified Iterators
).
Definition at line 27 of file Difference.java.
|
inline |
Constructor.
This is the standard way to create a Difference
object.
operation | Either ADD or DELETE . |
orgPosition | The position in the original (first) Iterator . |
modPosition | The position in the modified (second) Iterator . |
Definition at line 120 of file Difference.java.
References org.openoffice.xmerge.merger.Difference.modPosition, org.openoffice.xmerge.merger.Difference.operation, and org.openoffice.xmerge.merger.Difference.orgPosition.
Referenced by org.openoffice.xmerge.merger.Difference.equals().
|
inline |
Display debug information.
Definition at line 188 of file Difference.java.
References org.openoffice.xmerge.merger.Difference.ADD, org.openoffice.xmerge.merger.Difference.CHANGE, org.openoffice.xmerge.merger.Difference.DELETE, org.openoffice.xmerge.merger.Difference.modPosition, org.openoffice.xmerge.merger.Difference.operation, org.openoffice.xmerge.merger.Difference.orgPosition, String, and org.openoffice.xmerge.merger.Difference.UNCHANGE.
Referenced by org.openoffice.xmerge.converter.xml.sxc.DocumentMergerImpl.merge(), org.openoffice.xmerge.merger.merge.CharacterBaseParagraphMerge.merge(), and org.openoffice.xmerge.converter.xml.xslt.DocumentMergerImpl.merge().
|
inline |
Two Difference
objects will equal if and only if all operation
, orgPosition
, modPosition
and content
are equal.
obj | Object to compare. |
true
if equal, false
otherwise. Definition at line 165 of file Difference.java.
References org.openoffice.xmerge.merger.Difference.Difference(), org.openoffice.xmerge.merger.Difference.modPosition, org.openoffice.xmerge.merger.Difference.operation, and org.openoffice.xmerge.merger.Difference.orgPosition.
|
inline |
Get the modified Iterator
position.
Iterator
. Definition at line 151 of file Difference.java.
References org.openoffice.xmerge.merger.Difference.modPosition.
Referenced by org.openoffice.xmerge.merger.merge.CharacterBaseParagraphMerge.coreMerge().
|
inline |
Get the operation of the Difference
.
Definition at line 133 of file Difference.java.
References org.openoffice.xmerge.merger.Difference.operation.
Referenced by org.openoffice.xmerge.merger.merge.CharacterBaseParagraphMerge.coreMerge().
|
inline |
Get the original Iterator
position.
Iterator
. Definition at line 142 of file Difference.java.
References org.openoffice.xmerge.merger.Difference.orgPosition.
Referenced by org.openoffice.xmerge.merger.merge.CharacterBaseParagraphMerge.applyDifference(), and org.openoffice.xmerge.merger.merge.CharacterBaseParagraphMerge.coreMerge().
|
inline |
Definition at line 179 of file Difference.java.
|
inline |
Returns position and operation values as a single string.
orgPosition
, modPosition
and operation
as a single String
. Definition at line 219 of file Difference.java.
References org.openoffice.xmerge.merger.Difference.modPosition, org.openoffice.xmerge.merger.Difference.operation, org.openoffice.xmerge.merger.Difference.orgPosition, and String.
|
static |
Add operation.
Definition at line 30 of file Difference.java.
Referenced by org.openoffice.xmerge.merger.merge.CharacterBaseParagraphMerge.applyDifference(), org.openoffice.xmerge.merger.merge.DocumentMerge.applyDifference(), org.openoffice.xmerge.merger.diff.IteratorRowCompare.computeDiffs(), org.openoffice.xmerge.merger.merge.CharacterBaseParagraphMerge.coreMerge(), org.openoffice.xmerge.merger.Difference.debug(), org.openoffice.xmerge.merger.diff.CharArrayLCSAlgorithm.generateResult(), and org.openoffice.xmerge.merger.diff.IteratorLCSAlgorithm.generateResult().
|
static |
Change operation.
Definition at line 36 of file Difference.java.
Referenced by org.openoffice.xmerge.merger.merge.DocumentMerge.applyDifference(), org.openoffice.xmerge.merger.diff.IteratorRowCompare.computeDiffs(), org.openoffice.xmerge.merger.merge.CharacterBaseParagraphMerge.coreMerge(), org.openoffice.xmerge.merger.Difference.debug(), org.openoffice.xmerge.merger.diff.CharArrayLCSAlgorithm.generateResult(), and org.openoffice.xmerge.merger.diff.IteratorLCSAlgorithm.generateResult().
|
static |
Delete operation.
Definition at line 33 of file Difference.java.
Referenced by org.openoffice.xmerge.merger.merge.CharacterBaseParagraphMerge.applyDifference(), org.openoffice.xmerge.merger.merge.DocumentMerge.applyDifference(), org.openoffice.xmerge.merger.diff.IteratorRowCompare.computeDiffs(), org.openoffice.xmerge.merger.merge.CharacterBaseParagraphMerge.coreMerge(), org.openoffice.xmerge.merger.Difference.debug(), org.openoffice.xmerge.merger.diff.CharArrayLCSAlgorithm.generateResult(), and org.openoffice.xmerge.merger.diff.IteratorLCSAlgorithm.generateResult().
|
private |
The position of the content that should be operated (modified iterator).
For explanation and examples, see orgPosition
.
Definition at line 109 of file Difference.java.
Referenced by org.openoffice.xmerge.merger.Difference.debug(), org.openoffice.xmerge.merger.Difference.Difference(), org.openoffice.xmerge.merger.Difference.equals(), org.openoffice.xmerge.merger.Difference.getModPosition(), and org.openoffice.xmerge.merger.Difference.toString().
|
private |
The action of the diff - either ADD
or DELETE
.
Definition at line 42 of file Difference.java.
Referenced by org.openoffice.xmerge.merger.Difference.debug(), org.openoffice.xmerge.merger.Difference.Difference(), org.openoffice.xmerge.merger.Difference.equals(), org.openoffice.xmerge.merger.Difference.getOperation(), and org.openoffice.xmerge.merger.Difference.toString().
|
private |
The position of the content that should be operated on (original iterator
).
For ADD
, the orgPosition
is the position of the original sequence where the diff will insert (the element count is starting from 0, and always insert before the element). The modPosition
is the position of the diff in the modified sequence (also starting from 0).
example:
diff - <B D> and <A B C D E F>
note: <B D> is original sequence and <A B C D E F>
is the modified one.
and here is the position of those sequence:
<B D> <A B C D E F>
0 1 0 1 2 3 4 5
result:
<diff orgPos=0 modPos=0 operation=ADD> <-- element A
<diff orgPos=1 modPos=2 operation=ADD> <-- element C
<diff orgPos=2 modPos=4 operation=ADD> <-- element E
<diff orgPos=2 modPos=5 operation=ADD> <-- element F
One can notice the add operation is inserted before the position. Hence, in order to append an element, we will have a position of original sequence length + 1 to denote an append.
For DELETE
, orgPosition
is the position that the element will be deleted (starting from 0) and modPosition
is the position where the deleted element should be (consider as an ADD
).
The modPosition
is less useful and it is difficult to understand how the position is calculated. One can just skip this piece of information. It is useful if one wants to reverse the role of original sequence and modified sequence and find out the diff easily (just change add to delete and delete to add for operation and swap the orgPosition
and modPosition
).
example:
diff - <A B C D E F> and <B D>
note: <A B C D E F> is original sequence and <B D>
is the modified one.
and here is the position of those sequence:
<A B C D E F> <B D>
0 1 2 3 4 5 0 1
result:
<diff orgPos=0 modPos=0 operation=DELETE> <-- element A
<diff orgPos=2 modPos=1 operation=DELETE> <-- element C
<diff orgPos=4 modPos=2 operation=DELETE> <-- element E
<diff orgPos=5 modPos=2 operation=DELETE> <-- element F
Definition at line 102 of file Difference.java.
Referenced by org.openoffice.xmerge.merger.Difference.debug(), org.openoffice.xmerge.merger.Difference.Difference(), org.openoffice.xmerge.merger.Difference.equals(), org.openoffice.xmerge.merger.Difference.getOrgPosition(), and org.openoffice.xmerge.merger.Difference.toString().
|
static |
Unchange operation (i.e.
no change).
Definition at line 39 of file Difference.java.
Referenced by org.openoffice.xmerge.merger.merge.CharacterBaseParagraphMerge.coreMerge(), and org.openoffice.xmerge.merger.Difference.debug().