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);
}
}
}
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);
}
}
}
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;
}
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;
}
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));
}
Aggregations