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


Java ContainerUtil.intersects方法代码示例

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


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

示例1: isNullabilityAnnotationForTypeQualifierDefault

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static boolean isNullabilityAnnotationForTypeQualifierDefault(PsiAnnotation annotation,
                                                                      boolean nullable,
                                                                      PsiAnnotation.TargetType[] targetTypes) {
    PsiJavaCodeReferenceElement element = annotation.getNameReferenceElement();
    PsiElement declaration = element == null ? null : element.resolve();
    if (!(declaration instanceof PsiClass)) {
        return false;
    }

    String fqn = nullable ? JAVAX_ANNOTATION_NULLABLE : JAVAX_ANNOTATION_NONNULL;
    PsiClass classDeclaration = (PsiClass) declaration;
    if (!AnnotationUtil.isAnnotated(classDeclaration, fqn, false, true)) {
        return false;
    }

    PsiAnnotation tqDefault = AnnotationUtil.findAnnotation(classDeclaration, true, TYPE_QUALIFIER_DEFAULT);
    if (tqDefault == null) {
        return false;
    }

    Set<PsiAnnotation.TargetType> required = extractRequiredAnnotationTargets(tqDefault.findAttributeValue(null));
    return required != null
            && (required.isEmpty() || ContainerUtil.intersects(required, Arrays.asList(targetTypes)));
}
 
开发者ID:stylismo,项目名称:nullability-annotations-inspection,代码行数:25,代码来源:NullabilityAnnotationsWithTypeQualifierDefault.java

