コード例 #1
0
  /**
   * Merge all of the thread local recalibration tables into a single one.
   *
   * <p>Reuses one of the recalibration tables to hold the merged table, so this function can only
   * be called once in the engine.
   *
   * @return the merged recalibration table
   */
  @Requires("! finalized")
  private RecalibrationTables mergeThreadLocalRecalibrationTables() {
    if (recalibrationTablesList.isEmpty()) {
      recalibrationTablesList.add(
          new RecalibrationTables(covariates, numReadGroups, maybeLogStream));
    }

    RecalibrationTables merged = null;
    for (final RecalibrationTables table : recalibrationTablesList) {
      if (merged == null)
        // fast path -- if there's only only one table, so just make it the merged one
        merged = table;
      else {
        merged.combine(table);
      }
    }

    return merged;
  }