private bool Merge(ref Run current, ref Run next, bool shouldInsert, int index)
{
bool mergedOverlappingIntervalIndicator = false;
if (TryCreateUnion(current, next, ref current))
{
//union made. Replace the current in place
this.runArray[index] = current;
mergedOverlappingIntervalIndicator = true;
}
else
{
current = next;
if (shouldInsert)
{
this.runArray.Insert(index + 1, next);
}
}
return mergedOverlappingIntervalIndicator;
}