本文整理汇总了Java中com.intellij.util.Chunk类的典型用法代码示例。如果您正苦于以下问题:Java Chunk类的具体用法?Java Chunk怎么用?Java Chunk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Chunk类属于com.intellij.util包,在下文中一共展示了Chunk类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
});
}
示例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;
}
});
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
});
}
示例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;
}
示例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;
}
示例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;
}