! @brief Look for pairs of data trace events and merge.
342148
def _merge_data_trace_events(self, event):
        """"""
        if isinstance(event, events.TraceDataTraceEvent):
            # Record the first data trace event.
            if self._pending_data_trace is None:
                self._pending_data_trace = event
            else:
                # We've got the second in a pair. If the comparator numbers are the same, then
                # we can merge the two events. Otherwise we just add them to the pending event
                # queue separately.
                if event.comparator == self._pending_data_trace.comparator:
                    # Merge the two data trace events.
                    ev = events.TraceDataTraceEvent(cmpn=event.comparator,
                        pc=(event.pc or self._pending_data_trace.pc),
                        addr=(event.address or self._pending_data_trace.address),
                        value=(event.value or self._pending_data_trace.value),
                        rnw=(event.is_read or self._pending_data_trace.is_read),
                        sz=(event.transfer_size or self._pending_data_trace.transfer_size),
                        ts=self._pending_data_trace.timestamp)
                else:
                    ev = self._pending_data_trace
                self._pending_events.append(ev)
                self._pending_data_trace = None
            return True
        # If we get a non-data-trace event while waiting for a second data trace event, then
        # just place the pending data trace event in the pending event queue.
        elif self._pending_data_trace is not None:
            self._pending_events.append(self._pending_data_trace)
            self._pending_data_trace = None
        return False
186859
def merge(ds, measurement, cardinality)

      m = ds.select {|k,v| k != :measurements and k != :errors and k != :warn }
      m = m.merge(measurement)
      m = m.merge ({ technology: "argos",
        type: type,
        cardinality: cardinality
        #file: "file://"+filename,
        #source: sha1
      })

      # if not ds[:errors].nil? and ds[:errors].any?
      #   m[:errors] = ds[:errors].clone
      # end
      #
      # if not ds[:warn].nil? and ds[:warn].any?
      #   m[:warn] = ds[:warn].clone
      # end
      #
      # if not m[:sensor_data].nil? and m[:sensor_data].size != ds[:sensors]
      #   if m[:warn].nil?
      #     m[:warn] = []
      #   end
      #   m[:warn] << "sensors-count-mismatch"
      # end

      # Create id as SHA1 hash of measurement minus stuff that may vary (like filename)
      #
      # Possible improvement for is to base id on a static list of keys
      # :program,
      # :platform,
      # :lines,
      # :sensors,
      # :satellite,
      # :lc,
      # :positioned,
      # :latitude,
      # :longitude,
      # :altitude,
      # :headers,
      # :measured,
      # :identical,
      # :sensor_data,
      # :technology,
      # :type,
      # :source

      idbase = m.clone
      idbase.delete :errors
      idbase.delete :file
      idbase.delete :warn

      id = Digest::SHA1.hexdigest(idbase.to_json)

      #m[:parser] = Argos.library_version
      m[:id] = id

      #m[:bundle] = bundle
      m
    end
