Class LowLevelDiffAlgorithm

  • Direct Known Subclasses:
    HistogramDiff

    public abstract class LowLevelDiffAlgorithm
    extends DiffAlgorithm
    Compares two sequences primarily based upon hash codes.
    • Constructor Detail

      • LowLevelDiffAlgorithm

        public LowLevelDiffAlgorithm()
    • Method Detail

      • diffNonCommon

        public <S extends SequenceEditList diffNonCommon​(SequenceComparator<? super S> cmp,
                                                           S a,
                                                           S b)
        Compare two sequences and identify a list of edits between them. This method should be invoked only after the two sequences have been proven to have no common starting or ending elements. The expected elimination of common starting and ending elements is automatically performed by the DiffAlgorithm.diff(SequenceComparator, Sequence, Sequence) method, which invokes this method using Subsequences.
        Specified by:
        diffNonCommon in class DiffAlgorithm
        Parameters:
        cmp - the comparator supplying the element equivalence function.
        a - the first (also known as old or pre-image) sequence. Edits returned by this algorithm will reference indexes using the 'A' side: Edit.getBeginA(), Edit.getEndA().
        b - the second (also known as new or post-image) sequence. Edits returned by this algorithm will reference indexes using the 'B' side: Edit.getBeginB(), Edit.getEndB().
        Returns:
        a modifiable edit list comparing the two sequences.
      • diffNonCommon

        public abstract <S extends Sequence> void diffNonCommon​(EditList edits,
                                                                HashedSequenceComparator<S> cmp,
                                                                HashedSequence<S> a,
                                                                HashedSequence<S> b,
                                                                Edit region)
        Compare two sequences and identify a list of edits between them. This method should be invoked only after the two sequences have been proven to have no common starting or ending elements. The expected elimination of common starting and ending elements is automatically performed by the DiffAlgorithm.diff(SequenceComparator, Sequence, Sequence) method, which invokes this method using Subsequences.
        Parameters:
        edits - result list to append the region's edits onto.
        cmp - the comparator supplying the element equivalence function.
        a - the first (also known as old or pre-image) sequence. Edits returned by this algorithm will reference indexes using the 'A' side: Edit.getBeginA(), Edit.getEndA().
        b - the second (also known as new or post-image) sequence. Edits returned by this algorithm will reference indexes using the 'B' side: Edit.getBeginB(), Edit.getEndB().
        region - the region being compared within the two sequences.