• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Chunk类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Chunk类属于com.intellij.util包,在下文中一共展示了Chunk类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: buildChunks

import com.intellij.util.Chunk; //导入依赖的package包/类
public static <Node> List<Chunk<Node>> buildChunks(Graph<Node> graph) {
  final DFSTBuilder<Node> dfstBuilder = new DFSTBuilder<Node>(graph);
  final TIntArrayList sccs = dfstBuilder.getSCCs();
  final List<Chunk<Node>> chunks = new ArrayList<Chunk<Node>>();
  sccs.forEach(new TIntProcedure() {
    int myTNumber = 0;
    public boolean execute(int size) {
      Set<Node> packs = new LinkedHashSet<Node>();
      for (int j = 0; j < size; j++) {
        packs.add(dfstBuilder.getNodeByTNumber(myTNumber + j));
      }
      chunks.add(new Chunk<Node>(packs));
      myTNumber += size;
      return true;
    }
  });

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


示例2: filterDuplicates

import com.intellij.util.Chunk; //导入依赖的package包/类
/**
 * Remove cycles in tests included in cycles between production parts
 */
@NotNull
private static List<Chunk<ModuleSourceSet>> filterDuplicates(@NotNull Collection<Chunk<ModuleSourceSet>> sourceSetCycles) {
  final List<Set<Module>> productionCycles = new ArrayList<Set<Module>>();

  for (Chunk<ModuleSourceSet> cycle : sourceSetCycles) {
    ModuleSourceSet.Type type = getCommonType(cycle);
    if (type == ModuleSourceSet.Type.PRODUCTION) {
      productionCycles.add(ModuleSourceSet.getModules(cycle.getNodes()));
    }
  }

  return ContainerUtil.filter(sourceSetCycles, new Condition<Chunk<ModuleSourceSet>>() {
    @Override
    public boolean value(Chunk<ModuleSourceSet> chunk) {
      if (getCommonType(chunk) != ModuleSourceSet.Type.TEST) return true;
      for (Set<Module> productionCycle : productionCycles) {
        if (productionCycle.containsAll(ModuleSourceSet.getModules(chunk.getNodes()))) return false;
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:GeneralProjectSettingsElement.java


示例3: getCyclicDependencies

import com.intellij.util.Chunk; //导入依赖的package包/类
public static List<Chunk<ModuleSourceSet>> getCyclicDependencies(@NotNull Project project, @NotNull List<Module> modules) {
  Graph<ModuleSourceSet> graph = createModuleSourceDependenciesGraph(new DefaultModulesProvider(project));
  Collection<Chunk<ModuleSourceSet>> chunks = GraphAlgorithms.getInstance().computeStronglyConnectedComponents(graph);
  final Set<Module> modulesSet = new HashSet<Module>(modules);
  return ContainerUtil.filter(chunks, new Condition<Chunk<ModuleSourceSet>>() {
    @Override
    public boolean value(Chunk<ModuleSourceSet> chunk) {
      for (ModuleSourceSet sourceSet : chunk.getNodes()) {
        if (modulesSet.contains(sourceSet.getModule())) {
          return true;
        }
      }
      return false;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ModuleCompilerUtil.java


示例4: testGraph2

import com.intellij.util.Chunk; //导入依赖的package包/类
public void testGraph2() {
  final Map<String, String> arcs = new HashMap<String, String>();
  arcs.put("a", "b");
  arcs.put("b", "ac");
  arcs.put("c", "ad");
  arcs.put("d", "");

  final Graph<Chunk<String>> graph = getAlgorithmsInstance().computeSCCGraph(initGraph(arcs));

  final List<Chunk<String>> expectedNodes = new ArrayList<Chunk<String>>();
  Chunk<String> ABC = new Chunk<String>(toSet("a", "b", "c"));
  expectedNodes.add(ABC);
  Chunk<String> D = new Chunk<String>("d");
  expectedNodes.add(D);

  checkVertices(expectedNodes, graph.getNodes().iterator());

  final Map<Chunk<String>, Set<Chunk<String>>> expectedArcs = new HashMap<Chunk<String>, Set<Chunk<String>>>();
  expectedArcs.put(ABC, toSet());
  expectedArcs.put(D, toSet(ABC));

  checkArcs(expectedArcs, graph);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ChunkGraphTest.java


示例5: getFilesInScope

import com.intellij.util.Chunk; //导入依赖的package包/类
private static List<VirtualFile> getFilesInScope(final CompileContextEx context, final Chunk<Module> chunk, final Collection<VirtualFile> files) {
  final List<VirtualFile> filesInScope = new ArrayList<VirtualFile>(files.size());
  ApplicationManager.getApplication().runReadAction(new Runnable() {
    public void run() {
      for (VirtualFile file : files) {
        if (context.getCompileScope().belongs(file.getUrl())) {
          final Module module = context.getModuleByFile(file);
          if (chunk.getNodes().contains(module)) {
            filesInScope.add(file);
          }
        }
      }
    }
  });
  return filesInScope;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:CompileDriver.java


示例6: BackendCompilerWrapper

import com.intellij.util.Chunk; //导入依赖的package包/类
public BackendCompilerWrapper(Chunk<Module> chunk, @NotNull final Project project,
                              @NotNull List<VirtualFile> filesToCompile,
                              @NotNull CompileContextEx compileContext,
                              @NotNull BackendCompiler compiler, TranslatingCompiler.OutputSink sink) {
  myChunk = chunk;
  myProject = project;
  myCompiler = compiler;
  myCompileContext = compileContext;
  myFilesToCompile = filesToCompile;
  mySink = sink;
  myProjectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
  CompileStatistics stat = compileContext.getUserData(CompileStatistics.KEY);
  if (stat == null) {
    stat = new CompileStatistics();
    compileContext.putUserData(CompileStatistics.KEY, stat);
  }
  myStatistics = stat;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:BackendCompilerWrapper.java


示例7: sort

import com.intellij.util.Chunk; //导入依赖的package包/类
@Override
public void sort(Chunk<Module> moduleChunk, @NotNull Compiler[] compilers, Class<? extends Compiler> aClass)
{
	if(aClass == TranslatingCompiler.class)
	{
		boolean needSwap = false;
		for(Module module : moduleChunk.getNodes())
		{
			if(ModuleUtilCore.getExtension(module, IkvmModuleExtension.class) != null)
			{
				needSwap = true;
				break;
			}
		}

		if(needSwap)
		{
			int javaIndex = indexOfViaInstanceOf(compilers, JavaCompiler.class);
			int dotNetIndex = indexOfViaInstanceOf(compilers, DotNetCompiler.class);
			if(javaIndex > dotNetIndex)
			{
				ArrayUtil.swap(compilers, javaIndex, dotNetIndex);
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-ikvm,代码行数:27,代码来源:IkvmCompilerSorter.java


示例8: getFilesInScope

import com.intellij.util.Chunk; //导入依赖的package包/类
private static List<VirtualFile> getFilesInScope(final CompileContextEx context,
                                                 final Chunk<Module> chunk,
                                                 final Collection<VirtualFile> files) {
  final List<VirtualFile> filesInScope = new ArrayList<>(files.size());
  ApplicationManager.getApplication().runReadAction(() -> {
    for (VirtualFile file : files) {
      if (context.getCompileScope().belongs(file.getUrl())) {
        final Module module = context.getModuleByFile(file);
        if (chunk.getNodes().contains(module)) {
          filesInScope.add(file);
        }
      }
    }
  });
  return filesInScope;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:CompileDriver.java


示例9: recalculateChunkToFilesMap

import com.intellij.util.Chunk; //导入依赖的package包/类
private static void recalculateChunkToFilesMap(CompileContextEx context,
                                               List<Chunk<Module>> allChunks,
                                               VirtualFile[] snapshot,
                                               Map<Chunk<Module>, Collection<VirtualFile>> chunkMap) {
  final Map<Module, List<VirtualFile>> moduleToFilesMap = CompilerUtil.buildModuleToFilesMap(context, snapshot);
  for (Chunk<Module> moduleChunk : allChunks) {
    List<VirtualFile> files = Collections.emptyList();
    for (Module module : moduleChunk.getNodes()) {
      final List<VirtualFile> moduleFiles = moduleToFilesMap.get(module);
      if (moduleFiles != null) {
        files = ContainerUtil.concat(files, moduleFiles);
      }
    }
    chunkMap.put(moduleChunk, files);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:CompileDriver.java


示例10: BackendCompilerWrapper

import com.intellij.util.Chunk; //导入依赖的package包/类
public BackendCompilerWrapper(TranslatingCompiler translatingCompiler,
		Chunk<Module> chunk,
		@NotNull final Project project,
		@NotNull List<VirtualFile> filesToCompile,
		@NotNull CompileContextEx compileContext,
		@NotNull BackendCompiler compiler,
		TranslatingCompiler.OutputSink sink)
{
	myTranslatingCompiler = translatingCompiler;
	myChunk = chunk;
	myProject = project;
	myCompiler = compiler;
	myCompileContext = compileContext;
	myFilesToCompile = filesToCompile;
	mySink = sink;
	myProjectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
	CompileStatistics stat = compileContext.getUserData(CompileStatistics.KEY);
	if(stat == null)
	{
		stat = new CompileStatistics();
		compileContext.putUserData(CompileStatistics.KEY, stat);
	}
	myStatistics = stat;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:25,代码来源:BackendCompilerWrapper.java


示例11: removeDummyNodes

import com.intellij.util.Chunk; //导入依赖的package包/类
private List<Chunk<ModuleSourceSet>> removeDummyNodes(List<Chunk<ModuleSourceSet>> chunks) {
  List<Chunk<ModuleSourceSet>> result = new ArrayList<Chunk<ModuleSourceSet>>(chunks.size());
  for (Chunk<ModuleSourceSet> chunk : chunks) {
    Set<ModuleSourceSet> nodes = new LinkedHashSet<ModuleSourceSet>();
    for (ModuleSourceSet sourceSet : chunk.getNodes()) {
      if (!isDummy(sourceSet)) {
        nodes.add(sourceSet);
      }
    }
    result.add(new Chunk<ModuleSourceSet>(nodes));
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GeneralProjectSettingsElement.java


示例12: removeSingleElementChunks

import com.intellij.util.Chunk; //导入依赖的package包/类
private static List<Chunk<ModuleSourceSet>> removeSingleElementChunks(Collection<Chunk<ModuleSourceSet>> chunks) {
  return ContainerUtil.filter(chunks, new Condition<Chunk<ModuleSourceSet>>() {
    @Override
    public boolean value(Chunk<ModuleSourceSet> chunk) {
      return chunk.getNodes().size() > 1;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GeneralProjectSettingsElement.java


示例13: getCommonType

import com.intellij.util.Chunk; //导入依赖的package包/类
@Nullable
private static ModuleSourceSet.Type getCommonType(@NotNull Chunk<ModuleSourceSet> cycle) {
  ModuleSourceSet.Type type = null;
  for (ModuleSourceSet set : cycle.getNodes()) {
    if (type == null) {
      type = set.getType();
    }
    else if (type != set.getType()) {
      return null;
    }
  }
  return type;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GeneralProjectSettingsElement.java


示例14: getPreferredModuleEncoding

import com.intellij.util.Chunk; //导入依赖的package包/类
@Nullable
public static Charset getPreferredModuleEncoding(Chunk<Module> chunk) {
  CompilerEncodingService service = null;
  for (Module module : chunk.getNodes()) {
    if (service == null) {
      service = getInstance(module.getProject());
    }
    final Charset charset = service.getPreferredModuleEncoding(module);
    if (charset != null) {
      return charset;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:CompilerEncodingService.java


示例15: getSortedModuleChunks

import com.intellij.util.Chunk; //导入依赖的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


示例16: getSortedChunks

import com.intellij.util.Chunk; //导入依赖的package包/类
public static <Node> List<Chunk<Node>> getSortedChunks(final Graph<Node> graph) {
  final Graph<Chunk<Node>> chunkGraph = toChunkGraph(graph);
  final List<Chunk<Node>> chunks = new ArrayList<Chunk<Node>>(chunkGraph.getNodes().size());
  for (final Chunk<Node> chunk : chunkGraph.getNodes()) {
    chunks.add(chunk);
  }
  DFSTBuilder<Chunk<Node>> builder = new DFSTBuilder<Chunk<Node>>(chunkGraph);
  if (!builder.isAcyclic()) {
    LOG.error("Acyclic graph expected");
    return null;
  }

  Collections.sort(chunks, builder.comparator());
  return chunks;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ModuleCompilerUtil.java


示例17: getCycleChunks

import com.intellij.util.Chunk; //导入依赖的package包/类
private List<Chunk<Module>> getCycleChunks() {
  List<Chunk<Module>> chunks =
    ModuleCompilerUtil.getSortedModuleChunks(myProject, Arrays.asList(ModuleManager.getInstance(myProject).getModules()));
  for (Iterator<Chunk<Module>> it = chunks.iterator(); it.hasNext();) {
    final Chunk<Module> chunk = it.next();
    if (chunk.getNodes().size() == 1) {
      it.remove();
    }
  }
  return chunks;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GenerateAntBuildDialog.java


示例18: initChunksPanel

import com.intellij.util.Chunk; //导入依赖的package包/类
private void initChunksPanel() {
  List<Chunk<Module>> chunks = getCycleChunks();
  if (chunks.isEmpty()) {
    return;
  }
  myChunksPanel.setLayout(new BorderLayout());
  myChunksPanel.setBorder(
    IdeBorderFactory.createTitledBorder(CompilerBundle.message("generate.ant.build.dialog.cyclic.modules.table.title"),
                                        true));
  JLabel textLabel = new JLabel(CompilerBundle.message("generate.ant.build.dialog.cyclic.modules.table.description"));
  textLabel.setUI(new MultiLineLabelUI());
  textLabel.setBorder(IdeBorderFactory.createEmptyBorder(4, 4, 6, 4));
  myChunksPanel.add(textLabel, BorderLayout.NORTH);

  myTableModel = new MyTableModel(chunks);
  myTable = new Table(myTableModel);
  final MyTableCellRenderer cellRenderer = new MyTableCellRenderer();
  final TableColumn nameColumn = myTable.getColumnModel().getColumn(MyTableModel.NAME_COLUMN);
  nameColumn.setCellEditor(ComboBoxTableCellEditor.INSTANCE);
  nameColumn.setCellRenderer(cellRenderer);
  final TableColumn labelColumn = myTable.getColumnModel().getColumn(MyTableModel.NUMBER_COLUMN);
  labelColumn.setCellRenderer(cellRenderer);

  final Dimension preferredSize = new Dimension(myTable.getPreferredSize());
  preferredSize.height = (myTableModel.getRowCount() + 2) * myTable.getRowHeight() + myTable.getTableHeader().getHeight();

  final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable);
  scrollPane.setPreferredSize(preferredSize);
  myChunksPanel.add(scrollPane, BorderLayout.CENTER);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:GenerateAntBuildDialog.java


示例19: MyTableModel

import com.intellij.util.Chunk; //导入依赖的package包/类
private MyTableModel(List<Chunk<Module>> chunks) {
  for (final Chunk<Module> chunk : chunks) {
    final ListWithSelection<String> item = new ListWithSelection<String>();
    for (final Module module : chunk.getNodes()) {
      item.add(module.getName());
    }
    item.selectFirst();
    myItems.add(new Pair<String, ListWithSelection>(createCycleName(chunk), item));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GenerateAntBuildDialog.java


示例20: createCycleName

import com.intellij.util.Chunk; //导入依赖的package包/类
private static String createCycleName(Chunk<Module> chunk) {
  final StringBuilder buf = new StringBuilder();
  for (Module module : chunk.getNodes()) {
    if (buf.length() > 0) {
      buf.append(", ");
    }
    buf.append(module.getName());
  }
  buf.insert(0, "[");
  buf.append("]");
  return buf.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:GenerateAntBuildDialog.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CacheBuilder类代码示例发布时间:2022-05-22
下一篇:
Java Reloadable类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap