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


Java ContainerUtil.newTroveSet方法代码示例

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


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

示例1: deserializeSet

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static <T> Set<T> deserializeSet(@NotNull Deserializer<T> itemDeserializer,
                                        @NotNull StubInputStream stream,
                                        boolean skipNulls) throws IOException {
  short numItems = stream.readShort();

  // can't do this, we may want to add more elements to it later on
  // if (numItems == 0) return Collections.emptySet();

  Set<T> result = ContainerUtil.newTroveSet();
  for (int i = 0; i < numItems; i++) {
    T item = itemDeserializer.deserialize(stream);
    if (item != null || skipNulls)
      result.add(item);
  }

  return result;
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:19,代码来源:StubSerializerUtil.java

示例2: writeDiff

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private void writeDiff(List<String> added, List<String> removed, boolean negated) {
  Set<String> baseline = ContainerUtil.newTroveSet();
  for (CustomizableConsoleFoldingBean regexp : CustomizableConsoleFoldingBean.EP_NAME.getExtensions()) {
    if (regexp.negate == negated) {
      baseline.add(regexp.substring);
    }
  }

  final List<String> current = patternList(negated);
  added.addAll(current);
  added.removeAll(baseline);

  baseline.removeAll(current);
  removed.addAll(baseline);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ConsoleFoldingSettings.java

示例3: getAllKeys

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public <K> Collection<K> getAllKeys(@NotNull StubIndexKey<K, ?> indexKey, @NotNull Project project) {
  Set<K> allKeys = ContainerUtil.newTroveSet();
  processAllKeys(indexKey, project, new CommonProcessors.CollectProcessor<K>(allKeys));
  return allKeys;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:StubIndexImpl.java

示例4: getNames

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public String[] getNames(final boolean checkBoxState) {
  final THashSet<String> allNames = ContainerUtil.newTroveSet();

  processNames(new CommonProcessors.CollectProcessor<String>(Collections.synchronizedCollection(allNames)), checkBoxState);
  if (LOG.isDebugEnabled()) {
    LOG.debug("getNames(): (got "+allNames.size()+" elements)");
  }
  return ArrayUtil.toStringArray(allNames);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ContributorsBasedGotoByModel.java

示例5: processParents

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static void processParents(@NotNull Processor<SchemaTypeDef> consumer,
                                   @NotNull SchemaTypeDef baseType,
                                   @NotNull SchemaTypeParentsSearch.SearchParameters parameters) {

  final Ref<SchemaTypeDef> currentBase = Ref.create();
  final Queue<PsiAnchor> queue = new Queue<>(10);
  final Set<PsiAnchor> processed = ContainerUtil.newTroveSet();

  final Processor<SchemaTypeDef> processor = new ReadActionProcessor<SchemaTypeDef>() {
    @Override
    public boolean processInReadAction(SchemaTypeDef inheritor) {
      if (!consumer.process(inheritor)) return false;
      if (inheritor == null) return false;
      queue.addLast(PsiAnchor.create(inheritor));
      return true;
    }
  };

  // seed
  ApplicationManager.getApplication().runReadAction(() -> {
    queue.addLast(PsiAnchor.create(baseType));
  });

  // BFS
  while (!queue.isEmpty()) {
    ProgressManager.checkCanceled();

    final PsiAnchor anchor = queue.pullFirst();
    if (!processed.add(anchor)) continue;

    SchemaTypeDef typeDef = ApplicationManager.getApplication().runReadAction(
        (Computable<SchemaTypeDef>) () -> (SchemaTypeDef) anchor.retrieve()
    );
    if (typeDef == null) continue;

    currentBase.set(typeDef);
    if (!SchemaDirectTypeParentsSearch.search(typeDef).forEach(processor))
      return;
  }
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:41,代码来源:SchemaTypeParentsSearcher.java

示例6: processInheritors

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static void processInheritors(@NotNull final Processor<PsiClass> consumer,
                                         @NotNull final PsiClass baseClass,
                                         @NotNull final SearchScope searchScope,
                                         @NotNull final ClassInheritorsSearch.SearchParameters parameters) {
  if (baseClass instanceof PsiAnonymousClass || isFinal(baseClass)) return;

  Project project = PsiUtilCore.getProjectInReadAction(baseClass);
  if (isJavaLangObject(baseClass)) {
    AllClassesSearch.search(searchScope, project, parameters.getNameCondition()).forEach(new Processor<PsiClass>() {
      @Override
      public boolean process(final PsiClass aClass) {
        ProgressManager.checkCanceled();
        return isJavaLangObject(aClass) || consumer.process(aClass);
      }
    });
    return;
  }

  final Ref<PsiClass> currentBase = Ref.create(null);
  final Stack<PsiAnchor> stack = new Stack<PsiAnchor>();
  final Set<PsiAnchor> processed = ContainerUtil.newTroveSet();

  final Processor<PsiClass> processor = new ReadActionProcessor<PsiClass>() {
    @Override
    public boolean processInReadAction(PsiClass candidate) {
      ProgressManager.checkCanceled();

      if (parameters.isCheckInheritance() || parameters.isCheckDeep() && !(candidate instanceof PsiAnonymousClass)) {
        if (!candidate.isInheritor(currentBase.get(), false)) {
          return true;
        }
      }

      if (PsiSearchScopeUtil.isInScope(searchScope, candidate)) {
        if (candidate instanceof PsiAnonymousClass) {
          return consumer.process(candidate);
        }
        
        final String name = candidate.getName();
        if (name != null && parameters.getNameCondition().value(name) && !consumer.process(candidate)) {
          return false;
        }
      }

      if (parameters.isCheckDeep() && !(candidate instanceof PsiAnonymousClass) && !isFinal(candidate)) {
        stack.push(PsiAnchor.create(candidate));
      }
      return true;
    }
  };
  
  ApplicationManager.getApplication().runReadAction(new Runnable() {
    @Override
    public void run() {
      stack.push(PsiAnchor.create(baseClass));
    }
  });
  final GlobalSearchScope projectScope = GlobalSearchScope.allScope(project);
  
  while (!stack.isEmpty()) {
    ProgressManager.checkCanceled();

    final PsiAnchor anchor = stack.pop();
    if (!processed.add(anchor)) continue;

    PsiClass psiClass = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
        @Override
        public PsiClass compute() {
          return (PsiClass)anchor.retrieve();
        }
      });
    if (psiClass == null) continue;

    currentBase.set(psiClass);
    if (!DirectClassInheritorsSearch.search(psiClass, projectScope, parameters.isIncludeAnonymous(), false).forEach(processor)) return;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:78,代码来源:JavaClassInheritorsSearcher.java

示例7: LightModifierList

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public LightModifierList(PsiManager manager, final Language language, String... modifiers) {
  super(manager, language);
  myModifiers = ContainerUtil.newTroveSet(modifiers);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:LightModifierList.java

示例8: getCompilableFileTypes

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public Set<FileType> getCompilableFileTypes() {
  return ContainerUtil.newTroveSet(StdFileTypes.JAVA, (FileType)GroovyFileType.GROOVY_FILE_TYPE);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:GreclipseIdeaCompiler.java

示例9: processInheritors

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static void processInheritors(@NotNull Processor<SchemaTypeDef> consumer,
                                        @NotNull SchemaTypeDef baseType,
                                        @NotNull SchemaTypeInheritorsSearch.SearchParameters parameters) {

    // see JavaClassInheritorsSearcher

//    final Project project = PsiUtilCore.getProjectInReadAction(baseType);
    final Ref<SchemaTypeDef> currentBase = Ref.create();
    final Stack<PsiAnchor> stack = new Stack<>();
    final Set<PsiAnchor> processed = ContainerUtil.newTroveSet();

    final Processor<SchemaTypeDef> processor = new ReadActionProcessor<SchemaTypeDef>() {
      @Override
      public boolean processInReadAction(SchemaTypeDef inheritor) {
        if (!consumer.process(inheritor)) return false;
        stack.push(PsiAnchor.create(inheritor));
        return true;
      }
    };

    ApplicationManager.getApplication().runReadAction(() -> {
      stack.push(PsiAnchor.create(baseType));
    });

    // DFS
    while (!stack.isEmpty()) {
      ProgressManager.checkCanceled();

      final PsiAnchor anchor = stack.pop();
      if (!processed.add(anchor)) continue;

      SchemaTypeDef typeDef = ApplicationManager.getApplication().runReadAction(
          (Computable<SchemaTypeDef>) () -> (SchemaTypeDef) anchor.retrieve()
      );
      if (typeDef == null) continue;

      currentBase.set(typeDef);
      if (!SchemaDirectTypeInheritorsSearch.search(typeDef).forEach(processor))
        return;
    }
  }
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:42,代码来源:SchemaTypeInheritorsSearcher.java


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