當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。