Class MyersDiff

    • Constructor Detail

      • MyersDiff

        public MyersDiff()
        Constructs an instance of the Myers differencing algorithm.
    • Method Detail

      • diff

        public Revision diff​(Object[] orig,
                             Object[] rev)
                      throws DifferentiationFailedException
        Computes the difference between the original sequence and the revised sequence and returns it as a org.suigeneris.jrcs.diff.Revision Revision object.

        The revision can be used to construct the revised sequence from the original sequence.

        Specified by:
        diff in interface DiffAlgorithm
        rev - the revised text
        Returns:
        the revision script.
        Throws:
        DifferentiationFailedException - if the diff could not be computed.
      • buildPath

        public static PathNode buildPath​(Object[] orig,
                                         Object[] rev)
                                  throws DifferentiationFailedException
        Computes the minimum diffpath that expresses de differences between the original and revised sequences, according to Gene Myers differencing algorithm.
        Parameters:
        orig - The original sequence.
        rev - The revised sequence.
        Returns:
        A minimum Path across the differences graph.
        Throws:
        DifferentiationFailedException - if a diff path could not be found.
      • buildRevision

        public static Revision buildRevision​(PathNode path,
                                             Object[] orig,
                                             Object[] rev)
        Constructs a Revision from a difference path.
        Parameters:
        path - The path.
        orig - The original sequence.
        rev - The revised sequence.
        Returns:
        A Revision script corresponding to the path.