当前位置: 首页>>代码示例>>Java>>正文


Java ConcurrentIntObjectMap类代码示例

本文整理汇总了Java中com.intellij.util.containers.ConcurrentIntObjectMap的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentIntObjectMap类的具体用法?Java ConcurrentIntObjectMap怎么用?Java ConcurrentIntObjectMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConcurrentIntObjectMap类属于com.intellij.util.containers包,在下文中一共展示了ConcurrentIntObjectMap类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: storeIds

import com.intellij.util.containers.ConcurrentIntObjectMap; //导入依赖的package包/类
private void storeIds(@NotNull ConcurrentIntObjectMap<int[]> fileToForwardIds) {
  int forwardSize = 0;
  int backwardSize = 0;
  final TIntObjectHashMap<TIntArrayList> fileToBackwardIds = new TIntObjectHashMap<TIntArrayList>(fileToForwardIds.size());
  for (ConcurrentIntObjectMap.IntEntry<int[]> entry : fileToForwardIds.entries()) {
    int fileId = entry.getKey();
    int[] forwardIds = entry.getValue();
    forwardSize += forwardIds.length;
    for (int forwardId : forwardIds) {
      TIntArrayList backIds = fileToBackwardIds.get(forwardId);
      if (backIds == null) {
        backIds = new TIntArrayList();
        fileToBackwardIds.put(forwardId, backIds);
      }
      backIds.add(fileId);
      backwardSize++;
    }
  }
  log("backwardSize = " + backwardSize);
  log("forwardSize = " + forwardSize);
  log("fileToForwardIds.size() = "+fileToForwardIds.size());
  log("fileToBackwardIds.size() = "+fileToBackwardIds.size());
  assert forwardSize == backwardSize;

  // wrap in read action so that sudden quit (in write action) would not interrupt us
  myApplication.runReadAction(new Runnable() {
    @Override
    public void run() {
      if (!myApplication.isDisposed()) {
        fileToBackwardIds.forEachEntry(new TIntObjectProcedure<TIntArrayList>() {
          @Override
          public boolean execute(int fileId, TIntArrayList backIds) {
            storage.addAll(fileId, backIds.toNativeArray());
            return true;
          }
        });
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:RefResolveServiceImpl.java

示例2: clearIdCache

import com.intellij.util.containers.ConcurrentIntObjectMap; //导入依赖的package包/类
@Override
public void clearIdCache() {
  // remove all except myRootsById contents
  for (Iterator<ConcurrentIntObjectMap.IntEntry<VirtualFileSystemEntry>> iterator = myIdToDirCache.entries().iterator(); iterator.hasNext(); ) {
    ConcurrentIntObjectMap.IntEntry<VirtualFileSystemEntry> entry = iterator.next();
    int id = entry.getKey();
    if (!myRootsById.containsKey(id)) {
      iterator.remove();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PersistentFSImpl.java

示例3: getParents

import com.intellij.util.containers.ConcurrentIntObjectMap; //导入依赖的package包/类
@NotNull
public static TIntArrayList getParents(int id, @NotNull ConcurrentIntObjectMap<?> idCache) {
  TIntArrayList result = new TIntArrayList(10);
  r.lock();
  try {
    int parentId;
    do {
      result.add(id);
      if (idCache.containsKey(id)) {
        break;
      }
      parentId = getRecordInt(id, PARENT_OFFSET);
      if (parentId == id || result.size() % 128 == 0 && result.contains(parentId)) {
        LOG.error("Cyclic parent child relations in the database. id = " + parentId);
        return result;
      }
      id = parentId;
    } while (parentId != 0);
  }
  catch (Throwable e) {
    throw DbConnection.handleError(e);
  }
  finally {
    r.unlock();
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:FSRecords.java

示例4: findKeyByName

import com.intellij.util.containers.ConcurrentIntObjectMap; //导入依赖的package包/类
/**
 * @deprecated access to Key via its name is a kind of hack, use Key instance directly instead
 */
@Nullable
public static Key<?> findKeyByName(String name) {
  for (ConcurrentIntObjectMap.IntEntry<Key> key : allKeys.entries()) {
    if (name.equals(key.getValue().myName)) {
      //noinspection unchecked
      return key.getValue();
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:Key.java

示例5: put

import com.intellij.util.containers.ConcurrentIntObjectMap; //导入依赖的package包/类
public static void put(@Nonnull UserDataHolder holder, Icon icon, int flags) {
  ConcurrentIntObjectMap<Icon> map = holder.getUserData(LAST_COMPUTED_ICON);
  if (icon == null) {
    if (map != null) {
      map.remove(flags);
    }
  }
  else {
    if (map == null) {
      map = ((UserDataHolderEx)holder).putUserDataIfAbsent(LAST_COMPUTED_ICON, ContainerUtil.createConcurrentIntObjectMap());
    }
    map.put(flags, icon);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:Iconable.java

示例6: getParents

import com.intellij.util.containers.ConcurrentIntObjectMap; //导入依赖的package包/类
@Nonnull
public static TIntArrayList getParents(int id, @Nonnull ConcurrentIntObjectMap<?> idCache) {
  TIntArrayList result = new TIntArrayList(10);
  r.lock();
  try {
    int parentId;
    do {
      result.add(id);
      if (idCache.containsKey(id)) {
        break;
      }
      parentId = getRecordInt(id, PARENT_OFFSET);
      if (parentId == id || result.size() % 128 == 0 && result.contains(parentId)) {
        LOG.error("Cyclic parent child relations in the database. id = " + parentId);
        return result;
      }
      id = parentId;
    } while (parentId != 0);
  }
  catch (Throwable e) {
    throw DbConnection.handleError(e);
  }
  finally {
    r.unlock();
  }
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:28,代码来源:FSRecords.java

示例7: findKeyByName

import com.intellij.util.containers.ConcurrentIntObjectMap; //导入依赖的package包/类
@Override
public Key<?> findKeyByName(String name, Function<Key<?>, String> nameFunc) {
  for (ConcurrentIntObjectMap.IntEntry<Key> key : myAllKeys.entries()) {
    if (name.equals(nameFunc.fun(key.getValue()))) {
      //noinspection unchecked
      return key.getValue();
    }
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:KeyRegistryImpl.java

示例8: ChannelFutureAwarePromise

import com.intellij.util.containers.ConcurrentIntObjectMap; //导入依赖的package包/类
public ChannelFutureAwarePromise(int messageId, ConcurrentIntObjectMap<?> messageCallbackMap) {
  this.messageId = messageId;
  this.messageCallbackMap = messageCallbackMap;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:Client.java

示例9: get

import com.intellij.util.containers.ConcurrentIntObjectMap; //导入依赖的package包/类
@Nullable
public static Icon get(@Nonnull UserDataHolder holder, int flags) {
  ConcurrentIntObjectMap<Icon> map = holder.getUserData(LAST_COMPUTED_ICON);
  return map == null ? null : map.get(flags);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:Iconable.java


注:本文中的com.intellij.util.containers.ConcurrentIntObjectMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。