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


Java THashSet.isEmpty方法代碼示例

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


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

示例1: describeItems

import gnu.trove.THashSet; //導入方法依賴的package包/類
@Override
public void describeItems(LinkedHashMap<LookupElement, StringBuilder> map, ProcessingContext context) {
  final THashSet<LookupElement> lifted = newIdentityTroveSet();
  liftShorterElements(new ArrayList<LookupElement>(map.keySet()), lifted, context);
  if (!lifted.isEmpty()) {
    for (LookupElement element : map.keySet()) {
      final StringBuilder builder = map.get(element);
      if (builder.length() > 0) {
        builder.append(", ");
      }

      builder.append(myName).append("=").append(lifted.contains(element));
    }
  }
  super.describeItems(map, context);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:LiftShorterItemsClassifier.java

示例2: 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

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