/// <summary>Creates a new empty MergeChunk</summary> /// <param name="sequenceIndex"> /// determines to which sequence this chunks belongs to. Same as /// in /// <see cref="MergeResult{S}.Add(int, int, int, ConflictState)">MergeResult<S>.Add(int, int, int, ConflictState) /// </see> /// </param> /// <param name="begin"> /// the first element from the specified sequence which should be /// included in the merge result. Indexes start with 0. /// </param> /// <param name="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. /// </param> /// <param name="conflictState"> /// the state of this chunk. See /// <see cref="ConflictState">ConflictState</see> /// </param> protected internal MergeChunk(int sequenceIndex, int begin, int end, MergeChunk.ConflictState conflictState) { this.sequenceIndex = sequenceIndex; this.begin = begin; this.end = end; this.conflictState = conflictState; }
static MergeResult() { states = new MergeChunk.ConflictState[] { MergeChunk.ConflictState.NO_CONFLICT, MergeChunk.ConflictState.FIRST_CONFLICTING_RANGE, MergeChunk.ConflictState.NEXT_CONFLICTING_RANGE }; }
public override MergeChunk Next() { MergeChunk.ConflictState state = NGit.Merge.MergeResult <S> .states[this._enclosing.chunks .Get(this.idx++)]; int srcIdx = this._enclosing.chunks.Get(this.idx++); int begin = this._enclosing.chunks.Get(this.idx++); int end = this._enclosing.chunks.Get(this.idx++); return(new MergeChunk(srcIdx, begin, end, state)); }
/// <summary> /// 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 /// </summary> /// <param name="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 /// </param> /// <param name="begin"> /// the first element from the specified sequence which should be /// included in the merge result. Indexes start with 0. /// </param> /// <param name="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. /// </param> /// <param name="conflictState"> /// when set to NO_CONLICT a non-conflicting range is added. /// This will end implicitly all open conflicts added before. /// </param> public void add(int srcIdx, int begin, int end, MergeChunk.ConflictState conflictState) { _chunks.add((int)conflictState); _chunks.add(srcIdx); _chunks.add(begin); _chunks.add(end); if (conflictState != MergeChunk.ConflictState.NO_CONFLICT) { _containsConflicts = true; } }
/// <summary> /// Adds a new range from one of the merged sequences or from the common /// predecessor. /// </summary> /// <remarks> /// 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 /// </remarks> /// <param name="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 /// </param> /// <param name="begin"> /// the first element from the specified sequence which should be /// included in the merge result. Indexes start with 0. /// </param> /// <param name="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. /// </param> /// <param name="conflictState"> /// when set to NO_CONLICT a non-conflicting range is added. /// This will end implicitly all open conflicts added before. /// </param> public virtual void Add(int srcIdx, int begin, int end, MergeChunk.ConflictState conflictState) { chunks.Add((int)(conflictState)); chunks.Add(srcIdx); chunks.Add(begin); chunks.Add(end); if (conflictState != MergeChunk.ConflictState.NO_CONFLICT) { containsConflicts = true; } }
/// <summary>Creates a new empty MergeChunk</summary> /// <param name="sequenceIndex"> /// determines to which sequence this chunks belongs to. Same as /// in /// <see cref="MergeResult{S}.Add(int, int, int, ConflictState)">MergeResult<S>.Add(int, int, int, ConflictState) /// </see> /// </param> /// <param name="begin"> /// the first element from the specified sequence which should be /// included in the merge result. Indexes start with 0. /// </param> /// <param name="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. /// </param> /// <param name="conflictState"> /// the state of this chunk. See /// <see cref="ConflictState">ConflictState</see> /// </param> protected internal MergeChunk(int sequenceIndex, int begin, int end, MergeChunk.ConflictState conflictState) { this.sequenceIndex = sequenceIndex; this.begin = begin; this.end = end; this.conflictState = conflictState; }