示例2: accept

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public boolean accept(File file) {
  final JavaSourceRootDescriptor rd = myBuildRootIndex.findJavaRootDescriptor(myContext, file);
  if (rd == null) {
    return true;
  }
  final ModuleBuildTarget targetOfFile = rd.target;
  if (myChunkTargets.contains(targetOfFile)) {
    return true;
  }
  Set<BuildTarget<?>> targetOfFileWithDependencies = myCache.get(targetOfFile);
  if (targetOfFileWithDependencies == null) {
    targetOfFileWithDependencies = myBuildTargetIndex.getDependenciesRecursively(targetOfFile, myContext);
    myCache.put(targetOfFile, targetOfFileWithDependencies);
  }
  return ContainerUtil.intersects(targetOfFileWithDependencies, myChunkTargets);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JavaBuilderUtil.java

示例3: isNullabilityDefault

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static boolean isNullabilityDefault(@NotNull PsiAnnotation annotation, boolean nullable, PsiAnnotation.TargetType[] placeTargetTypes) {
  PsiJavaCodeReferenceElement element = annotation.getNameReferenceElement();
  PsiElement declaration = element == null ? null : element.resolve();
  if (!(declaration instanceof PsiClass)) return false;

  if (!AnnotationUtil.isAnnotated((PsiClass)declaration,
                                   nullable ? JAVAX_ANNOTATION_NULLABLE : JAVAX_ANNOTATION_NONNULL,
                                   false,
                                   true)) {
    return false;
  }

  PsiAnnotation tqDefault = AnnotationUtil.findAnnotation((PsiClass)declaration, true, "javax.annotation.meta.TypeQualifierDefault");
  if (tqDefault == null) return false;

  Set<PsiAnnotation.TargetType> required = AnnotationTargetUtil.extractRequiredAnnotationTargets(tqDefault.findAttributeValue(null));
  if (required == null) return false;
  return required.isEmpty() || ContainerUtil.intersects(required, Arrays.asList(placeTargetTypes));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:NullableNotNullManager.java

示例4: getLibraries

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public List<Library> getLibraries(@NotNull Set<LibraryKind> kinds, @NotNull Project project, @Nullable StructureConfigurableContext context) {
  List<Library> libraries = new ArrayList<Library>();
  if (context != null) {
    Collections.addAll(libraries, context.getProjectLibrariesProvider().getModifiableModel().getLibraries());
    Collections.addAll(libraries, context.getGlobalLibrariesProvider().getModifiableModel().getLibraries());
  }
  else {
    final LibraryTablesRegistrar registrar = LibraryTablesRegistrar.getInstance();
    Collections.addAll(libraries, registrar.getLibraryTable(project).getLibraries());
    Collections.addAll(libraries, registrar.getLibraryTable().getLibraries());
  }

  final Iterator<Library> iterator = libraries.iterator();
  while (iterator.hasNext()) {
    Library library = iterator.next();
    final List<LibraryKind> libraryKinds = getLibraryKinds(library, context);
    if (!ContainerUtil.intersects(libraryKinds, kinds)) {
      iterator.remove();
    }
  }
  return libraries;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:LibraryPresentationManagerImpl.java

示例5: setLibraryProvider

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public void setLibraryProvider(@Nullable FrameworkLibraryProvider provider) {
  if (provider != null && !ContainerUtil.intersects(provider.getAvailableLibraryKinds(), myLibraryDescription.getSuitableLibraryKinds())) {
    provider = null;
  }

  if (!Comparing.equal(myLibraryProvider, provider)) {
    myLibraryProvider = provider;

    if (mySettings != null) {
      if (provider != null && !myUseFromProviderRadioButton.isVisible()) {
        myUseFromProviderRadioButton.setSelected(true);
      }
      myUseFromProviderRadioButton.setVisible(provider != null);
      updateState();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:LibraryOptionsPanel.java

示例6: getSelectedSteps

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public List<ModuleWizardStep> getSelectedSteps() {
  if (mySelectedSteps == null) {
    mySelectedSteps = new ArrayList<ModuleWizardStep>();
    mySelectedSteps.addAll(myCommonSteps);
    for (String type : myTypes) {
      Collection<ModuleWizardStep> steps = mySpecificSteps.get(type);
      mySelectedSteps.addAll(steps);
    }
    for (Pair<ModuleWizardStep, Set<String>> pair : myCommonFinishingSteps) {
      Set<String> types = pair.getSecond();
      if (types == null || ContainerUtil.intersects(myTypes, types)) {
        mySelectedSteps.add(pair.getFirst());
      }
    }
    ContainerUtil.removeDuplicates(mySelectedSteps);
  }

  return mySelectedSteps;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:StepSequence.java

示例7: removeRedundantAnnotations

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private void removeRedundantAnnotations(PsiModifierListOwner element,
                                        List<String> redundantAnnotations,
                                        Set<PsiAnnotation.TargetType> targetsForDefaultAnnotation) {
    PsiAnnotation.TargetType[] targetTypes = getTargetsForLocation(element.getModifierList());
    boolean isTargeted = targetsForDefaultAnnotation.isEmpty()
            || ContainerUtil.intersects(targetsForDefaultAnnotation, Arrays.asList(targetTypes));
    if (isTargeted) {
        removePhysicalAnnotations(element, ArrayUtil.toStringArray(redundantAnnotations));
    }
}
 
开发者ID:stylismo,项目名称:nullability-annotations-inspection,代码行数:11,代码来源:AddPackageInfoWithNullabilityDefaultsFix.java

示例8: buildModuleDependencies

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private void buildModuleDependencies(final Map<File, ModuleDescriptor> contentRootToModules) {
  final Set<File> moduleContentRoots = contentRootToModules.keySet();

  for (File contentRoot : moduleContentRoots) {
    final ModuleDescriptor checkedModule = contentRootToModules.get(contentRoot);
    myProgress.setText2("Building library dependencies for module " + checkedModule.getName());
    buildJarDependencies(checkedModule);

    myProgress.setText2("Building module dependencies for module " + checkedModule.getName());
    for (File aContentRoot : moduleContentRoots) {
      final ModuleDescriptor aModule = contentRootToModules.get(aContentRoot);
      if (checkedModule.equals(aModule)) {
        continue; // avoid self-dependencies
      }
      final Collection<? extends DetectedProjectRoot> aModuleRoots = aModule.getSourceRoots();
      checkModules:
      for (DetectedProjectRoot srcRoot: checkedModule.getSourceRoots()) {
        final Set<String> referencedBySourceRoot = mySourceRootToReferencedPackagesMap.get(srcRoot.getDirectory());
        for (DetectedProjectRoot aSourceRoot : aModuleRoots) {
          if (ContainerUtil.intersects(referencedBySourceRoot, mySourceRootToPackagesMap.get(aSourceRoot.getDirectory()))) {
            checkedModule.addDependencyOn(aModule);
            break checkModules;
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ModuleInsight.java

示例9: buildJarDependencies

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private void buildJarDependencies(final ModuleDescriptor module) {
  for (File jarFile : myJarToPackagesMap.keySet()) {
    final Set<String> jarPackages = myJarToPackagesMap.get(jarFile);
    for (DetectedProjectRoot srcRoot : module.getSourceRoots()) {
      if (ContainerUtil.intersects(mySourceRootToReferencedPackagesMap.get(srcRoot.getDirectory()), jarPackages)) {
        module.addLibraryFile(jarFile);
        break;
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ModuleInsight.java

示例10: getLibraryDependencies

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static Collection<LibraryDescriptor> getLibraryDependencies(ModuleDescriptor module,
                                                                   final List<LibraryDescriptor> allLibraries) {
  final Set<LibraryDescriptor> libs = new HashSet<LibraryDescriptor>();
  for (LibraryDescriptor library : allLibraries) {
    if (ContainerUtil.intersects(library.getJars(), module.getLibraryFiles())) {
      libs.add(library);
    }
  }
  return libs;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ModuleInsight.java

示例11: getSortedModuleChunks

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static List<Chunk<Module>> getSortedModuleChunks(Project project, List<Module> modules) {
  final Module[] allModules = ModuleManager.getInstance(project).getModules();
  final List<Chunk<Module>> chunks = getSortedChunks(createModuleGraph(allModules));

  final Set<Module> modulesSet = new HashSet<Module>(modules);
  // leave only those chunks that contain at least one module from modules
  for (Iterator<Chunk<Module>> it = chunks.iterator(); it.hasNext();) {
    final Chunk<Module> chunk = it.next();
    if (!ContainerUtil.intersects(chunk.getNodes(), modulesSet)) {
      it.remove();
    }
  }
  return chunks;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ModuleCompilerUtil.java

示例12: matchesAnyHead

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private boolean matchesAnyHead(@NotNull PermanentGraph<Integer> permanentGraph,
                               @NotNull VcsCommitMetadata commit,
                               @Nullable Set<Integer> matchingHeads) {
  if (matchingHeads == null) {
    return true;
  }
  // TODO O(n^2)
  int commitIndex = myHashMap.getCommitIndex(commit.getId());
  return ContainerUtil.intersects(permanentGraph.getContainingBranches(commitIndex), matchingHeads);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:VisiblePackBuilder.java

示例13: DomFileIndex

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public DomFileIndex() {
  myDataIndexer = new DataIndexer<String, Void, FileContent>() {
    @Override
    @NotNull
    public Map<String, Void> map(@NotNull final FileContent inputData) {
      final Set<String> namespaces = new THashSet<String>();
      final XmlFileHeader header = NanoXmlUtil.parseHeader(CharArrayUtil.readerFromCharSequence(inputData.getContentAsText()));
      ContainerUtil.addIfNotNull(header.getPublicId(), namespaces);
      ContainerUtil.addIfNotNull(header.getSystemId(), namespaces);
      ContainerUtil.addIfNotNull(header.getRootTagNamespace(), namespaces);
      final String tagName = header.getRootTagLocalName();
      if (StringUtil.isNotEmpty(tagName)) {
        final THashMap<String, Void> result = new THashMap<String, Void>();
        final DomApplicationComponent component = DomApplicationComponent.getInstance();
        for (final DomFileDescription description : component.getFileDescriptions(tagName)) {
          final String[] strings = description.getAllPossibleRootTagNamespaces();
          if (strings.length == 0 || ContainerUtil.intersects(Arrays.asList(strings), namespaces)) {
            result.put(description.getRootElementClass().getName(), null);
          }
        }
        for (final DomFileDescription description : component.getAcceptingOtherRootTagNameDescriptions()) {
          final String[] strings = description.getAllPossibleRootTagNamespaces();
          if (strings.length == 0 || ContainerUtil.intersects(Arrays.asList(strings), namespaces)) {
            result.put(description.getRootElementClass().getName(), null);
          }
        }
        return result;
      }
      return Collections.emptyMap();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:DomFileIndex.java


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