當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。