com.clearspring.analytics.stream.quantile.QDigest.value2leaf()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(81)

本文整理了Java中com.clearspring.analytics.stream.quantile.QDigest.value2leaf方法的一些代码示例,展示了QDigest.value2leaf的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QDigest.value2leaf方法的具体详情如下:
包路径:com.clearspring.analytics.stream.quantile.QDigest
类名称:QDigest
方法名:value2leaf

QDigest.value2leaf介绍

暂无

代码示例

代码示例来源:origin: addthis/stream-lib

@Override
public void offer(long value) {
  if (value < 0 || value > Long.MAX_VALUE / 2) {
    throw new IllegalArgumentException("Can only accept values in the range 0.." + Long.MAX_VALUE / 2 + ", got " + value);
  }
  // Rebuild if the value is too large for the current tree height
  if (value >= capacity) {
    rebuildToCapacity(Long.highestOneBit(value) << 1);
  }
  long leaf = value2leaf(value);
  node2count.addTo(leaf, 1);
  size++;
  // Always compress at the inserted node, and recompress fully
  // if the tree becomes too large.
  // This is one sensible strategy which both is fast and keeps
  // the tree reasonably small (within the theoretical bound of 3k nodes)
  compressUpward(leaf);
  if (node2count.size() > 3 * compressionFactor) {
    compressFully();
  }
}

代码示例来源:origin: com.addthis/stream-lib

@Override
public void offer(long value) {
  if (value < 0 || value > Long.MAX_VALUE / 2) {
    throw new IllegalArgumentException("Can only accept values in the range 0.." + Long.MAX_VALUE / 2 + ", got " + value);
  }
  // Rebuild if the value is too large for the current tree height
  if (value >= capacity) {
    rebuildToCapacity(Long.highestOneBit(value) << 1);
  }
  long leaf = value2leaf(value);
  node2count.addTo(leaf, 1);
  size++;
  // Always compress at the inserted node, and recompress fully
  // if the tree becomes too large.
  // This is one sensible strategy which both is fast and keeps
  // the tree reasonably small (within the theoretical bound of 3k nodes)
  compressUpward(leaf);
  if (node2count.size() > 3 * compressionFactor) {
    compressFully();
  }
}

相关文章