当前位置: 首页>>代码示例>>Java>>正文


Java ExternalSort.sortInBatch方法代码示例

本文整理汇总了Java中com.google.code.externalsorting.ExternalSort.sortInBatch方法的典型用法代码示例。如果您正苦于以下问题:Java ExternalSort.sortInBatch方法的具体用法?Java ExternalSort.sortInBatch怎么用?Java ExternalSort.sortInBatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.code.externalsorting.ExternalSort的用法示例。


在下文中一共展示了ExternalSort.sortInBatch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sortFile

import com.google.code.externalsorting.ExternalSort; //导入方法依赖的package包/类
public static File sortFile(String inputFile, String outputFile, Comparator<String> comparator) throws IOException {

		File file;
		List<File> files;

		files = ExternalSort.sortInBatch(new File(inputFile));
		file = new File(outputFile);
		ExternalSort.mergeSortedFiles(files, file, comparator);

		return file;
	}
 
开发者ID:SI3P,项目名称:supWSD,代码行数:12,代码来源:WEFileUtils.java

示例2: externalSort

import com.google.code.externalsorting.ExternalSort; //导入方法依赖的package包/类
public static void externalSort(File srcFile, File destFile, Comparator<String> comparator) throws IOException {

		File tmpDir = destFile.getParentFile();
		List<File> tmpFiles = ExternalSort.sortInBatch(srcFile, comparator, 4096, Charset.defaultCharset(), tmpDir,
				false);
		ExternalSort.mergeSortedFiles(tmpFiles, destFile, comparator);

	}
 
开发者ID:NEO-IE,项目名称:numbertron,代码行数:9,代码来源:Preprocess.java

示例3: fromFile

import com.google.code.externalsorting.ExternalSort; //导入方法依赖的package包/类
public static DiskDGraph fromFile(File file, File tmpDir, File dbFile)
		throws IOException
	{
	DiskDGraph graph = new DiskDGraph(dbFile, true);

	// * sort the input file by first element
       File forward = new File(tmpDir, "forward.edgelist");
       
       
       List<File> files = ExternalSort.sortInBatch(
       		file, 
       		new LComp(true), ExternalSort.DEFAULTMAXTEMPFILES, 
       		Charset.defaultCharset(), tmpDir, false);
       ExternalSort.mergeSortedFiles(files, forward, new LComp(true), Charset.defaultCharset());
       
       System.out.println("Forward sort finished");
       
       readSorted(graph.out, forward, true);
       
       System.out.println("Forward list read");

       forward.delete();
       File backward = new File(tmpDir, "backward.edgelist");
       
       files = ExternalSort.sortInBatch(
       		file, 
       		new LComp(false), ExternalSort.DEFAULTMAXTEMPFILES, 
       		Charset.defaultCharset(), tmpDir, false);
       ExternalSort.mergeSortedFiles(files, backward, new LComp(false), Charset.defaultCharset());
       
       System.out.println("Backward sort finished");
       
       long links = readSorted(graph.in, backward, false);
       
       System.out.println("Backward list read");
       
       backward.delete();
       
       int max = Math.max(graph.in.size(), graph.out.size());
       while(graph.in.size() < max)
       	graph.in.add(Collections.EMPTY_LIST);
       while(graph.out.size() < max)
       	graph.out.add(Collections.EMPTY_LIST);

       graph.numLinks = links;
       graph.nullLabels = true;
       
	Global.log().info("Graph loaded and sorted.");

	return graph;
}
 
开发者ID:Data2Semantics,项目名称:nodes,代码行数:52,代码来源:DiskDGraph.java

示例4: fromFile

import com.google.code.externalsorting.ExternalSort; //导入方法依赖的package包/类
public static DiskUGraph fromFile(File file, File tmpDir, File dbFile)
		throws IOException
	{
	DiskUGraph graph = new DiskUGraph(dbFile, true);

	// * sort the input file by first element
       File forward = new File(tmpDir, "forward.edgelist");
       
       
       List<File> files = ExternalSort.sortInBatch(
       		file, 
       		new LComp(true), ExternalSort.DEFAULTMAXTEMPFILES, 
       		Charset.defaultCharset(), tmpDir, false);
       ExternalSort.mergeSortedFiles(files, forward, new LComp(true), Charset.defaultCharset());
       
       Global.log().info("Forward sort finished");
       
       readSorted(graph.neighbors, forward, true);
       
       Global.log().info("Forward list read");

       forward.delete();
       
       
       File backward = new File(tmpDir, "backward.edgelist");
       
       files = ExternalSort.sortInBatch(
       		file, 
       		new LComp(false), ExternalSort.DEFAULTMAXTEMPFILES, 
       		Charset.defaultCharset(), tmpDir, false);
       ExternalSort.mergeSortedFiles(files, backward, new LComp(false), Charset.defaultCharset());
       
       Global.log().info("Backward sort finished");
       
       long links = readSorted(graph.neighbors, backward, false);
       
       Global.log().info("Backward list read");
       
       backward.delete();
       
       
       graph.numLinks = links;
       graph.nullLabels = true;
       
	Global.log().info("Graph loaded and sorted.");

	
	return graph;
}
 
开发者ID:Data2Semantics,项目名称:nodes,代码行数:50,代码来源:DiskUGraph.java


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