Package org.eclipse.jgit.merge
Class MergeAlgorithm
- java.lang.Object
-
- org.eclipse.jgit.merge.MergeAlgorithm
-
public final class MergeAlgorithm extends java.lang.ObjectProvides the merge algorithm which does a three-way merge on content provided as RawText. By defaultHistogramDiffis used as diff algorithm.
-
-
Field Summary
Fields Modifier and Type Field Description private DiffAlgorithmdiffAlgprivate static EditEND_EDIT
-
Constructor Summary
Constructors Constructor Description MergeAlgorithm()Creates a new MergeAlgorithm which usesHistogramDiffas diff algorithmMergeAlgorithm(DiffAlgorithm diff)Creates a new MergeAlgorithm
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static booleanisEndEdit(Edit edit)<S extends Sequence>
MergeResult<S>merge(SequenceComparator<S> cmp, S base, S ours, S theirs)Does the three way merge between a common base and two sequences.private static EditnextEdit(java.util.Iterator<Edit> it)Helper method which returns the next Edit for an Iterator over Edits.
-
-
-
Field Detail
-
diffAlg
private final DiffAlgorithm diffAlg
-
END_EDIT
private static final Edit END_EDIT
-
-
Constructor Detail
-
MergeAlgorithm
public MergeAlgorithm()
Creates a new MergeAlgorithm which usesHistogramDiffas diff algorithm
-
MergeAlgorithm
public MergeAlgorithm(DiffAlgorithm diff)
Creates a new MergeAlgorithm- Parameters:
diff- the diff algorithm used by this merge
-
-
Method Detail
-
isEndEdit
private static boolean isEndEdit(Edit edit)
-
merge
public <S extends Sequence> MergeResult<S> merge(SequenceComparator<S> cmp, S base, S ours, S theirs)
Does the three way merge between a common base and two sequences.- Parameters:
cmp- comparison method for this execution.base- the common base sequenceours- the first sequence to be mergedtheirs- the second sequence to be merged- Returns:
- the resulting content
-
nextEdit
private static Edit nextEdit(java.util.Iterator<Edit> it)
Helper method which returns the next Edit for an Iterator over Edits. When there are no more edits left this method will return the constant END_EDIT.- Parameters:
it- the iterator for which the next edit should be returned- Returns:
- the next edit from the iterator or END_EDIT if there no more edits
-
-