OpenOffice.org
XMerge API

org.openoffice.xmerge.merger.diff
Class IteratorRowCompare

java.lang.Object
  |
  +--org.openoffice.xmerge.merger.diff.IteratorRowCompare
All Implemented Interfaces:
DiffAlgorithm

public class IteratorRowCompare
extends java.lang.Object
implements DiffAlgorithm

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.


Constructor Summary
IteratorRowCompare()
           
 
Method Summary
 Difference[] computeDiffs(Iterator orgSeq, Iterator modSeq)
          Compute the differences of the given two sequences.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IteratorRowCompare

public IteratorRowCompare()
Method Detail

computeDiffs

public Difference[] computeDiffs(Iterator orgSeq,
                                 Iterator modSeq)
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.
Specified by:
computeDiffs in interface DiffAlgorithm
Parameters:
orgSeq - The original sequence.
modSeq - The modified (or changed) sequence to compare against with the origial.
Returns:
An array of Difference objects.

OpenOffice.org
XMerge API

Copyright © 2002 OpenOffice.org