本文整理了Java中com.clearspring.analytics.stream.quantile.QDigest.compressUpward
方法的一些代码示例,展示了QDigest.compressUpward
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QDigest.compressUpward
方法的具体详情如下:
包路径:com.clearspring.analytics.stream.quantile.QDigest
类名称:QDigest
方法名:compressUpward
[英]Restore P2 at node and upward the spine. Note that P2 can vanish at some nodes sideways as a result of this. We'll fix that later in compressFully when needed.
[中]恢复节点和脊椎上方的P2。请注意,P2可能因此在某些节点上横向消失。需要时,我们将稍后压缩修复该问题。
代码示例来源: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();
}
}
内容来源于网络,如有侵权,请联系作者删除!