當前位置: 首頁>>代碼示例>>Java>>正文


Java THashSet.add方法代碼示例

本文整理匯總了Java中gnu.trove.THashSet.add方法的典型用法代碼示例。如果您正苦於以下問題:Java THashSet.add方法的具體用法?Java THashSet.add怎麽用?Java THashSet.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gnu.trove.THashSet的用法示例。


在下文中一共展示了THashSet.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: collectParamValues

import gnu.trove.THashSet; //導入方法依賴的package包/類
private static boolean collectParamValues(List<Match> duplicates, VariableData variableData, THashSet<PsiExpression> map) {
  for (Match duplicate : duplicates) {
    final List<PsiElement> values = duplicate.getParameterValues(variableData.variable);
    if (values == null || values.isEmpty()) {
      return false;
    }
    boolean found = false;
    for (PsiElement value : values) {
      if (value instanceof PsiExpression) {
        map.add((PsiExpression)value);
        found = true;
        break;
      }
    }
    if (!found) return false;
  }
  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:ExtractMethodSignatureSuggester.java

示例2: registerAction

import gnu.trove.THashSet; //導入方法依賴的package包/類
public void registerAction(@NotNull String actionId, @NotNull AnAction action, @Nullable PluginId pluginId, @Nullable String projectType) {
  synchronized (myLock) {
    if (addToMap(actionId, action, pluginId, projectType) == null) return;
    if (myAction2Id.containsKey(action)) {
      reportActionError(pluginId, "action was already registered for another ID. ID is " + myAction2Id.get(action) +
                                  getPluginInfo(pluginId));
      return;
    }
    myId2Index.put(actionId, myRegisteredActionsCount++);
    myAction2Id.put(action, actionId);
    if (pluginId != null && !(action instanceof ActionGroup)){
      THashSet<String> pluginActionIds = myPlugin2Id.get(pluginId);
      if (pluginActionIds == null){
        pluginActionIds = new THashSet<String>();
        myPlugin2Id.put(pluginId, pluginActionIds);
      }
      pluginActionIds.add(actionId);
    }
    action.registerCustomShortcutSet(new ProxyShortcutSet(actionId, myKeymapManager), null);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:ActionManagerImpl.java

示例3: checkFile

import gnu.trove.THashSet; //導入方法依賴的package包/類
@Nullable
@Override
public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
  final TodoItem[] todoItems = PsiTodoSearchHelper.SERVICE.getInstance(file.getProject()).findTodoItems(file);

  final List<ProblemDescriptor> result = new ArrayList<ProblemDescriptor>();
  final THashSet<PsiComment> comments = new THashSet<PsiComment>();
  for (TodoItem todoItem : todoItems) {
    final PsiComment comment =
      PsiTreeUtil.getParentOfType(file.findElementAt(todoItem.getTextRange().getStartOffset()), PsiComment.class, false);
    if (comment != null && comments.add(comment)) {
      result.add(manager.createProblemDescriptor(comment, InspectionsBundle.message("todo.comment.problem.descriptor"), isOnTheFly,
                                                 null, ProblemHighlightType.GENERIC_ERROR_OR_WARNING));
    }
  }
  return result.toArray(new ProblemDescriptor[result.size()]);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:TodoCommentInspection.java

示例4: read

import gnu.trove.THashSet; //導入方法依賴的package包/類
public synchronized Set<String> read(@NotNull DataInput in) throws IOException {
    THashSet set = new THashSet();

    for(int r = in.readInt(); r > 0; --r) {
        set.add(EnumeratorStringDescriptor.INSTANCE.read(in));
    }

    return set;
}
 
開發者ID:cedricziel,項目名稱:idea-php-typo3-plugin,代碼行數:10,代碼來源:StringSetDataExternalizer.java

示例5: sepsetPotentials

import gnu.trove.THashSet; //導入方法依賴的package包/類
public Set sepsetPotentials()
{
  THashSet set = new THashSet();
  TIntObjectIterator it = sepsets.iterator();
  while (it.hasNext()) {
    it.advance();
    Factor ptl = ((Sepset) it.value()).ptl;
    set.add(ptl);
  }

  return set;
}
 
開發者ID:mimno,項目名稱:GRMM,代碼行數:13,代碼來源:JunctionTree.java

示例6: allFactorsContaining

import gnu.trove.THashSet; //導入方法依賴的package包/類
/** Returns a collection of all factors that involve only the given variables.
 *   That is, all factors whose domain is a subset of the given collection.
 */
public Collection allFactorsContaining (Collection vars)
{
  THashSet factors = new THashSet ();
  for (Iterator it = factorsIterator (); it.hasNext ();) {
    Factor ptl = (Factor) it.next ();
    if (vars.containsAll (ptl.varSet ()))
      factors.add (ptl);
  }
  return factors;
}
 
開發者ID:mimno,項目名稱:GRMM,代碼行數:14,代碼來源:FactorGraph.java

示例7: getAllLookupStrings

import gnu.trove.THashSet; //導入方法依賴的package包/類
@Override
public Set<String> getAllLookupStrings() {
  final Set<String> strings = getDelegate().getAllLookupStrings();
  final THashSet<String> result = new THashSet<String>();
  result.addAll(strings);
  result.add(getLookupString());
  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:JavaChainLookupElement.java

示例8: inlineSameArguments

import gnu.trove.THashSet; //導入方法依賴的package包/類
private void inlineSameArguments(PsiMethod method, List<PsiExpression> copies, InputVariables variables, List<Match> duplicates) {
  final List<VariableData> variableDatum = variables.getInputVariables();
  final Map<PsiVariable, PsiExpression> toInline = new HashMap<PsiVariable, PsiExpression>();
  final int strongParamsCound = method.getParameterList().getParametersCount();
  for (int i = strongParamsCound; i < variableDatum.size(); i++) {
    VariableData variableData = variableDatum.get(i);
    final THashSet<PsiExpression> map = new THashSet<PsiExpression>(ourEquivalenceStrategy);
    if (!collectParamValues(duplicates, variableData, map)) {
      continue;
    }

    final PsiExpression currentExpression = copies.get(i - strongParamsCound);
    map.add(currentExpression);

    if (map.size() == 1) {
      toInline.put(variableData.variable, currentExpression);
    }
  }

  if (!toInline.isEmpty()) {
    copies.removeAll(toInline.values());
    inlineArgumentsInMethodBody(toInline);
    removeRedundantParametersFromMethodSignature(toInline);
  }

  removeUnusedStongParams(strongParamsCound);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:ExtractMethodSignatureSuggester.java

示例9: expandCompileScopeIfNeeded

import gnu.trove.THashSet; //導入方法依賴的package包/類
public static Collection<VirtualFile> expandCompileScopeIfNeeded(final Collection<VirtualFile> result, final CompileContext context) {
  final ProjectFileIndex index = ProjectRootManager.getInstance(context.getProject()).getFileIndex();
  final THashSet<VirtualFile> set = new THashSet<VirtualFile>();
  final THashSet<Module> modules = new THashSet<Module>();
  for (VirtualFile file : result) {
    if (index.getSourceRootForFile(file) == null) {
      set.add(file);
      ContainerUtil.addIfNotNull(index.getModuleForFile(file), modules);
    }
  }
  if (!set.isEmpty()) {
    ((CompileContextEx)context).addScope(new FileSetCompileScope(set, modules.toArray(new Module[modules.size()])));
  }
  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:InspectionValidatorUtil.java

示例10: withLookupString

import gnu.trove.THashSet; //導入方法依賴的package包/類
@Contract(value="", pure=true)
public LookupElementBuilder withLookupString(@NotNull String another) {
  final THashSet<String> set = new THashSet<String>(myAllLookupStrings);
  set.add(another);
  return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, myRenderer, myHardcodedPresentation,
                                  Collections.unmodifiableSet(set), myCaseSensitive);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:LookupElementBuilder.java

示例11: filesWithTheSameName

import gnu.trove.THashSet; //導入方法依賴的package包/類
@Nullable
private static UniqueNameBuilder<VirtualFile> filesWithTheSameName(String fileName, Project project,
                                                            boolean skipNonOpenedFiles,
                                                            GlobalSearchScope scope) {
  Collection<VirtualFile> filesWithSameName = skipNonOpenedFiles ? Collections.<VirtualFile>emptySet() :
                                              FilenameIndex.getVirtualFilesByName(project, fileName,
                                                                                  scope);
  THashSet<VirtualFile> setOfFilesWithTheSameName = new THashSet<VirtualFile>(filesWithSameName);
  // add open files out of project scope
  for(VirtualFile openFile: FileEditorManager.getInstance(project).getOpenFiles()) {
    if (openFile.getName().equals(fileName)) {
      setOfFilesWithTheSameName.add(openFile);
    }
  }
  for (VirtualFile recentlyEditedFile : EditorHistoryManager.getInstance(project).getFiles()) {
    if (recentlyEditedFile.getName().equals(fileName)) {
      setOfFilesWithTheSameName.add(recentlyEditedFile);
    }
  }

  filesWithSameName = setOfFilesWithTheSameName;

  if (filesWithSameName.size() > 1) {
    String path = project.getBasePath();
    path = path == null ? "" : FileUtil.toSystemIndependentName(path);
    UniqueNameBuilder<VirtualFile> builder = new UniqueNameBuilder<VirtualFile>(path, File.separator, 25);
    for (VirtualFile virtualFile: filesWithSameName) {
      builder.addPath(virtualFile, virtualFile.getPath());
    }
    return builder;
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:34,代碼來源:UniqueVFilePathBuilderImpl.java

示例12: fromString

import gnu.trove.THashSet; //導入方法依賴的package包/類
@Nullable
@Override
public Set<String> fromString(@NotNull String value) {
  final THashSet<String> result = new THashSet<String>();
  for (String closingTag : StringUtil.split(value, ",")) {
    result.add(closingTag.trim().toLowerCase(Locale.US));
  }
  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:HTMLControls.java

示例13: defaultFunctionalityWorked

import gnu.trove.THashSet; //導入方法依賴的package包/類
private static boolean defaultFunctionalityWorked(final PsiLanguageInjectionHost host) {
  final THashSet<String> languages = new THashSet<String>();
  final List<Pair<PsiElement, TextRange>> files = InjectedLanguageManager.getInstance(host.getProject()).getInjectedPsiFiles(host);
  if (files == null) return false;
  for (Pair<PsiElement, TextRange> pair : files) {
    for (Language lang = pair.first.getLanguage(); lang != null; lang = lang.getBaseLanguage()) {
      languages.add(lang.getID());
    }
  }
  // todo there is a problem: host i.e. literal expression is confused with "target" i.e. parameter
  // todo therefore this part doesn't work for java
  return Configuration.getProjectInstance(host.getProject()).setHostInjectionEnabled(host, languages, false);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:UnInjectLanguageAction.java

示例14: Region

import gnu.trove.THashSet; //導入方法依賴的package包/類
Region (Factor ptl) {
  this ();
  factors = new THashSet ();
  factors.add (ptl);
  vars = new ArrayList (ptl.varSet ());
}
 
開發者ID:mimno,項目名稱:GRMM,代碼行數:7,代碼來源:Region.java

示例15: buildJar

import gnu.trove.THashSet; //導入方法依賴的package包/類
private void buildJar(final JarInfo jar) throws IOException {
  final String emptyArchiveMessage = "Archive '" + jar.getPresentableDestination() + "' doesn't contain files so it won't be created";
  if (jar.getContent().isEmpty()) {
    myContext.processMessage(new CompilerMessage(IncArtifactBuilder.BUILDER_NAME, BuildMessage.Kind.WARNING, emptyArchiveMessage));
    return;
  }

  myContext.processMessage(new ProgressMessage("Building " + jar.getPresentableDestination() + "..."));
  File jarFile = FileUtil.createTempFile("artifactCompiler", "tmp");
  myBuiltJars.put(jar, jarFile);

  FileUtil.createParentDirs(jarFile);
  final String targetJarPath = jar.getDestination().getOutputFilePath();
  List<String> packedFilePaths = new ArrayList<String>();
  Manifest manifest = loadManifest(jar, packedFilePaths);
  final JarOutputStream jarOutputStream = createJarOutputStream(jarFile, manifest);

  final THashSet<String> writtenPaths = new THashSet<String>();
  try {
    if (manifest != null) {
      writtenPaths.add(JarFile.MANIFEST_NAME);
    }

    for (Pair<String, Object> pair : jar.getContent()) {
      final String relativePath = pair.getFirst();
      if (pair.getSecond() instanceof ArtifactRootDescriptor) {
        final ArtifactRootDescriptor descriptor = (ArtifactRootDescriptor)pair.getSecond();
        final int rootIndex = descriptor.getRootIndex();
        if (descriptor instanceof FileBasedArtifactRootDescriptor) {
          addFileToJar(jarOutputStream, jarFile, descriptor.getRootFile(), descriptor.getFilter(), relativePath, targetJarPath, writtenPaths,
                       packedFilePaths, rootIndex);
        }
        else {
          final String filePath = FileUtil.toSystemIndependentName(descriptor.getRootFile().getAbsolutePath());
          packedFilePaths.add(filePath);
          myOutSrcMapping.appendData(targetJarPath, rootIndex, filePath);
          extractFileAndAddToJar(jarOutputStream, (JarBasedArtifactRootDescriptor)descriptor, relativePath, writtenPaths);
        }
      }
      else {
        JarInfo nestedJar = (JarInfo)pair.getSecond();
        File nestedJarFile = myBuiltJars.get(nestedJar);
        if (nestedJarFile != null) {
          addFileToJar(jarOutputStream, jarFile, nestedJarFile, SourceFileFilter.ALL, relativePath, targetJarPath, writtenPaths,
                       packedFilePaths, -1);
        }
        else {
          LOG.debug("nested JAR file " + relativePath + " for " + jar.getPresentableDestination() + " not found");
        }
      }
    }

    if (writtenPaths.isEmpty()) {
      myContext.processMessage(new CompilerMessage(IncArtifactBuilder.BUILDER_NAME, BuildMessage.Kind.WARNING, emptyArchiveMessage));
      return;
    }

    final ProjectBuilderLogger logger = myContext.getLoggingManager().getProjectBuilderLogger();
    if (logger.isEnabled()) {
      logger.logCompiledPaths(packedFilePaths, IncArtifactBuilder.BUILDER_NAME, "Packing files:");
    }
    myOutputConsumer.registerOutputFile(new File(targetJarPath), packedFilePaths);

  }
  finally {
    if (writtenPaths.isEmpty()) {
      try {
        jarOutputStream.close();
      }
      catch (IOException ignored) {
      }
      FileUtil.delete(jarFile);
      myBuiltJars.remove(jar);
    }
    else {
      jarOutputStream.close();
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:80,代碼來源:JarsBuilder.java


注:本文中的gnu.trove.THashSet.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。