private Invoker<T> selectForKey(long hash) { Map.Entry<Long, Invoker<T>> entry = virtualInvokers.ceilingEntry(hash); if (entry == null) { entry = virtualInvokers.firstEntry(); } return entry.getValue(); }
private Invoker<T> selectForKey(long hash) { Map.Entry<Long, Invoker<T>> entry = virtualInvokers.ceilingEntry(hash); if (entry == null) { entry = virtualInvokers.firstEntry(); } return entry.getValue(); }
private @Nullable Map.Entry<Long, Long> ceilingExpiryEntryForPublishTime(long publishTimeMs) { return manifestPublishTimeToExpiryTimeUs.ceilingEntry(publishTimeMs); }
protected Entry<Integer, ColumnFamilyHandle> getHandler(int timeoutSecond) { Entry<Integer, ColumnFamilyHandle> ceilingEntry = windowHandlers.ceilingEntry(timeoutSecond); if (ceilingEntry != null) { return ceilingEntry; } else { return windowHandlers.firstEntry(); } }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
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); }
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; }
@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(); }
/** * 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; }
@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); } }
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); }
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();
sortedConsumers.ceilingEntry(required - got);
sortedConsumers.ceilingEntry(required - got);
sortedConsumers.ceilingEntry(required - got);
Map.Entry<Long, BitSetNode> rightEntry = map.ceilingEntry(procId); if (rightEntry != null) { rightNode = rightEntry.getValue();
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(); }