@Override public void onNewChunk(final String filename, final int chunk, final long delayMicros) { chunkMap.computeIfAbsent(filename, f -> new ArrayList<>()).add(chunk); } }
long key = c.getUsed(); List<MemoryConsumer> list = sortedConsumers.computeIfAbsent(key, k -> new ArrayList<>(1)); list.add(c);
long key = c.getUsed(); List<MemoryConsumer> list = sortedConsumers.computeIfAbsent(key, k -> new ArrayList<>(1)); list.add(c);
long key = c.getUsed(); List<MemoryConsumer> list = sortedConsumers.computeIfAbsent(key, k -> new ArrayList<>(1)); list.add(c);
public List<Group> getGroups(int field) { return groups.computeIfAbsent(field, k -> new ArrayList<>()); }
public List<Group> getGroups(int field) { return groups.computeIfAbsent(field, k -> new ArrayList<>()); }
@Override public void add(SyzygyPair<Term, Poly> sPair) { sPairs.computeIfAbsent(weightFunction.applyAsInt(sPair), __ -> new TreeSet<>(selectionStrategy)).add(sPair); }
public void addNewSearcher(IndexSearcher searcher, long creationMicros, long expirationMicros) { PaginatedSearcherInfo info = new PaginatedSearcherInfo(); info.creationTimeMicros = creationMicros; info.expirationTimeMicros = expirationMicros; info.refCount = 1; this.infoBySearcher.put(searcher, info); this.searcherByCreationTime.put(creationMicros, searcher); List<IndexSearcher> expirationList = this.searchersByExpirationTime .computeIfAbsent(expirationMicros, k -> new ArrayList<>(1)); expirationList.add(searcher); }
public void addTaskToQueue(int jobPriority, JobKey task, int kickPriority, boolean toHead) { this.queueLock.lock(); try { int totalPriority = jobPriority + kickPriority; LinkedList<SpawnQueueItem> queue = this.mappedQueues.computeIfAbsent(totalPriority, i -> new LinkedList<>()); if (toHead) { queue.addFirst(new SpawnQueueItem(task, kickPriority)); } else { queue.addLast(new SpawnQueueItem(task, kickPriority)); } } finally { this.queueLock.unlock(); } }
void freeIndexSpace(long offset, short length) { if (length <= 0) throw new IllegalArgumentException("Offset=" + offset + ", length=" + length); // TODO: fragmentation! // TODO: memory bounds! if (offset + length < indexFileSize) { freeBlocks.computeIfAbsent(length, k -> new ArrayList<>()).add(new IndexSpace(offset, length)); } else { indexFileSize -= length; try { indexFile.truncate(indexFileSize); } catch (IOException e) { log.cannotTruncateIndex(e); } } }
protected static String[] from(final String fieldName, final Map<String, Copy> copyMap) { if (copyMap == null || copyMap.isEmpty()) return null; final TreeMap<Integer, List<String>> map = new TreeMap<>(); copyMap.forEach((name, copy) -> { for (Copy.To to : copy.to()) if (fieldName.equals(to.field())) map.computeIfAbsent(to.order(), order -> new ArrayList<>()).add(name); }); final List<String> globalCopyFromList = new ArrayList<>(); map.forEach((order, copyFromList) -> globalCopyFromList.addAll(copyFromList)); return globalCopyFromList.toArray(ArrayUtils.EMPTY_STRING_ARRAY); }
/** * Add a pending notification for any {@link FieldMonitor}s watching the specified field in the specified object. * This method assumes only the appropriate type of monitor is registered as a listener on the field * and that the provided old and new values have the appropriate types. * * <p> * This method should only be invoked if this.disableListenerNotifications is false. */ void addFieldChangeNotification(FieldChangeNotifier<?> notifier) { assert Thread.holdsLock(this); assert !this.disableListenerNotifications; // Get info final ObjId id = notifier.getId(); final int fieldStorageId = notifier.getStorageId(); // Does anybody care? if (!this.hasFieldMonitor(id, fieldStorageId)) return; // Add a pending field monitor notification for the specified field this.pendingNotifications.get().computeIfAbsent(fieldStorageId, i -> new ArrayList<>(2)).add(notifier); }
/** * Handles adding a command to {@link #threadMap}. * * @return the newly-added command */ protected ConcurrentTestCommand addCommand( int threadId, int order, ConcurrentTestCommand command) { assert threadId > 0; assert order > 0; TreeMap<Integer, ConcurrentTestCommand> commandMap = threadMap.computeIfAbsent(threadId, k -> new TreeMap<>()); // check for duplicate order numbers assert !commandMap.containsKey(order); commandMap.put(order, command); return command; }
/** * Adds a value for the specified slot size. * @param size byte size * @param offset file offset * @param opt optimize */ private void add(final int size, final long offset, final boolean opt) { free.computeIfAbsent(size, k -> new LongList()).add(offset); slots++; if(opt) optimize(); }
/** * Handles adding a command to {@link #threadMap}. * * @return the newly-added command */ protected ConcurrentTestCommand addCommand( int threadId, int order, ConcurrentTestCommand command) { assert threadId > 0; assert order > 0; TreeMap<Integer, ConcurrentTestCommand> commandMap = threadMap.computeIfAbsent(threadId, k -> new TreeMap<>()); // check for duplicate order numbers assert !commandMap.containsKey(order); commandMap.put(order, command); return command; }
/** * @inheritDoc */ public Map<Date, List<WeblogEntry>> getWeblogEntryObjectMap(WeblogEntrySearchCriteria wesc) throws WebloggerException { TreeMap<Date, List<WeblogEntry>> map = new TreeMap<>(Collections.reverseOrder()); List<WeblogEntry> entries = getWeblogEntries(wesc); Calendar cal = Calendar.getInstance(); if (wesc.getWeblog() != null) { cal.setTimeZone(wesc.getWeblog().getTimeZoneInstance()); } for (WeblogEntry entry : entries) { Date sDate = DateUtil.getNoonOfDay(entry.getPubTime(), cal); List<WeblogEntry> dayEntries = map.computeIfAbsent(sDate, k -> new ArrayList<>()); dayEntries.add(entry); } return map; }
/** * Adds a value for the specified slot size. * @param size byte size * @param offset file offset * @param opt optimize */ private void add(final int size, final long offset, final boolean opt) { free.computeIfAbsent(size, k -> new LongList()).add(offset); slots++; if(opt) optimize(); }
/** * helper method for ensuring get(storageTable).get(updatePeriod).get(partitionColumn) gives a non-null object. * <p></p> * kind of like mkdir -p * * @param timeLineKey storage table * @param updatePeriod update period * @param partitionColumn partition column * @return timeline if already exists, or puts a new timeline and returns. */ public PartitionTimeline ensureEntry(String timeLineKey, String storagTableName, UpdatePeriod updatePeriod, String partitionColumn) { return this .computeIfAbsent(timeLineKey, s -> new TreeMap<>()) .computeIfAbsent(updatePeriod, k -> new CaseInsensitiveStringHashMap<>()) .computeIfAbsent(partitionColumn, c -> PartitionTimelineFactory.get( CubeMetastoreClient.this, storagTableName, updatePeriod, c)); }
/** * helper method for ensuring get(storageTable).get(updatePeriod).get(partitionColumn) gives a non-null object. * <p></p> * kind of like mkdir -p * * @param timeLineKey storage table * @param updatePeriod update period * @param partitionColumn partition column * @return timeline if already exists, or puts a new timeline and returns. */ public PartitionTimeline ensureEntry(String timeLineKey, String storagTableName, UpdatePeriod updatePeriod, String partitionColumn) { return this .computeIfAbsent(timeLineKey, s -> new TreeMap<>()) .computeIfAbsent(updatePeriod, k -> new CaseInsensitiveStringHashMap<>()) .computeIfAbsent(partitionColumn, c -> PartitionTimelineFactory.get( CubeMetastoreClient.this, storagTableName, updatePeriod, c)); }
private void addProdFor(String name, Expression e) throws FuseMapFillerException { ProdInput pt = new ProdInput(getInputCount()); if (e instanceof Operation.And) { Operation.And and = (Operation.And) e; for (Expression z : and.getExpressions()) pt.add(z); } else pt.add(e); StateSet o = termMap.computeIfAbsent(pt, k -> new StateSet(getOutputCount())); o.set(getOutNum(name)); }