Search in sources :

Example 21 with TIntHashSet

use of gnu.trove.TIntHashSet in project intellij-community by JetBrains.

the class IntToIntSetMap method removeOccurence.

public void removeOccurence(int key, int value) {
    if (mySingle.containsKey(key)) {
        mySingle.remove(key);
        return;
    }
    TIntHashSet items = myMulti.get(key);
    if (items != null) {
        items.remove(value);
        if (items.size() == 1) {
            mySingle.put(key, items.toArray()[0]);
            myMulti.remove(key);
        }
    }
}
Also used : TIntHashSet(gnu.trove.TIntHashSet)

Example 22 with TIntHashSet

use of gnu.trove.TIntHashSet in project intellij-community by JetBrains.

the class DebugReflectionUtil method walkObjects.

public static boolean walkObjects(int maxDepth, @NotNull Collection<Object> startRoots, @NotNull final Class<?> lookFor, @NotNull Condition<Object> shouldExamineValue, @NotNull final PairProcessor<Object, BackLink> leakProcessor) {
    TIntHashSet visited = new TIntHashSet((int) (10000000 * 0.8));
    final Queue<BackLink> toVisit = new Queue<BackLink>(1000000);
    for (Object startRoot : startRoots) {
        toVisit.addLast(new BackLink(startRoot, null, null));
    }
    while (true) {
        if (toVisit.isEmpty())
            return true;
        final BackLink backLink = toVisit.pullFirst();
        if (backLink.depth > maxDepth)
            continue;
        Object value = backLink.value;
        if (lookFor.isAssignableFrom(value.getClass()) && markLeaked(value) && !leakProcessor.process(value, backLink))
            return false;
        if (visited.add(System.identityHashCode(value))) {
            queueStronglyReferencedValues(toVisit, value, shouldExamineValue, backLink);
        }
    }
}
Also used : Queue(com.intellij.util.containers.Queue) TIntHashSet(gnu.trove.TIntHashSet)

Example 23 with TIntHashSet

use of gnu.trove.TIntHashSet in project intellij-community by JetBrains.

the class DataPack method getHeads.

@NotNull
private static Set<Integer> getHeads(@NotNull List<? extends GraphCommit<Integer>> commits) {
    TIntHashSet parents = new TIntHashSet();
    for (GraphCommit<Integer> commit : commits) {
        for (int parent : commit.getParents()) {
            parents.add(parent);
        }
    }
    Set<Integer> heads = ContainerUtil.newHashSet();
    for (GraphCommit<Integer> commit : commits) {
        if (!parents.contains(commit.getId())) {
            heads.add(commit.getId());
        }
    }
    return heads;
}
Also used : TIntHashSet(gnu.trove.TIntHashSet) NotNull(org.jetbrains.annotations.NotNull)

Example 24 with TIntHashSet

use of gnu.trove.TIntHashSet in project intellij-community by JetBrains.

the class VcsLogFullDetailsIndex method getCommitsWithAnyKey.

@NotNull
public TIntHashSet getCommitsWithAnyKey(@NotNull Set<Integer> keys) throws StorageException {
    checkDisposed();
    TIntHashSet result = new TIntHashSet();
    for (Integer key : keys) {
        iterateCommitIds(key, result::add);
    }
    return result;
}
Also used : TIntHashSet(gnu.trove.TIntHashSet) NotNull(org.jetbrains.annotations.NotNull)

Example 25 with TIntHashSet

use of gnu.trove.TIntHashSet in project intellij-community by JetBrains.

the class VcsLogPersistentIndex method scheduleIndex.

@Override
public synchronized void scheduleIndex(boolean full) {
    if (myCommitsToIndex.isEmpty())
        return;
    Map<VirtualFile, TIntHashSet> commitsToIndex = myCommitsToIndex;
    for (VirtualFile root : commitsToIndex.keySet()) {
        myNumberOfTasks.get(root).incrementAndGet();
    }
    myCommitsToIndex = ContainerUtil.newHashMap();
    mySingleTaskController.request(new IndexingRequest(commitsToIndex, full));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) TIntHashSet(gnu.trove.TIntHashSet)

Aggregations

TIntHashSet (gnu.trove.TIntHashSet)50 NotNull (org.jetbrains.annotations.NotNull)16 TIntArrayList (gnu.trove.TIntArrayList)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 IOException (java.io.IOException)4 Nullable (org.jetbrains.annotations.Nullable)4 TIntProcedure (gnu.trove.TIntProcedure)3 ArrayList (java.util.ArrayList)3 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2 Processor (com.intellij.util.Processor)2 StorageException (com.intellij.util.indexing.StorageException)2 CharArrayCharSequence (com.intellij.util.text.CharArrayCharSequence)2 THashSet (gnu.trove.THashSet)2 TIntIterator (gnu.trove.TIntIterator)2 LightRef (org.jetbrains.jps.backwardRefs.LightRef)2 GenerateMembersUtil (com.intellij.codeInsight.generation.GenerateMembersUtil)1 Edge (com.intellij.codeInspection.bytecodeAnalysis.asm.ControlFlowGraph.Edge)1 CompilerReferenceFindUsagesTestInfo (com.intellij.compiler.backwardRefs.view.CompilerReferenceFindUsagesTestInfo)1 DirtyScopeTestInfo (com.intellij.compiler.backwardRefs.view.DirtyScopeTestInfo)1 PluginException (com.intellij.diagnostic.PluginException)1