Class DiffXFitWesyma

  extended by com.topologi.diffx.algorithm.DiffXAlgorithmBase
      extended by com.topologi.diffx.algorithm.DiffXFitWesyma
All Implemented Interfaces:

public final class DiffXFitWesyma
extends DiffXAlgorithmBase

Performs the diff comparison using the LCS algorithm.

Implementation note: this algorithm effectively detects the correct changes in the sequences, but will not necessarily return events that can be serialised as well-formed XML as they stand.

Known problem in this implementation: elements that contain themselves tend to generate events that are harder to serialise as XML.

This class is said 'fit' because it will adapt the matrix to the sequences that it is being given in order to improve performance.

Note: The name of this class comes from a contracted version of the features of this algorithm, as explained below:

This class is not synchronised.

7 April 2005
Christophe Lauret

Constructor Summary
DiffXFitWesyma(EventSequence seq0, EventSequence seq1)
          Creates a new DiffXAlgorithmBase.
Method Summary
 int length()
          Returns the length of the longest common sequence.
 void process(DiffXFormatter formatter)
          Writes the diff sequence using the specified formatter.
Methods inherited from class com.topologi.diffx.algorithm.DiffXAlgorithmBase
getFirstSequence, getSecondSequence
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public DiffXFitWesyma(EventSequence seq0,
                      EventSequence seq1)
Creates a new DiffXAlgorithmBase.

seq0 - The first sequence to compare.
seq1 - The second sequence to compare.
Method Detail


public int length()
Returns the length of the longest common sequence.

the length of the longest common sequence.


public void process(DiffXFormatter formatter)
             throws IOException
Writes the diff sequence using the specified formatter.

formatter - The formatter that will handle the output.
IOException - If thrown by the formatter.