java.util.TreeMap.ceilingEntry()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(148)

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

TreeMap.ceilingEntry介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-dubbo

private Invoker<T> selectForKey(long hash) {
  Map.Entry<Long, Invoker<T>> entry = virtualInvokers.ceilingEntry(hash);
  if (entry == null) {
    entry = virtualInvokers.firstEntry();
  }
  return entry.getValue();
}

代码示例来源:origin: apache/incubator-dubbo

private Invoker<T> selectForKey(long hash) {
  Map.Entry<Long, Invoker<T>> entry = virtualInvokers.ceilingEntry(hash);
  if (entry == null) {
    entry = virtualInvokers.firstEntry();
  }
  return entry.getValue();
}

代码示例来源:origin: google/ExoPlayer

private @Nullable Map.Entry<Long, Long> ceilingExpiryEntryForPublishTime(long publishTimeMs) {
 return manifestPublishTimeToExpiryTimeUs.ceilingEntry(publishTimeMs);
}

代码示例来源:origin: alibaba/jstorm

protected Entry<Integer, ColumnFamilyHandle> getHandler(int timeoutSecond) {
  Entry<Integer, ColumnFamilyHandle> ceilingEntry = windowHandlers.ceilingEntry(timeoutSecond);
  if (ceilingEntry != null) {
    return ceilingEntry;
  } else {
    return windowHandlers.firstEntry();
  }
}

代码示例来源:origin: alipay/sofa-rpc

/**
 * Select for key.
 *
 * @param hash the hash
 * @return the provider
 */
private ProviderInfo selectForKey(long hash) {
  Map.Entry<Long, ProviderInfo> entry = virtualNodes.ceilingEntry(hash);
  if (entry == null) {
    entry = virtualNodes.firstEntry();
  }
  return entry.getValue();
}

代码示例来源:origin: alipay/sofa-rpc

/**
 * Select for key.
 *
 * @param hash the hash
 * @return the provider
 */
private ProviderInfo selectForKey(long hash) {
  Map.Entry<Long, ProviderInfo> entry = virtualNodes.ceilingEntry(hash);
  if (entry == null) {
    entry = virtualNodes.firstEntry();
  }
  return entry.getValue();
}

代码示例来源:origin: alipay/sofa-rpc

/**
 * Select for key.
 *
 * @param hash the hash
 * @return the provider
 */
private ProviderInfo selectForKey(long hash) {
  Map.Entry<Long, ProviderInfo> entry = virtualNodes.ceilingEntry(hash);
  if (entry == null) {
    entry = virtualNodes.firstEntry();
  }
  return entry.getValue();
}

代码示例来源:origin: alipay/sofa-rpc

/**
 * Select for key.
 *
 * @param hash the hash
 * @return the provider
 */
private ProviderInfo selectForKey(long hash) {
  Map.Entry<Long, ProviderInfo> entry = virtualNodes.ceilingEntry(hash);
  if (entry == null) {
    entry = virtualNodes.firstEntry();
  }
  return entry.getValue();
}

代码示例来源:origin: stanfordnlp/CoreNLP

String getSeparatorBetween(Tree right, Tree left) {
 if (right == null || left == null) {
  return null;
 }
 int leftHead = ShiftReduceUtils.headIndex(left);
 int rightHead = ShiftReduceUtils.headIndex(right);
 Map.Entry<Integer, String> nextSeparator = separators.ceilingEntry(leftHead);
 if (nextSeparator == null || nextSeparator.getKey() > rightHead) {
  return null;
 }
 return nextSeparator.getValue().substring(0, 1);
}

代码示例来源:origin: linkedin/parseq

