本文整理汇总了Java中com.intellij.util.containers.ConcurrentWeakHashMap类的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentWeakHashMap类的具体用法?Java ConcurrentWeakHashMap怎么用?Java ConcurrentWeakHashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConcurrentWeakHashMap类属于com.intellij.util.containers包,在下文中一共展示了ConcurrentWeakHashMap类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getVariablesToFix
import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
@NotNull
private Collection<PsiVariable> getVariablesToFix() {
Map<PsiVariable, Boolean> vars = myClass.getUserData(VARS[myFixType]);
if (vars == null) myClass.putUserData(VARS[myFixType], vars = new ConcurrentWeakHashMap<PsiVariable, Boolean>(1));
final Map<PsiVariable, Boolean> finalVars = vars;
return new AbstractCollection<PsiVariable>() {
@Override
public boolean add(PsiVariable psiVariable) {
return finalVars.put(psiVariable, Boolean.TRUE) == null;
}
@Override
public Iterator<PsiVariable> iterator() {
return finalVars.keySet().iterator();
}
@Override
public int size() {
return finalVars.size();
}
};
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:VariableAccessFromInnerClassFix.java
示例2: shouldAbbreviateName
import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
private static boolean shouldAbbreviateName(PsiPackage aPackage) {
final Project project = aPackage.getProject();
ConcurrentMap<PsiPackage, Boolean> map = project.getUserData(SHOULD_ABBREV_PACK_KEY);
if (map == null) {
final ConcurrentWeakHashMap<PsiPackage, Boolean> newMap = new ConcurrentWeakHashMap<PsiPackage, Boolean>();
map = ((UserDataHolderEx)project).putUserDataIfAbsent(SHOULD_ABBREV_PACK_KEY, newMap);
if (map == newMap) {
((PsiManagerEx)PsiManager.getInstance(project)).registerRunnableToRunOnChange(new Runnable() {
@Override
public void run() {
newMap.clear();
}
});
}
}
Boolean ret = map.get(aPackage);
if (ret != null) return ret;
ret = scanPackages(aPackage, 1);
map.put(aPackage, ret);
return ret;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:TreeViewUtil.java
示例3: LoaderFactory
import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
public LoaderFactory(final Project project) {
myProject = project;
myModule2ClassLoader = new ConcurrentWeakHashMap<Module, ClassLoader>();
myConnection = myProject.getMessageBus().connect();
myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
public void rootsChanged(final ModuleRootEvent event) {
clearClassLoaderCache();
}
});
Disposer.register(project, new Disposable() {
public void dispose() {
myConnection.disconnect();
myModule2ClassLoader.clear();
}
});
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:LoaderFactory.java
示例4: getFieldsToFix
import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
@NotNull
private Collection<SmartPsiElementPointer<PsiField>> getFieldsToFix() {
Map<SmartPsiElementPointer<PsiField>, Boolean> fields = myClass.getUserData(FIELDS);
if (fields == null) myClass.putUserData(FIELDS, fields = new ConcurrentWeakHashMap<SmartPsiElementPointer<PsiField>,Boolean>(1));
final Map<SmartPsiElementPointer<PsiField>, Boolean> finalFields = fields;
return new AbstractCollection<SmartPsiElementPointer<PsiField>>() {
@Override
public boolean add(SmartPsiElementPointer<PsiField> psiVariable) {
PsiField field = psiVariable.getElement();
if (field == null || !isAvailable(field)) return false;
return finalFields.put(psiVariable, Boolean.TRUE) == null;
}
@Override
public Iterator<SmartPsiElementPointer<PsiField>> iterator() {
return finalFields.keySet().iterator();
}
@Override
public int size() {
return finalFields.size();
}
@Override
public void clear() {
finalFields.clear();
}
};
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:30,代码来源:CreateConstructorParameterFromFieldFix.java
示例5: getUnboundedParams
import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
@NotNull
private static Collection<SmartPsiElementPointer<PsiParameter>> getUnboundedParams(PsiMethod psiMethod) {
Map<SmartPsiElementPointer<PsiParameter>, Boolean> params = psiMethod.getUserData(PARAMS);
if (params == null) psiMethod.putUserData(PARAMS, params = new ConcurrentWeakHashMap<SmartPsiElementPointer<PsiParameter>, Boolean>(1));
final Map<SmartPsiElementPointer<PsiParameter>, Boolean> finalParams = params;
return new AbstractCollection<SmartPsiElementPointer<PsiParameter>>() {
@Override
public boolean add(SmartPsiElementPointer<PsiParameter> psiVariable) {
return finalParams.put(psiVariable, Boolean.TRUE) == null;
}
@Override
public Iterator<SmartPsiElementPointer<PsiParameter>> iterator() {
return finalParams.keySet().iterator();
}
@Override
public int size() {
return finalParams.size();
}
@Override
public void clear() {
finalParams.clear();
}
};
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:BindFieldsFromParametersAction.java
示例6: xmlFileWasChanged
import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
private boolean xmlFileWasChanged(VirtualFile xmlFile, VFileEvent event) {
if (!xmlFile.isValid() || !(event instanceof VFileContentChangeEvent)) return true;
ConcurrentWeakHashMap<Project, Integer> map = xmlFile.getUserData(CRC_WITHOUT_SPACES);
if (map == null) {
map = xmlFile.putUserDataIfAbsent(CRC_WITHOUT_SPACES, new ConcurrentWeakHashMap<Project, Integer>());
}
Integer crc = map.get(myProject);
Integer newCrc;
try {
newCrc = MavenUtil.crcWithoutSpaces(xmlFile);
}
catch (IOException ignored) {
return true;
}
if (newCrc == -1 // XML is invalid
|| newCrc.equals(crc)) {
return false;
}
else {
map.put(myProject, newCrc);
return true;
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:MavenProjectsManagerWatcher.java
示例7: getTrackedIgnoredFiles
import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
/**
* Helper method to return tracked and ignored files map.
*
* @param event current event
* @return map of files
*/
private ConcurrentMap<VirtualFile, VcsRoot> getTrackedIgnoredFiles(@NotNull AnActionEvent event) {
final Project project = event.getProject();
if (project != null) {
return IgnoreManager.getInstance(project).getConfirmedIgnoredFiles();
}
return new ConcurrentWeakHashMap<VirtualFile, VcsRoot>();
}
开发者ID:hsz,项目名称:idea-gitignore,代码行数:16,代码来源:HandleTrackedIgnoredFilesAction.java
示例8: createWeakMap
import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
private static <K,V> ConcurrentWeakHashMap<K, V> createWeakMap() {
return new ConcurrentWeakHashMap<K,V>(100, 0.75f, Runtime.getRuntime().availableProcessors(), ContainerUtil.<K>canonicalStrategy());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:ResolveCache.java
示例9: createWeakMap
import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
private static <K, V> ConcurrentWeakHashMap<K, V> createWeakMap() {
return new ConcurrentWeakHashMap<K, V>(7, 0.75f, Runtime.getRuntime().availableProcessors(),
TObjectHashingStrategy.CANONICAL);
}
开发者ID:consulo,项目名称:consulo-haxe,代码行数:5,代码来源:HaxeClassResolveCache.java
示例10: CachedConcurrentMap
import com.intellij.util.containers.ConcurrentWeakHashMap; //导入依赖的package包/类
/**
* Default constructor.
*
* @param fetcher data fetcher
*/
private CachedConcurrentMap(@NotNull DataFetcher<K, V> fetcher) {
this.map = new ConcurrentWeakHashMap<K, V>();
this.fetcher = fetcher;
}
开发者ID:hsz,项目名称:idea-gitignore,代码行数:10,代码来源:CachedConcurrentMap.java
注:本文中的com.intellij.util.containers.ConcurrentWeakHashMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论