Java Code Examples for gnu.trove.TIntHashSet#remove()

The following examples show how to use gnu.trove.TIntHashSet#remove() . 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: TranslatingCompilerFilesMonitorImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void removeSourceForRecompilation(final int projectId, final int srcId) {
  synchronized (myDataLock) {
    TIntHashSet set = mySourcesToRecompile.get(projectId);
    if (set != null) {
      set.remove(srcId);
      if (set.isEmpty()) {
        mySourcesToRecompile.remove(projectId);
      }
    }
  }
}
 
Example 2
Source File: PersistentFSImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void applyDeletions(@Nonnull MultiMap<VirtualDirectoryImpl, VFileDeleteEvent> deletions) {
  for (Map.Entry<VirtualDirectoryImpl, Collection<VFileDeleteEvent>> entry : deletions.entrySet()) {
    VirtualDirectoryImpl parent = entry.getKey();
    Collection<VFileDeleteEvent> deleteEvents = entry.getValue();
    // no valid containing directory, apply events the old way - one by one
    if (parent == null || !parent.isValid()) {
      deleteEvents.forEach(this::applyEvent);
      return;
    }

    int parentId = getFileId(parent);
    int[] oldIds = FSRecords.list(parentId);
    TIntHashSet parentChildrenIds = new TIntHashSet(oldIds);

    List<CharSequence> childrenNamesDeleted = new ArrayList<>(deleteEvents.size());
    TIntHashSet childrenIdsDeleted = new TIntHashSet(deleteEvents.size());

    for (VFileDeleteEvent event : deleteEvents) {
      VirtualFile file = event.getFile();
      int id = getFileId(file);
      childrenNamesDeleted.add(file.getNameSequence());
      childrenIdsDeleted.add(id);
      FSRecords.deleteRecordRecursively(id);
      invalidateSubtree(file);
      parentChildrenIds.remove(id);
    }
    FSRecords.updateList(parentId, parentChildrenIds.toArray());
    parent.removeChildren(childrenIdsDeleted, childrenNamesDeleted);
  }
}
 
Example 3
Source File: IntToIntSetMap.java    From consulo with Apache License 2.0 5 votes vote down vote up
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);
    }
  }
}