long getStallsSince(long lastUpdate) {
 long stall = 0;
 Entry<Long, Long> entry = _stalls.ceilingEntry(lastUpdate);
 while(entry != null) {
  stall += entry.getValue();
  entry = _stalls.higherEntry(entry.getKey());
 }
 return stall;
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

@Override
public synchronized ByteBuffer getBuffer(boolean direct, int length) {
 TreeMap<Key, ByteBuffer> tree = getBufferTree(direct);
 Map.Entry<Key, ByteBuffer> entry =
   tree.ceilingEntry(new Key(length, 0));
 if (entry == null) {
  return direct ? ByteBuffer.allocateDirect(length) :
          ByteBuffer.allocate(length);
 }
 tree.remove(entry.getKey());
 return entry.getValue();
}

代码示例来源:origin: orbit/orbit

/**
 * Uses consistent hashing to determine the "owner" of a certain key.
 *
 * @param key
 * @return the NodeAddress of the node that's supposed to own the key.
 */
public NodeAddress getConsistentHashOwner(final String key)
{
  final String keyHash = getHash(key);
  final TreeMap<String, NodeInfo> currentHashes = consistentHashNodeTree;
  Map.Entry<String, NodeInfo> info = currentHashes.ceilingEntry(keyHash);
  if (info == null)
  {
    info = currentHashes.firstEntry();
  }
  return info.getValue().address;
}

代码示例来源:origin: alibaba/jstorm

@Override
public void put(String key, Object value, int timeoutSecond) {
  Entry<Integer, TimeCacheMap<String, Object>> ceilingEntry = cacheWindows.ceilingEntry(timeoutSecond);
  if (ceilingEntry == null) {
    put(key, value);
  } else {
    remove(key);
    ceilingEntry.getValue().put(key, value);
  }
}

代码示例来源:origin: EngineHub/WorldEdit

private double arcToParameter(double arc) {
  if (cache.isEmpty())
    throw new IllegalStateException("Must call setNodes first.");
  if (arc > 1) arc = 1;
  arc *= totalArcLength;
  Entry<Double, Double> floorEntry = cache.floorEntry(arc);
  final double leftArc = floorEntry.getKey();
  final double leftParameter = floorEntry.getValue();
  if (leftArc == arc) {
    return leftParameter;
  }
  Entry<Double, Double> ceilingEntry = cache.ceilingEntry(arc);
  if (ceilingEntry == null) {
    log.warning("Error in arcToParameter: no ceiling entry for " + arc + " found!");
    return 0;
  }
  final double rightArc = ceilingEntry.getKey();
  final double rightParameter = ceilingEntry.getValue();
  if (rightArc == arc) {
    return rightParameter;
  }
  return evaluate(arc, leftArc, leftParameter, rightArc, rightParameter);
}

代码示例来源:origin: apache/incubator-druid

while (it.hasNext()) {
 Interval interval = it.next().getInterval();
 Map.Entry<Long, Long> ceiling = granularThresholds.ceilingEntry(granularity.bucketStart(interval.getEnd()).getMillis());
 if (ceiling == null || interval.getStartMillis() >= ceiling.getValue()) {
  it.remove();

代码示例来源:origin: org.apache.spark/spark-core_2.10

sortedConsumers.ceilingEntry(required - got);

代码示例来源:origin: org.apache.spark/spark-core_2.11

sortedConsumers.ceilingEntry(required - got);

代码示例来源:origin: org.apache.spark/spark-core

sortedConsumers.ceilingEntry(required - got);

代码示例来源:origin: apache/hbase

Map.Entry<Long, BitSetNode> rightEntry = map.ceilingEntry(procId);
if (rightEntry != null) {
 rightNode = rightEntry.getValue();

代码示例来源:origin: stackoverflow.com

TreeMap<Long,Object> map = new TreeMap<Long,Object>();
Long key = 42;
Map.Entry<Long,Object> low = map.floorEntry(key);
Map.Entry<Long,Object> high = map.ceilingEntry(key);
Object res = null;
if (low != null && high != null) {
  res = Math.abs(key-low.getKey()) < Math.abs(key-high.getKey())
  ?   low.getValue()
  :   high.getValue();
} else if (low != null || high != null) {
  res = low != null ? low.getValue() : high.getValue();
}

相关文章

微信公众号

最新文章

更多