org.eclipse.jgit.merge

## Class MergeResult<S extends Sequence>

- java.lang.Object
- - org.eclipse.jgit.merge.MergeResult<S>

Type Parameters:
  `S` - type of sequence.

All Implemented Interfaces:
  Iterable<MergeChunk>

    public class MergeResult<S extends Sequence>
    extends Object
    implements Iterable<MergeChunk>

The result of merging a number of `Sequence` objects. These sequences have one common predecessor sequence. The result of a merge is a list of MergeChunks. Each MergeChunk contains either a range (a subsequence) from one of the merged sequences, a range from the common predecessor or a conflicting range from one of the merged sequences. A conflict will be reported as multiple chunks, one for each conflicting range. The first chunk for a conflict is marked specially to distinguish the border between two consecutive conflicts.

This class does not know anything about how to present the merge result to the end-user. MergeFormatters have to be used to construct something human readable.

### Constructor Summary

Constructors
Constructor and Description
`MergeResult(List<S> sequences)` Creates a new empty MergeResult

### Method Summary

Methods
`void` `add(int srcIdx, int begin, int end, MergeChunk.ConflictState conflictState)` Adds a new range from one of the merged sequences or from the common predecessor.
`boolean` `containsConflicts()`
`List<S>` `getSequences()` Returns the common predecessor sequence and the merged sequence in one list.
`Iterator<MergeChunk>` `iterator()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MergeResult

    public MergeResult(List<S> sequences)

Creates a new empty MergeResult

Parameters:
  `sequences` - contains the common predecessor sequence at position 0 followed by the merged sequences. This list should not be modified anymore during the lifetime of this `MergeResult`.

### Method Detail

#### add

    public void add(int srcIdx,
           int begin,
           int end,
           MergeChunk.ConflictState conflictState)

Adds a new range from one of the merged sequences or from the common predecessor. This method can add conflicting and non-conflicting ranges controlled by the conflictState parameter

Parameters:
  `srcIdx` - determines from which sequence this range comes. An index of x specifies the x+1 element in the list of sequences specified to the constructor
  `begin` - the first element from the specified sequence which should be included in the merge result. Indexes start with 0.
  `end` - specifies the end of the range to be added. The element this index points to is the first element which not added to the merge result. All elements between begin (including begin) and this element are added.
  `conflictState` - when set to NO_CONLICT a non-conflicting range is added. This will end implicitly all open conflicts added before.

#### getSequences

    public List<S> getSequences()

Returns the common predecessor sequence and the merged sequence in one list. The common predecessor is is the first element in the list

Returns:
  the common predecessor at position 0 followed by the merged sequences.

#### iterator

    public Iterator<MergeChunk> iterator()

Specified by:
  `iterator` in interface `Iterable<MergeChunk>`
Returns:
  an iterator over the MergeChunks. The iterator does not support the remove operation

#### containsConflicts

    public boolean containsConflicts()

Returns:
  true if this merge result contains conflicts