LibreOffice Module xmerge (master) 1
Public Member Functions | Private Member Functions | List of all members
org.openoffice.xmerge.merger.diff.IteratorRowCompare Class Reference

A very simple and direct difference algorithm for row Node objects in a spreadsheet. More...

Inheritance diagram for org.openoffice.xmerge.merger.diff.IteratorRowCompare:
[legend]
Collaboration diagram for org.openoffice.xmerge.merger.diff.IteratorRowCompare:
[legend]

Public Member Functions

Difference[] computeDiffs (Iterator orgSeq, Iterator modSeq)
 Compute the differences of the given two sequences. More...
 
Difference[] computeDiffs (Iterator orgSeq, Iterator modSeq)
 Returns a Difference array. More...
 

Private Member Functions

Element splitRepeatedRow (Element orgRow, int splitNum, int orgNum)
 

Detailed Description

A very simple and direct difference algorithm for row Node objects in a spreadsheet.

Basically, it will compare objects in sequence and does not look ahead (unlike LCS).

  1. If two objects are the same, skip to next one.
  2. Otherwise check whether the row repeated attribute is the same.
  3. If the row repeated attribute is the same, then compare two rows and mark it as change if those rows are different.
  4. If the row repeated attribute is different, then split the rows and continue to compare.
  5. If there are more objects in the modseq than the original sequence, then all of the extra ones in the modified sequence are marked as add.
  6. If there are more objects in the original sequence than the modified sequence, then all the extra one in the modified sequence are marked as delete.

NOTE: The algorithm will have potential side effect to split rows.

Definition at line 61 of file IteratorRowCompare.java.

Member Function Documentation

◆ computeDiffs()

Difference[] org.openoffice.xmerge.merger.diff.IteratorRowCompare.computeDiffs ( Iterator  orgSeq,
Iterator  modSeq 
)
inline

Compute the differences of the given two sequences.

Refer to the class description.

Return an array of Difference objects. This method finds out the difference between two sequences.

Parameters
orgSeqThe original sequence.
modSeqThe modified (or changed) sequence to compare against with the original.
Returns
An array of Difference objects.

Implements org.openoffice.xmerge.merger.DiffAlgorithm.

Definition at line 77 of file IteratorRowCompare.java.

References org.openoffice.xmerge.merger.Difference.ADD, org.openoffice.xmerge.converter.xml.OfficeConstants.ATTRIBUTE_TABLE_NUM_ROWS_REPEATED, org.openoffice.xmerge.merger.Difference.CHANGE, org.openoffice.xmerge.merger.Difference.DELETE, org.openoffice.xmerge.merger.Iterator.equivalent(), i, Integer, org.openoffice.xmerge.merger.Iterator.next(), Object, org.openoffice.xmerge.merger.Iterator.refresh(), org.openoffice.xmerge.merger.diff.IteratorRowCompare.splitRepeatedRow(), org.openoffice.xmerge.merger.Iterator.start(), and String.

◆ splitRepeatedRow()

Element org.openoffice.xmerge.merger.diff.IteratorRowCompare.splitRepeatedRow ( Element  orgRow,
int  splitNum,
int  orgNum 
)
inlineprivate

The documentation for this class was generated from the following file: