当前位置: 首页>>代码示例>>Java>>正文


Java MutableDouble.doubleValue方法代码示例

本文整理汇总了Java中org.apache.commons.lang.mutable.MutableDouble.doubleValue方法的典型用法代码示例。如果您正苦于以下问题:Java MutableDouble.doubleValue方法的具体用法?Java MutableDouble.doubleValue怎么用?Java MutableDouble.doubleValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang.mutable.MutableDouble的用法示例。


在下文中一共展示了MutableDouble.doubleValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: accumulateStoreMetric

import org.apache.commons.lang.mutable.MutableDouble; //导入方法依赖的package包/类
/**
 * Used to accumulate store metrics across multiple regions in a region
 * server.  These metrics are not "persistent", i.e. we keep overriding them
 * on every update instead of incrementing, so we need to accumulate them in
 * a temporary map before pushing them to the global metric collection.
 * @param tmpMap a temporary map for accumulating store metrics
 * @param storeMetricType the store metric type to increment
 * @param val the value to add to the metric
 */
public void accumulateStoreMetric(final Map<String, MutableDouble> tmpMap,
    StoreMetricType storeMetricType, double val) {
  final String key = getStoreMetricName(storeMetricType);
  if (tmpMap.get(key) == null) {
    tmpMap.put(key, new MutableDouble(val));
  } else {
    tmpMap.get(key).add(val);
  }

  if (this == ALL_SCHEMA_METRICS) {
    // also compute the max value across all Stores on this server
    final String maxKey = getStoreMetricNameMax(storeMetricType);
    MutableDouble cur = tmpMap.get(maxKey);
    if (cur == null) {
      tmpMap.put(maxKey, new MutableDouble(val));
    } else if (cur.doubleValue() < val) {
      cur.setValue(val);
    }
  } else {
    ALL_SCHEMA_METRICS.accumulateStoreMetric(tmpMap, storeMetricType, val);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:32,代码来源:SchemaMetrics.java

示例2: processTuple

import org.apache.commons.lang.mutable.MutableDouble; //导入方法依赖的package包/类
private void processTuple(KeyValPair<MerchantKey, Long> tuple)
{
  MerchantKey merchantKey = tuple.getKey();
  MutableDouble lastSma = lastSMAMap.get(tuple.getKey());
  long txValue = tuple.getValue();
  if (lastSma != null && txValue > lastSma.doubleValue()) {
    double lastSmaValue = lastSma.doubleValue();
    double change = txValue - lastSmaValue;
    if (change > threshold) { // generate an alert
      AverageAlertData data = getOutputData(merchantKey, txValue, change, lastSmaValue);
      alerts.add(data);
      //if (userGenerated) {   // if its user generated only the pass it to WebSocket
      if (merchantKey.merchantType == MerchantTransaction.MerchantType.BRICK_AND_MORTAR) {
        avgAlertNotificationPort.emit(getOutputData(data, String.format(brickMortarAlertMsg, txValue, change, lastSmaValue, merchantKey.merchantId, merchantKey.terminalId)));
      } else { // its internet based
        avgAlertNotificationPort.emit(getOutputData(data, String.format(internetAlertMsg, txValue, change, lastSmaValue, merchantKey.merchantId)));

      }
      //}
    }
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:23,代码来源:AverageAlertingOperator.java

示例3: process

import org.apache.commons.lang.mutable.MutableDouble; //导入方法依赖的package包/类
/**
 * Process each key, compute change or percent, and emit it.
 */
@Override
public void process(KeyValPair<K, V> tuple)
{
  K key = tuple.getKey();
  if (!doprocessKey(key)) {
    return;
  }
  MutableDouble bval = basemap.get(key);
  if (bval != null) { // Only process keys that are in the basemap
    double cval = tuple.getValue().doubleValue() - bval.doubleValue();
    change.emit(new KeyValPair<K, V>(cloneKey(key), getValue(cval)));
    percent.emit(new KeyValPair<K, Double>(cloneKey(key), (cval / bval.doubleValue()) * 100));
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:18,代码来源:ChangeKeyVal.java

示例4: doWork

import org.apache.commons.lang.mutable.MutableDouble; //导入方法依赖的package包/类
@Override
public Object doWork() {
    final List<PileupSummary> sites = filterSites(PileupSummary.readFromFile(inputPileupSummariesTable));

    // used the matched normal to genotype (i.e. find hom alt sites) if available
    final List<PileupSummary> genotypingSites = matchedPileupSummariesTable == null ? sites :
            filterSites(PileupSummary.readFromFile(matchedPileupSummariesTable));

    // we partition the genome into contiguous allelic copy-number segments in order to infer the local minor
    // allele fraction at each site.  This is important because a minor allele fraction close to 1/2 (neutral)
    // allows hets and hom alts to be distinguished easily, while a low minor allele fraction makes it harder
    // to discriminate.  It is crucial to know which site are true hom alts and which sites are hets with
    // loss of heterozygosity.  We do this for the genotyping sample because that is the sample from which
    // the hom alts are deduced.
    final List<List<PileupSummary>> genotypingSegments = findSegments(genotypingSites);


    List<PileupSummary> homAltGenotypingSites = new ArrayList<>();
    final MutableDouble genotypingContamination = new MutableDouble(INITIAL_CONTAMINATION_GUESS);

    for (int iteration = 0; iteration < MAX_ITERATIONS; iteration++) {
        List<List<PileupSummary>> homAltSitesBySegment = Arrays.asList(new ArrayList<>());
        final MutableDouble minorAlleleFractionThreshold = new MutableDouble(STRICT_LOH_MAF_THRESHOLD);
        while (homAltSitesBySegment.stream().mapToInt(List::size).sum() < DESIRED_MINIMUM_HOM_ALT_COUNT && minorAlleleFractionThreshold.doubleValue() > 0) {
            homAltSitesBySegment = genotypingSegments.stream()
                    .map(segment -> segmentHomAlts(segment, genotypingContamination.doubleValue(), minorAlleleFractionThreshold.doubleValue()))
                    .collect(Collectors.toList());
            minorAlleleFractionThreshold.subtract(MINOR_ALLELE_FRACTION_STEP_SIZE);
        }
        homAltGenotypingSites = homAltSitesBySegment.stream().flatMap(List::stream).collect(Collectors.toList());
        final double newGenotypingContamination = calculateContamination(homAltGenotypingSites, errorRate(genotypingSites)).getLeft();
        if (Math.abs(newGenotypingContamination - genotypingContamination.doubleValue()) < CONTAMINATION_CONVERGENCE_THRESHOLD) {
            break;
        }
        genotypingContamination.setValue(newGenotypingContamination);
    }

    final List<PileupSummary> homAltSites = subsetSites(sites, homAltGenotypingSites);
    final Pair<Double, Double> contaminationAndError = calculateContamination(homAltSites, errorRate(sites));
    final double contamination = contaminationAndError.getLeft();
    final double error = contaminationAndError.getRight();
    ContaminationRecord.writeToFile(Arrays.asList(new ContaminationRecord(ContaminationRecord.Level.WHOLE_BAM.toString(), contamination, error)), outputTable);

    return "SUCCESS";
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:46,代码来源:CalculateContamination.java


注:本文中的org.apache.commons.lang.mutable.MutableDouble.doubleValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。