Package org.eclipse.jgit.diff
Class LowLevelDiffAlgorithm
java.lang.Object
org.eclipse.jgit.diff.DiffAlgorithm
org.eclipse.jgit.diff.LowLevelDiffAlgorithm
- Direct Known Subclasses:
HistogramDiff
Compares two sequences primarily based upon hash codes.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jgit.diff.DiffAlgorithm
DiffAlgorithm.SupportedAlgorithm
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <S extends Sequence>
voiddiffNonCommon
(EditList edits, HashedSequenceComparator<S> cmp, HashedSequence<S> a, HashedSequence<S> b, Edit region) Compare two sequences and identify a list of edits between them.diffNonCommon
(SequenceComparator<? super S> cmp, S a, S b) Compare two sequences and identify a list of edits between them.Methods inherited from class org.eclipse.jgit.diff.DiffAlgorithm
diff, getAlgorithm
-
Constructor Details
-
LowLevelDiffAlgorithm
public LowLevelDiffAlgorithm()
-
-
Method Details
-
diffNonCommon
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 theDiffAlgorithm.diff(SequenceComparator, Sequence, Sequence)
method, which invokes this method usingSubsequence
s.- Specified by:
diffNonCommon
in classDiffAlgorithm
- 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 theDiffAlgorithm.diff(SequenceComparator, Sequence, Sequence)
method, which invokes this method usingSubsequence
s.- 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.
-