當前位置: 首頁>>代碼示例>>Java>>正文


Java Range.openClosed方法代碼示例

本文整理匯總了Java中com.google.common.collect.Range.openClosed方法的典型用法代碼示例。如果您正苦於以下問題:Java Range.openClosed方法的具體用法?Java Range.openClosed怎麽用?Java Range.openClosed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.Range的用法示例。


在下文中一共展示了Range.openClosed方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: create

import com.google.common.collect.Range; //導入方法依賴的package包/類
/**
 * Returns a new {@link MetricPoint} representing a value at a specific {@link Instant}.
 *
 * <p>Callers should insure that the count of {@code labelValues} matches the count of labels for
 * the given metric.
 */
@VisibleForTesting
public static <V> MetricPoint<V> create(
    Metric<V> metric, ImmutableList<String> labelValues, Instant timestamp, V value) {
  MetricsUtils.checkLabelValuesLength(metric, labelValues);

  return new AutoValue_MetricPoint<>(
      metric, labelValues, Range.openClosed(timestamp, timestamp), value);
}
 
開發者ID:google,項目名稱:java-monitoring-client-library,代碼行數:15,代碼來源:MetricPoint.java

示例2: computeLocality

import com.google.common.collect.Range; //導入方法依賴的package包/類
private void computeLocality(ParquetMetadata footer) throws ExecutionSetupException {
  try {
    BlockMetaData block = footer.getBlocks().get(readEntry.getRowGroupIndex());

    BlockLocation[] blockLocations = fs.getFileBlockLocations(new Path(readEntry.getPath()), block.getStartingPos(), block.getCompressedSize());

    String localHost = InetAddress.getLocalHost().getCanonicalHostName();

    List<Range<Long>> intersectingRanges = new ArrayList<>();

    Range<Long> rowGroupRange = Range.openClosed(block.getStartingPos(), block.getStartingPos() + block.getCompressedSize());

    for (BlockLocation loc : blockLocations) {
      for (String host : loc.getHosts()) {
        if (host.equals(localHost)) {
          intersectingRanges.add(Range.closedOpen(loc.getOffset(), loc.getOffset() + loc.getLength()).intersection(rowGroupRange));
        }
      }
    }

    long totalIntersect = 0;
    for (Range<Long> range : intersectingRanges) {
      totalIntersect += (range.upperEndpoint() - range.lowerEndpoint());
    }
    if (totalIntersect < block.getCompressedSize()) {
      context.getStats().addLongStat(Metric.NUM_REMOTE_READERS, 1);
    } else {
      context.getStats().addLongStat(Metric.NUM_REMOTE_READERS, 0);
    }
  } catch (IOException e) {
    throw new ExecutionSetupException(e);
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:34,代碼來源:UnifiedParquetReader.java


注:本文中的com.google.common.collect.Range.openClosed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。