public class MyersDiff extends Object implements DiffAlgorithm
See the paper at http://www.cs.arizona.edu/people/gene/PAPERS/diff.ps
Delta
,
Revision
,
Diff
Constructor and Description |
---|
MyersDiff()
Constructs an instance of the Myers differencing algorithm.
|
Modifier and Type | Method and Description |
---|---|
static PathNode |
buildPath(Object[] orig,
Object[] rev)
Computes the minimum diffpath that expresses de differences between the original and revised
sequences, according to Gene Myers differencing algorithm.
|
static Revision |
buildRevision(PathNode path,
Object[] orig,
Object[] rev)
Constructs a
Revision from a difference path. |
Revision |
diff(Object[] orig,
Object[] rev)
Computes the difference between the original sequence and the revised sequence and returns it
as a org.suigeneris.jrcs.diff.Revision Revision object.
|
public MyersDiff()
public Revision diff(Object[] orig, Object[] rev) throws DifferentiationFailedException
The revision can be used to construct the revised sequence from the original sequence.
diff
in interface DiffAlgorithm
rev
- the revised textDifferentiationFailedException
- if the diff could not be computed.public static PathNode buildPath(Object[] orig, Object[] rev) throws DifferentiationFailedException
orig
- The original sequence.rev
- The revised sequence.Path
across the differences graph.DifferentiationFailedException
- if a diff path could not be found.public static Revision buildRevision(PathNode path, Object[] orig, Object[] rev)
Revision
from a difference path.path
- The path.orig
- The original sequence.rev
- The revised sequence.Revision
script corresponding to the path.DifferentiationFailedException
- if a Revision
could not be built from the given path.Copyright © 2006–2022 Apache Software Foundation. All rights reserved.