980459
def _merge_data(self, data: AnyMapping, *additional: AnyMapping) -> dict:
        
        """
        return defaults(
            dict(data) if not isinstance(data, dict) else data,
            *(dict(item) for item in additional))
296632
def get_merge(self, path, local_destination):
        
        return list(self.get_bite().getmerge(path=path, dst=local_destination))
346162
public void merge() {
        Thread currentThread = Thread.currentThread();
        if(!stats.get(currentThread).equals(this) || currentThread instanceof WindupChildThread) {
            throw new IllegalArgumentException("Trying to merge executionstatistics from a "
                        + "different thread that is not registered as main thread of application run");
        }

        for (Thread thread : stats.keySet())
        {
            if(thread instanceof WindupChildThread && ((WindupChildThread) thread).getParentThread().equals(currentThread)) {
                merge(stats.get(thread));
            }
        }
    }
1262575
def combine_data(self, command2):
        """"""
        if command2 is None:
            return
        self._data = self._merge(command2._data, self._data)
1312660
void mergeExpiredTransactions(Session session) {

        long timestamp = getFirstLiveTransactionTimestamp();

        while (true) {
            long     commitTimestamp = 0;
            Object[] actions         = null;

            synchronized (committedTransactionTimestamps) {
                if (committedTransactionTimestamps.isEmpty()) {
                    break;
                }

                commitTimestamp = committedTransactionTimestamps.getFirst();

                if (commitTimestamp < timestamp) {
                    committedTransactionTimestamps.removeFirst();

                    actions = (Object[]) committedTransactions.removeFirst();
                } else {
                    break;
                }
            }

            mergeTransaction(session, actions, 0, actions.length,
                             commitTimestamp);
            rowActionMapRemoveTransaction(actions, 0, actions.length, true);
        }
    }
1239405
def _merge_summary(in_files, out_file, data):
    
    if not utils.file_exists(out_file):
        with file_transaction(data, out_file) as tx_out_file:
            with open(tx_out_file, "w") as out_handle:
                for i, in_file in enumerate(in_files):
                    with open(in_file) as in_handle:
                        for j, line in enumerate(in_handle):
                            if j == 0:
                                if i == 0:
                                    out_handle.write(line)
                            else:
                                out_handle.write(line)
    return out_file
122735
protected void mergeRegions() {

		// sort edges
//		long time0 = System.currentTimeMillis();
		if( sorterApprox != null ) {
			sorterApprox.computeRange(edges.data,0,edges.size);
			sorterApprox.sortObject(edges.data,0,edges.size);
		} else {
			sorter.sort(edges.data,edges.size);
		}
//		long time1 = System.currentTimeMillis();

//		System.out.println("Sort time " + (time1 - time0));

		// examine each edge to see if it can connect two regions
		for( int i = 0; i < edges.size(); i++ ) {
			// compare the two nodes connected by the edge to see if their regions they should be merged
			Edge e = edges.get(i);

			int rootA = find(e.indexA);
			int rootB = find(e.indexB);

			// see if they are already part of the same segment
			if( rootA == rootB )
				continue;

			float threshA = threshold.get(rootA);
			float threshB = threshold.get(rootB);

			if( e.weight() <= threshA && e.weight() <= threshB )  {
				// ----- Merge the two regions/components
				int sizeA = regionSize.get(rootA);
				int sizeB = regionSize.get(rootB);

				// Everything is merged into region A, so update its threshold
				threshold.data[rootA] = e.weight() + K/(sizeA + sizeB);

				// Point everything towards rootA
				graph.data[e.indexB] = rootA;
				graph.data[rootB] = rootA;

				// Update the size of regionA
				regionSize.data[rootA] = sizeA + sizeB;
			} else {
				edgesNotMatched.add(e);
			}
		}

//		long time2 = System.currentTimeMillis();
//		System.out.println("Edge merge time " + (time2 - time1));
	}
1017127
def _perform_merge(self, other):
        
        if len(other.value) > len(self.value):
            self.value = other.value[:]
        return True
370632
public static List<EventData> merge(List<EventData> eventDatas) {
        Map<RowKey, EventData> result = new LinkedHashMap<RowKey, EventData>();
        for (EventData eventData : eventDatas) {
            merge(eventData, result);
        }
        return new LinkedList<EventData>(result.values());
    }
747370
public void run()
   {
      for (;;)
      {
         boolean isIdle = false;
         if (mergeTasks.size() == 0)
         {
            mergerIdle.release();
            isIdle = true;
         }
         Merge task = (Merge)mergeTasks.remove();
         if (task == QUIT) // NOSONAR
         {
            mergerIdle.release();
            break;
         }
         if (isIdle)
         {
            try
            {
               mergerIdle.acquire();
            }
            catch (InterruptedException e)
            {
               Thread.interrupted();
               log.warn("Unable to acquire mergerIdle sync");
            }
         }

         log.debug("accepted merge request");

         // reset deleted documents
         deletedDocuments.clear();

         // get readers
         String[] names = new String[task.indexes.length];
         for (int i = 0; i < task.indexes.length; i++)
         {
            names[i] = task.indexes[i].name;
         }
         try
         {
            log.debug("create new index");
            PersistentIndex index = multiIndex.getOrCreateIndex(null);
            boolean success = false;
            try
            {

               log.debug("get index readers from MultiIndex");
               IndexReader[] readers = multiIndex.getIndexReaders(names, this);
               try
               {
                  // do the merge
                  long time = System.currentTimeMillis();
                  index.addIndexes(readers);
                  time = System.currentTimeMillis() - time;
                  int docCount = 0;
                  for (int i = 0; i < readers.length; i++)
                  {
                     docCount += readers[i].numDocs();
                  }
                  if (log.isDebugEnabled())
                  {
                     log.debug("merged " + docCount + " documents in " + time + " ms into " + index.getName() + ".");
                  }
               }
               finally
               {
                  for (int i = 0; i < readers.length; i++)
                  {
                     try
                     {
                        Util.closeOrRelease(readers[i]);
                     }
                     catch (IOException e)
                     {
                        log.warn("Unable to close IndexReader: " + e);
                     }
                  }
               }

               // inform multi index
               // if we cannot get the sync immediately we have to quit
               if (!indexReplacement.attempt(0))
               {
                  log.debug("index merging canceled");
                  // if index not passed to multiIndex, then it will never be closed
                  index.close();
                  break;
               }
               try
               {
                  log.debug("replace indexes");
                  multiIndex.replaceIndexes(names, index, deletedDocuments);
               }
               finally
               {
                  indexReplacement.release();
               }

               success = true;

            }
            finally
            {
               if (!success)
               {
                  // delete index
                  log.debug("deleting index " + index.getName());
                  multiIndex.deleteIndex(index);
               }
            }
         }
         catch (Throwable e) //NOSONAR
         {
            log.error("Error while merging indexes: ", e);
         }
      }
      if (log.isDebugEnabled())
      {
         log.debug("IndexMerger terminated");
      }
   }
461773
def _check_paired(files, force_single, separators):
    """"""
    full_name = _check_stems(files)
    if files[0].endswith(".bam"):
        return files
    elif is_gsm(files[0]):
        return files
    return combine_pairs(files, force_single, full_name, separators)
619822
def merge(self, other):
        
        Stats.merge(self, other)
        self.changes += other.changes
1277897
void merge(Settings other) {
    for (int i = 0; i < COUNT; i++) {
      if (!other.isSet(i)) continue;
      set(i, other.flags(i), other.get(i));
    }
  }
32302
void markMerged() {
        Exceptions.checkNotClosed(this.closed, this);
        Preconditions.checkState(!this.merged, "StreamSegmentReadIndex %d is already merged.", this.metadata.getId());
        log.debug("{}: Merged.", this.traceObjectId);
        this.merged = true;
    }
227301
def merged_series(cls, *series, **kwargs):
        ''''''
        router, backend = cls.check_router(None, *series)
        if backend:
            target = router.register(cls(), backend)
            router.session().add(target)
            target._merge(*series, **kwargs)
            backend = target.backend
            return backend.execute(
                backend.structure(target).irange_and_delete(),
                target.load_data)