public K lastKey() { return this.treeMap.lastKey(); }
@Override public K lastKey() { return this.treeMap.lastKey(); }
@Override public K lastKey() { return this.treeMap.lastKey(); }
public int removeBiggest() { Integer last = indexes.lastKey(); indexes.remove(last); return last; }
public int removeBiggest() { Integer last = indexes.lastKey(); indexes.remove(last); return last; }
/** * Gets the last row on the sheet * * @return last row contained n this sheet (0-based) */ @Override public int getLastRowNum() { return _rows.size() == 0 ? 0 : _rows.lastKey(); }
public long getMaxSpan() { try { this.lockTreeMap.readLock().lockInterruptibly(); try { if (!this.msgTreeMap.isEmpty()) { return this.msgTreeMap.lastKey() - this.msgTreeMap.firstKey(); } } finally { this.lockTreeMap.readLock().unlock(); } } catch (InterruptedException e) { log.error("getMaxSpan exception", e); } return 0; }
/** * Returns the largest key in this symbol table. * * @return the largest key in this symbol table * @throws NoSuchElementException if this symbol table is empty */ public Key max() { if (isEmpty()) throw new NoSuchElementException("calls max() with empty symbol table"); return st.lastKey(); }
/** * 下一个随机对象 * * @return 随机对象 */ public T next() { if(MapUtil.isEmpty(this.weightMap)) { return null; } final double randomWeight = this.weightMap.lastKey() * random.nextDouble(); final SortedMap<Double, T> tailMap = this.weightMap.tailMap(randomWeight, false); return this.weightMap.get(tailMap.firstKey()); }
/** * 下一个随机对象 * * @return 随机对象 */ public T next() { if(MapUtil.isEmpty(this.weightMap)) { return null; } final double randomWeight = this.weightMap.lastKey() * random.nextDouble(); final SortedMap<Double, T> tailMap = this.weightMap.tailMap(randomWeight, false); return this.weightMap.get(tailMap.firstKey()); }
void updateOnBufferChange() { if (aggBufMap.size() > aggregateBufferSizeLimit) { aggBufMap.pollLastEntry(); Preconditions.checkState(aggBufMap.size() == aggregateBufferSizeLimit); } currentLastKey = aggBufMap.lastKey(); }
long getMaxKey() { return getKetamaNodes().lastKey(); }
public int loadCurrentOmemoSignedPreKeyId(OmemoDevice userDevice) { return loadOmemoSignedPreKeys(userDevice).lastKey(); }
public long commit() { try { this.lockTreeMap.writeLock().lockInterruptibly(); try { Long offset = this.consumingMsgOrderlyTreeMap.lastKey(); msgCount.addAndGet(0 - this.consumingMsgOrderlyTreeMap.size()); for (MessageExt msg : this.consumingMsgOrderlyTreeMap.values()) { msgSize.addAndGet(0 - msg.getBody().length); } this.consumingMsgOrderlyTreeMap.clear(); if (offset != null) { return offset + 1; } } finally { this.lockTreeMap.writeLock().unlock(); } } catch (InterruptedException e) { log.error("commit exception", e); } return -1; }
@Override public void add( String fileName, FileStream fileWriterOutputStream ) { long index = 0; if ( size() > 0 ) { index = indexMap.lastKey() + 1; } FileStreamsCollectionEntry newEntry = new FileStreamsCollectionEntry( fileName, index, fileWriterOutputStream ); fileNameMap.put( fileName, newEntry ); indexMap.put( index, newEntry ); if ( fileWriterOutputStream.isOpen() ) { numOpenFiles++; } }
/** * 增加对象权重 * * @param weightObj 权重对象 * @return this */ public WeightRandom<T> add(WeightObj<T> weightObj) { if(null != weightObj) { final double weight = weightObj.getWeight(); if(weightObj.getWeight() > 0) { double lastWeight = (this.weightMap.size() == 0) ? 0 : this.weightMap.lastKey(); this.weightMap.put(weight + lastWeight, weightObj.getObj());// 权重累加 } } return this; }
/** * 增加对象权重 * * @param weightObj 权重对象 * @return this */ public WeightRandom<T> add(WeightObj<T> weightObj) { if(null != weightObj) { final double weight = weightObj.getWeight(); if(weightObj.getWeight() > 0) { double lastWeight = (this.weightMap.size() == 0) ? 0 : this.weightMap.lastKey(); this.weightMap.put(weight + lastWeight, weightObj.getObj());// 权重累加 } } return this; }
public void fillProcessQueueInfo(final ProcessQueueInfo info) { try { this.lockTreeMap.readLock().lockInterruptibly(); if (!this.msgTreeMap.isEmpty()) { info.setCachedMsgMinOffset(this.msgTreeMap.firstKey()); info.setCachedMsgMaxOffset(this.msgTreeMap.lastKey()); info.setCachedMsgCount(this.msgTreeMap.size()); info.setCachedMsgSizeInMiB((int) (this.msgSize.get() / (1024 * 1024))); } if (!this.consumingMsgOrderlyTreeMap.isEmpty()) { info.setTransactionMsgMinOffset(this.consumingMsgOrderlyTreeMap.firstKey()); info.setTransactionMsgMaxOffset(this.consumingMsgOrderlyTreeMap.lastKey()); info.setTransactionMsgCount(this.consumingMsgOrderlyTreeMap.size()); } info.setLocked(this.locked); info.setTryUnlockTimes(this.tryUnlockTimes.get()); info.setLastLockTimestamp(this.lastLockTimestamp); info.setDroped(this.dropped); info.setLastPullTimestamp(this.lastPullTimestamp); info.setLastConsumeTimestamp(this.lastConsumeTimestamp); } catch (Exception e) { } finally { this.lockTreeMap.readLock().unlock(); } }