本文整理汇总了Java中com.intellij.util.containers.MostlySingularMultiMap类的典型用法代码示例。如果您正苦于以下问题:Java MostlySingularMultiMap类的具体用法?Java MostlySingularMultiMap怎么用?Java MostlySingularMultiMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MostlySingularMultiMap类属于com.intellij.util.containers包,在下文中一共展示了MostlySingularMultiMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doCollect
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
@NotNull
private List<AnnotationData> doCollect(@NotNull PsiModifierListOwner listOwner, boolean onlyWritable) {
String externalName = getExternalName(listOwner, false);
if (externalName == null) return NO_DATA;
List<PsiFile> files = findExternalAnnotationsFiles(listOwner);
if (files == null) return NO_DATA;
SmartList<AnnotationData> result = new SmartList<AnnotationData>();
for (PsiFile file : files) {
if (!file.isValid()) continue;
if (onlyWritable && !file.isWritable()) continue;
MostlySingularMultiMap<String, AnnotationData> fileData = getDataFromFile(file);
ContainerUtil.addAll(result, fileData.get(externalName));
}
if (result.isEmpty()) return NO_DATA;
result.trimToSize();
return result;
}
示例2: ensurePropertiesLoaded
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
private void ensurePropertiesLoaded() {
while (myFileModificationStamp != myFile.getModificationStamp() || myPropertiesMap == null) {
myFileModificationStamp = myFile.getModificationStamp();
MostlySingularMultiMap<String, IProperty> propertiesMap = new MostlySingularMultiMap<String, IProperty>();
XmlTag rootTag = myFile.getRootTag();
final List<IProperty> propertiesOrder = new ArrayList<IProperty>();
if (rootTag != null) {
XmlTag[] entries = rootTag.findSubTags("entry");
for (XmlTag entry : entries) {
XmlProperty property = new XmlProperty(entry, this);
propertiesOrder.add(property);
propertiesMap.add(property.getKey(), property);
}
}
final boolean isAlphaSorted = PropertiesImplUtil.isAlphaSorted(propertiesOrder);
myAlphaSorted = isAlphaSorted;
myProperties = propertiesOrder;
myPropertiesMap = propertiesMap;
}
}
示例3: ensurePropertiesLoaded
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
private void ensurePropertiesLoaded() {
if (myPropertiesMap != null) return;
final ASTNode[] props = getPropertiesList().getChildren(PropertiesElementTypes.PROPERTIES);
MostlySingularMultiMap<String, IProperty> propertiesMap = new MostlySingularMultiMap<String, IProperty>();
List<IProperty> properties = new ArrayList<IProperty>(props.length);
for (final ASTNode prop : props) {
final Property property = (Property)prop.getPsi();
String key = property.getUnescapedKey();
propertiesMap.add(key, property);
properties.add(property);
}
final boolean isAlphaSorted = PropertiesImplUtil.isAlphaSorted(properties);
synchronized (lock) {
if (myPropertiesMap != null) return;
myProperties = properties;
myPropertiesMap = propertiesMap;
myAlphaSorted = isAlphaSorted;
}
}
示例4: checkDuplicateMethod
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
@Nullable
static HighlightInfo checkDuplicateMethod(PsiClass aClass,
@NotNull PsiMethod method,
@NotNull MostlySingularMultiMap<MethodSignature, PsiMethod> duplicateMethods) {
if (aClass == null || method instanceof ExternallyDefinedPsiElement) return null;
MethodSignature methodSignature = method.getSignature(PsiSubstitutor.EMPTY);
int methodCount = 1;
List<PsiMethod> methods = (List<PsiMethod>)duplicateMethods.get(methodSignature);
if (methods.size() > 1) {
methodCount++;
}
if (methodCount == 1 && aClass.isEnum() &&
GenericsHighlightUtil.isEnumSyntheticMethod(methodSignature, aClass.getProject())) {
methodCount++;
}
if (methodCount > 1) {
String description = JavaErrorMessages.message("duplicate.method",
JavaHighlightUtil.formatMethod(method),
HighlightUtil.formatClass(aClass));
TextRange textRange = HighlightNamesUtil.getMethodDeclarationTextRange(method);
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(textRange).descriptionAndTooltip(description).create();
}
return null;
}
示例5: ensurePropertiesLoaded
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
private void ensurePropertiesLoaded() {
if (myPropertiesMap != null) return;
final ASTNode[] props = getPropertiesList().getChildren(PropertiesElementTypes.PROPERTIES);
MostlySingularMultiMap<String, IProperty> propertiesMap = new MostlySingularMultiMap<String, IProperty>();
List<IProperty> properties = new ArrayList<IProperty>(props.length);
for (final ASTNode prop : props) {
final Property property = (Property)prop.getPsi();
String key = property.getUnescapedKey();
propertiesMap.add(key, property);
properties.add(property);
}
synchronized (lock) {
if (myPropertiesMap != null) return;
myProperties = properties;
myPropertiesMap = propertiesMap;
}
}
示例6: getDuplicateMethods
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
@NotNull
private MostlySingularMultiMap<MethodSignature, PsiMethod> getDuplicateMethods(@NotNull PsiClass aClass)
{
MostlySingularMultiMap<MethodSignature, PsiMethod> signatures = myDuplicateMethods.get(aClass);
if(signatures == null)
{
signatures = new MostlySingularMultiMap<>();
for(PsiMethod method : aClass.getMethods())
{
if(method instanceof ExternallyDefinedPsiElement)
{
continue; // ignore aspectj-weaved methods; they are checked elsewhere
}
MethodSignature signature = method.getSignature(PsiSubstitutor.EMPTY);
signatures.add(signature, method);
}
myDuplicateMethods.put(aClass, signatures);
}
return signatures;
}
示例7: getResult
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
public MostlySingularMultiMap<String, AnnotationData> getResult() {
if (myData.isEmpty()) {
return MostlySingularMultiMap.emptyMap();
}
myData.compact();
return myData;
}
示例8: compute
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
@Override
public Result<MostlySingularMultiMap<String, SymbolCollectingProcessor.ResultWithContext>> compute() {
SymbolCollectingProcessor p = new SymbolCollectingProcessor();
myFile.processDeclarationsNoGuess(p, ResolveState.initial(), myFile, myFile);
MostlySingularMultiMap<String, SymbolCollectingProcessor.ResultWithContext> results = p.getResults();
return Result.create(results, PsiModificationTracker.MODIFICATION_COUNT, myFile);
}
示例9: checkDuplicateMethod
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
@Nullable
static HighlightInfo checkDuplicateMethod(PsiClass aClass,
@NotNull PsiMethod method,
@NotNull MostlySingularMultiMap<MethodSignature, PsiMethod> duplicateMethods) {
if (aClass == null || method instanceof ExternallyDefinedPsiElement) return null;
MethodSignature methodSignature = method.getSignature(PsiSubstitutor.EMPTY);
int methodCount = 1;
List<PsiMethod> methods = (List<PsiMethod>)duplicateMethods.get(methodSignature);
if (methods.size() > 1) {
methodCount++;
}
if (methodCount == 1 && aClass.isEnum() &&
GenericsHighlightUtil.isEnumSyntheticMethod(methodSignature, aClass.getProject())) {
methodCount++;
}
if (methodCount > 1) {
String description = JavaErrorMessages.message("duplicate.method",
JavaHighlightUtil.formatMethod(method),
HighlightUtil.formatClass(aClass));
TextRange textRange = HighlightNamesUtil.getMethodDeclarationTextRange(method);
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).
range(method, textRange.getStartOffset(), textRange.getEndOffset()).
descriptionAndTooltip(description).create();
}
return null;
}
示例10: getDuplicateMethods
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
@NotNull
private MostlySingularMultiMap<MethodSignature, PsiMethod> getDuplicateMethods(@NotNull PsiClass aClass) {
MostlySingularMultiMap<MethodSignature, PsiMethod> signatures = myDuplicateMethods.get(aClass);
if (signatures == null) {
signatures = new MostlySingularMultiMap<MethodSignature, PsiMethod>();
for (PsiMethod method : aClass.getMethods()) {
if (method instanceof ExternallyDefinedPsiElement) continue; // ignore aspectj-weaved methods; they are checked elsewhere
MethodSignature signature = method.getSignature(PsiSubstitutor.EMPTY);
signatures.add(signature, method);
}
myDuplicateMethods.put(aClass, signatures);
}
return signatures;
}
示例11: compute
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
@Override
public Result<MostlySingularMultiMap<String, SymbolCollectingProcessor.ResultWithContext>> compute() {
SymbolCollectingProcessor p = new SymbolCollectingProcessor();
myFile.processDeclarationsNoGuess(p, ResolveState.initial(), myFile, myFile);
MostlySingularMultiMap<String, SymbolCollectingProcessor.ResultWithContext> results = p.getResults();
return Result.create(results, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
}
示例12: getDuplicateMethods
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
@NotNull
private MostlySingularMultiMap<MethodSignature, PsiMethod> getDuplicateMethods(PsiClass aClass) {
MostlySingularMultiMap<MethodSignature, PsiMethod> signatures = myDuplicateMethods.get(aClass);
if (signatures == null) {
signatures = new MostlySingularMultiMap<MethodSignature, PsiMethod>();
for (PsiMethod method : aClass.getMethods()) {
if (method instanceof ExternallyDefinedPsiElement) continue; // ignore aspectj-weaved methods; they are checked elsewhere
MethodSignature signature = method.getSignature(PsiSubstitutor.EMPTY);
signatures.add(signature, method);
}
myDuplicateMethods.put(aClass, signatures);
}
return signatures;
}
示例13: doCollect
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
@NotNull
private List<AnnotationData> doCollect(@NotNull PsiModifierListOwner listOwner, boolean onlyWritable)
{
String externalName = getExternalName(listOwner, false);
if(externalName == null)
{
return NO_DATA;
}
List<PsiFile> files = findExternalAnnotationsFiles(listOwner);
if(files == null)
{
return NO_DATA;
}
SmartList<AnnotationData> result = new SmartList<AnnotationData>();
for(PsiFile file : files)
{
if(!file.isValid())
{
continue;
}
if(onlyWritable && !file.isWritable())
{
continue;
}
MostlySingularMultiMap<String, AnnotationData> fileData = getDataFromFile(file);
ContainerUtil.addAll(result, fileData.get(externalName));
}
if(result.isEmpty())
{
return NO_DATA;
}
result.trimToSize();
return result;
}
示例14: getResult
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
public MostlySingularMultiMap<String, AnnotationData> getResult()
{
if(myData.isEmpty())
{
return MostlySingularMultiMap.emptyMap();
}
myData.compact();
return myData;
}
示例15: compute
import com.intellij.util.containers.MostlySingularMultiMap; //导入依赖的package包/类
@Override
public Result<MostlySingularMultiMap<String, SymbolCollectingProcessor.ResultWithContext>> compute()
{
SymbolCollectingProcessor p = new SymbolCollectingProcessor();
myFile.processDeclarationsNoGuess(p, ResolveState.initial(), myFile, myFile);
MostlySingularMultiMap<String, SymbolCollectingProcessor.ResultWithContext> results = p.getResults();
return Result.create(results, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
}