merge, that is combine overlapping periods
509540
public List<Period> _Merge( List<Period> pPeriods )
	{
		List<Period> result = new ArrayList<Period>();

		int count = pPeriods.size();
		if( count == 0 )
			return result;

		// copy the first period
		result.add( pPeriods.get( 0 ) );

		// init
		int resIdx = 0;
		int i = 1;

		while( i < count )
		{
			if( pPeriods.get( i ).getFrom().compareTo( CalendarFunctions.date_add_day( result.get( resIdx ).getTo(), 1 ) ) > 0 )
			{
				// period is disjointed, so add it
				result.add( pPeriods.get( i ) );
				resIdx++;
			}
			else
			{
				// period is jointed so merge
				result.get( resIdx ).setTo( CalendarFunctions.max_date( result.get( resIdx ).getTo(), pPeriods.get( i ).getTo() ) );
			}
			i++;
		}

		return result;
	}
1126875
function insertAndMergeSlot(slot, slotNext, mergeWithPrev, mergeWithNext) {
                    insertSlot(slot, slotNext);

                    var slotPrev = slot.prev;

                    if (slotPrev.lastInSequence) {
                        if (mergeWithPrev) {
                            delete slotPrev.lastInSequence;
                        } else {
                            slot.firstInSequence = true;
                        }

                        if (mergeWithNext) {
                            delete slotNext.firstInSequence;
                        } else {
                            slot.lastInSequence = true;
                        }
                    }
                }
810776
def combine(self, pattern, variable):
        """"""
        inter_zip = izip_longest(variable, pattern, fillvalue='')
        interleaved = [elt for pair in inter_zip for elt in pair]
        return ''.join(interleaved)
140234
def MergeLines(self, lines, message):
    """"""
    self._allow_multiple_scalars = True
    self._ParseOrMerge(lines, message)
    return message
729710
protected int[] mergePeriodInto(int[] values, ReadablePeriod period) {
        for (int i = 0, isize = period.size(); i < isize; i++) {
            DurationFieldType type = period.getFieldType(i);
            int value = period.getValue(i);
            checkAndUpdate(type, values, value);
        }
        return values;
    }
987828
def merge_intervals(intervals):
    
    if intervals is None:
        return None
    intervals.sort(key=lambda i: i[0])
    out = [intervals.pop(0)]
    for i in intervals:
        if out[-1][-1] >= i[0]:
            out[-1][-1] = max(out[-1][-1], i[-1])
        else:
            out.append(i)
    return out
557420
def _merge_maps(m1, m2):
    """"""
    return type(m1)(chain(m1.items(), m2.items()))
725720
def merge_Fm(dfs_data):
    """"""
    FG = dfs_data['FG']
    m = FG['m']
    FGm = FG[m]
    FGm1 = FG[m-1]

    if FGm[0]['u'] < FGm1[0]['u']:
        FGm1[0]['u'] = FGm[0]['u']

    if FGm[0]['v'] > FGm1[0]['v']:
        FGm1[0]['v'] = FGm[0]['v']

    if FGm[1]['x'] < FGm1[1]['x']:
        FGm1[1]['x'] = FGm[1]['x']

    if FGm[1]['y'] > FGm1[1]['y']:
        FGm1[1]['y'] = FGm[1]['y']

    del FG[m]
    FG['m'] -= 1
295841
function mergeEnglishPrefixExceptions(sentence, index, paragraph) {
  var children = sentence.children
  var period = children[children.length - 1]
  var word = children[children.length - 2]
  var value
  var next

  if (period && toString(period) === '.' && word && word.type === 'WordNode') {
    value = toString(word)

    if (ABBREVIATION.test(lower(value)) || ABBREVIATION_SENSITIVE.test(value)) {
      /* Merge period into abbreviation. */
      word.children.push(period)
      children.pop()

      if (period.position && word.position) {
        word.position.end = period.position.end
      }

      /* Merge sentences. */
      next = paragraph.children[index + 1]

      if (next) {
        sentence.children = children.concat(next.children)

        paragraph.children.splice(index + 1, 1)

        /* Update position. */
        if (next.position && sentence.position) {
          sentence.position.end = next.position.end
        }

        /* Next, iterate over the current node again. */
        return index - 1
      }
    }
  }
}
1085377
public void mergedRegion(int firstRow, int lastRow, int firstCol, int lastCol) {
        mergedRegion(workbook.getSheetAt(sheetIndex), firstRow, lastRow, firstCol, lastCol);
    }
243198
def overlap(xl1, yl1, nx1, ny1, xl2, yl2, nx2, ny2):
    
    return (xl2 < xl1+nx1 and xl2+nx2 > xl1 and
            yl2 < yl1+ny1 and yl2+ny2 > yl1)
639767
function mergeAdjacent (markups) {
  var i

  for (i = 0; i < markups.length - 1; i += 1) {
    if (!canMerge(markups[i], markups[i + 1]))
      continue

    markups[i].end = Math.max(markups[i].end, markups[i + 1].end)
    markups.splice(i + 1, 1)
    i -= 1
  }
}
971618
def combine_xml_points(l, units, handle_units):
    """"""
    ret = {}
    for item in l:
        for key, value in item.items():
            ret.setdefault(key, []).append(value)

    for key, value in ret.items():
        if key != 'date':
            ret[key] = handle_units(value, units.get(key, None))

    return ret
455891
function combine(m1, m2) {
  return [
    m1[0]*m2[0] + m1[2]*m2[1],
    m1[1]*m2[0] + m1[3]*m2[1],
    m1[0]*m2[2] + m1[2]*m2[3],
    m1[1]*m2[2] + m1[3]*m2[3],
    m1[0]*m2[4] + m1[2]*m2[5] + m1[4],
    m1[1]*m2[4] + m1[3]*m2[5] + m1[5]
  ];
}
128568
def merge_overlaps(in_file, data, distance=None, out_dir=None):
    
    config = data["config"]
    if in_file:
        bedtools = config_utils.get_program("bedtools", config,
                                            default="bedtools")
        work_dir = tz.get_in(["dirs", "work"], data)
        if out_dir:
            bedprep_dir = out_dir
        elif work_dir:
            bedprep_dir = utils.safe_makedir(os.path.join(work_dir, "bedprep"))
        else:
            bedprep_dir = os.path.dirname(in_file)
        out_file = os.path.join(bedprep_dir, "%s-merged.bed" % (utils.splitext_plus(os.path.basename(in_file))[0]))
        if not utils.file_uptodate(out_file, in_file):
            with file_transaction(data, out_file) as tx_out_file:
                distance = "-d %s" % distance if distance else ""
                cmd = "{bedtools} merge {distance} -i {in_file} > {tx_out_file}"
                do.run(cmd.format(**locals()), "Prepare merged BED file", data)
        vcfutils.bgzip_and_index(out_file, data["config"], remove_orig=False)
        return out_file
424283
def merge(self, other):
        
        newstart = min(self._start, other.start)
        newend = max(self._end, other.end)
        return Range(newstart, newend)
517427
def ts_merge(series):
    '''
    '''
    series = iter(series)
    ts = next(series)
    return ts.merge(series)