com.intellij.util.containers.hash.LinkedHashMap Java Examples
The following examples show how to use
com.intellij.util.containers.hash.LinkedHashMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GradleValue.java From ok-gradle with Apache License 2.0 | 6 votes |
@Deprecated @NotNull static <V> Map<String, V> getValues(@Nullable Map<String, ? extends GradleValue<V>> gradleValues) { if (gradleValues == null) { return ImmutableMap.of(); } Map<String, V> values = new LinkedHashMap<>(); for (Map.Entry<String, ? extends GradleValue<V>> gradleValueEntry : gradleValues.entrySet()) { V value = gradleValueEntry.getValue().value(); if (value != null) { values.put(gradleValueEntry.getKey(), value); } } return values; }
Example #2
Source File: SLRUMap.java From consulo with Apache License 2.0 | 6 votes |
public SLRUMap(final int protectedQueueSize, final int probationalQueueSize, EqualityPolicy hashingStrategy) { myProtectedQueueSize = protectedQueueSize * FACTOR; myProbationalQueueSize = probationalQueueSize * FACTOR; myProtectedQueue = new LinkedHashMap<K,V>(10, 0.6f, hashingStrategy) { @Override protected boolean removeEldestEntry(Map.Entry<K, V> eldest, K key, V value) { if (size() > myProtectedQueueSize) { myProbationalQueue.put(key, value); return true; } return false; } }; myProbationalQueue = new LinkedHashMap<K,V>(10, 0.6f, hashingStrategy) { protected boolean removeEldestEntry(final Map.Entry<K, V> eldest, K key, V value) { if (size() > myProbationalQueueSize) { onDropFromCache(key, value); return true; } return false; } }; }
Example #3
Source File: PagedFileStorage.java From consulo with Apache License 2.0 | 6 votes |
public StorageLock(boolean checkThreadAccess) { myDefaultStorageLockContext = new StorageLockContext(this, checkThreadAccess); mySizeLimit = UPPER_LIMIT; mySegments = new LinkedHashMap<Integer, ByteBufferWrapper>(10, 0.75f, true) { @Override protected boolean removeEldestEntry(Map.Entry<Integer, ByteBufferWrapper> eldest) { return mySize > mySizeLimit; } @Nullable @Override public ByteBufferWrapper remove(Object key) { // this method can be called after removeEldestEntry ByteBufferWrapper wrapper = super.remove(key); if (wrapper != null) { ++myMappingChangeCount; mySegmentsToRemove.offer(wrapper); mySize -= wrapper.myLength; } return wrapper; } }; }
Example #4
Source File: PagePool.java From consulo with Apache License 2.0 | 6 votes |
public PagePool(final int protectedPagesLimit, final int probationalPagesLimit) { myProbationalQueue = new LinkedHashMap<PoolPageKey,Page>(probationalPagesLimit * 2, 1, true) { @Override protected boolean removeEldestEntry(final Map.Entry<PoolPageKey, Page> eldest) { if (size() > probationalPagesLimit) { scheduleFinalization(eldest.getValue()); return true; } return false; } }; myProtectedQueue = new LinkedHashMap<PoolPageKey, Page>(protectedPagesLimit, 1, true) { @Override protected boolean removeEldestEntry(final Map.Entry<PoolPageKey, Page> eldest) { if (size() > protectedPagesLimit) { myProbationalQueue.put(eldest.getKey(), eldest.getValue()); return true; } return false; } }; }
Example #5
Source File: StatusToolTip.java From GitToolBox with Apache License 2.0 | 5 votes |
private void prepareMultiRepoTooltip(StringBand infoPart, Collection<GitRepository> repositories) { PerRepoInfoCache cache = PerRepoInfoCache.getInstance(project); Map<GitRepository, String> statuses = new LinkedHashMap<>(); final AtomicReference<GitRepository> currentRepo = new AtomicReference<>(); for (GitRepository repository : GtUtil.sort(repositories)) { cache.getInfo(repository).maybeCount().map(StatusText::format).ifPresent(statusText -> { if (repository.equals(currentRepository)) { currentRepo.set(repository); } statuses.put(repository, statusText); }); } if (!statuses.isEmpty()) { if (infoPart.length() > 0) { infoPart.append(Html.HRX); } infoPart.append( statuses.entrySet().stream().map(e -> { String repoStatus = GitUIUtil.bold(GtUtil.name(e.getKey())) + ": " + e.getValue(); if (Objects.equals(e.getKey(), currentRepo.get())) { repoStatus = Html.underline(repoStatus); } return repoStatus; }).collect(Collectors.joining(Html.BRX)) ); } }
Example #6
Source File: EditorHyperlinkSupport.java From consulo with Apache License 2.0 | 5 votes |
/** * @deprecated left for API compatibility */ @Deprecated public Map<RangeHighlighter, HyperlinkInfo> getHyperlinks() { LinkedHashMap<RangeHighlighter, HyperlinkInfo> result = new LinkedHashMap<>(); for (RangeHighlighter highlighter : getHyperlinks(0, myEditor.getDocument().getTextLength(), myEditor)) { HyperlinkInfo info = getHyperlinkInfo(highlighter); if (info != null) { result.put(highlighter, info); } } return result; }
Example #7
Source File: ConsoleLog.java From aem-ide-tooling-4-intellij with Apache License 2.0 | 4 votes |
public static LogEntry formatForLog(@NotNull final Notification notification, String indent) { DocumentImpl logDoc = new DocumentImpl("", true); AtomicBoolean showMore = new AtomicBoolean(false); Map<RangeMarker, HyperlinkInfo> links = new LinkedHashMap<RangeMarker, HyperlinkInfo>(); List<RangeMarker> lineSeparators = new ArrayList<RangeMarker>(); String title = truncateLongString(showMore, notification.getTitle()); String content = truncateLongString(showMore, notification.getContent()); RangeMarker afterTitle = null; boolean hasHtml = parseHtmlContent(title, notification, logDoc, showMore, links, lineSeparators); if(StringUtil.isNotEmpty(title)) { if(StringUtil.isNotEmpty(content)) { appendText(logDoc, ": "); afterTitle = logDoc.createRangeMarker(logDoc.getTextLength() - 2, logDoc.getTextLength()); } } hasHtml |= parseHtmlContent(content, notification, logDoc, showMore, links, lineSeparators); String status = getStatusText(logDoc, showMore, lineSeparators, hasHtml); indentNewLines(logDoc, lineSeparators, afterTitle, hasHtml, indent); ArrayList<Pair<TextRange, HyperlinkInfo>> list = new ArrayList<Pair<TextRange, HyperlinkInfo>>(); for(RangeMarker marker : links.keySet()) { if(!marker.isValid()) { showMore.set(true); continue; } list.add(Pair.create(new TextRange(marker.getStartOffset(), marker.getEndOffset()), links.get(marker))); } if(showMore.get()) { String sb = "show balloon"; if(!logDoc.getText().endsWith(" ")) { appendText(logDoc, " "); } appendText(logDoc, "(" + sb + ")"); list.add(new Pair<TextRange, HyperlinkInfo>(TextRange.from(logDoc.getTextLength() - 1 - sb.length(), sb.length()), new ShowBalloon(notification))); } return new LogEntry(logDoc.getText(), status, list); }