本文整理汇总了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;
}
});
}
}
});
}
示例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();
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例8: ChannelFutureAwarePromise
import com.intellij.util.containers.ConcurrentIntObjectMap; //导入依赖的package包/类
public ChannelFutureAwarePromise(int messageId, ConcurrentIntObjectMap<?> messageCallbackMap) {
this.messageId = messageId;
this.messageCallbackMap = messageCallbackMap;
}
示例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);
}