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


Java Pair.getSecond方法代码示例

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


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

示例1: compute

import org.apache.accumulo.core.util.Pair; //导入方法依赖的package包/类
@Override
protected Double compute(List<Pair<Key, Double>> values) {

    Iterator<Pair<Key, Double>> iter = values.iterator();
    Pair<Key, Double> first = iter.next();
    Long firstTs = first.getFirst().getTimestamp();
    Double firstVal = first.getSecond();
    LOG.trace("first ts:{}, value:{}", firstTs, firstVal);

    Pair<Key, Double> second = iter.next();
    Long secondTs = second.getFirst().getTimestamp();
    Double secondVal = second.getSecond();
    LOG.trace("second ts:{}, value:{}", secondTs, secondVal);

    if (isCounter && (secondVal < firstVal)) {
        if (maxCounter > 0) {
            secondVal += maxCounter;
            LOG.trace("second counter reset based on max:{} to ts:{}, value:{}", maxCounter, secondTs, secondVal);
        } else {
            secondVal += firstVal;
            LOG.trace("second counter reset based on first:{} to ts:{}, value:{}", firstVal, secondTs, secondVal);
        }
    }

    long timeDiff = secondTs - firstTs;
    if (timeDiff == 0) {
        return 0.0D;
    }
    Double result = ((secondVal - firstVal) / timeDiff);
    LOG.trace("compute - result: {}", result);

    if (isCounter && resetValue > 0 && result > resetValue) {
        result = 0.0D;
        LOG.trace("compute - reset result base on {} to {}", resetValue, result);
    }

    return result;
}
 
开发者ID:NationalSecurityAgency,项目名称:timely,代码行数:39,代码来源:RateIterator.java

示例2: compute

import org.apache.accumulo.core.util.Pair; //导入方法依赖的package包/类
protected Double compute(List<Pair<Key, Double>> values) {
    double result = 0D;
    int i = 0;
    for (Pair<Key, Double> e : values) {
        LOG.trace("compute - key:{}, value: {}", e.getFirst(), e.getSecond());
        result += (filters[i] * e.getSecond());
        i++;
    }
    LOG.trace("compute - result: {}", result);
    return result;
}
 
开发者ID:NationalSecurityAgency,项目名称:timely,代码行数:12,代码来源:TimeSeriesGroupingIterator.java

示例3: setFetchColumns

import org.apache.accumulo.core.util.Pair; //导入方法依赖的package包/类
private void setFetchColumns(Scanner scanner, String fields[]) {
  fields = getFieldsToQuery(fields);
  for (String field : fields) {
    Pair<Text,Text> col = mapping.fieldMap.get(field);
    if (col != null) {
      if (col.getSecond() == null) {
        scanner.fetchColumnFamily(col.getFirst());
      } else {
        scanner.fetchColumn(col.getFirst(), col.getSecond());
      }
    } else {
      LOG.error("Mapping not found for field: " + field);
    }
  }
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:16,代码来源:AccumuloStore.java

示例4: setFetchColumns

import org.apache.accumulo.core.util.Pair; //导入方法依赖的package包/类
private void setFetchColumns(Scanner scanner, String[] fields) {
  fields = getFieldsToQuery(fields);
  for (String field : fields) {
    Pair<Text,Text> col = mapping.fieldMap.get(field);
    if (col != null) {
      if (col.getSecond() == null) {
        scanner.fetchColumnFamily(col.getFirst());
      } else {
        scanner.fetchColumn(col.getFirst(), col.getSecond());
      }
    } else {
      LOG.error("Mapping not found for field: {}", field);
    }
  }
}
 
开发者ID:apache,项目名称:gora,代码行数:16,代码来源:AccumuloStore.java

示例5: setFetchColumns

import org.apache.accumulo.core.util.Pair; //导入方法依赖的package包/类
private void setFetchColumns(Scanner scanner, String fields[]) {
  fields = getFieldsToQuery(fields);
  for (String field : fields) {
    Pair<Text,Text> col = mapping.fieldMap.get(field);
    if (col.getSecond() == null) {
      scanner.fetchColumnFamily(col.getFirst());
    } else {
      scanner.fetchColumn(col.getFirst(), col.getSecond());
    }
  }
}
 
开发者ID:maestros,项目名称:gora-oraclenosql,代码行数:12,代码来源:AccumuloStore.java


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