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


Java ProgressLogger.update方法代码示例

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


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

示例1: computeNExperiments

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public ClassifierResults[] computeNExperiments(final int nExperiments, final int nSamples) {
	final ClassifierResults[] allResults = new ClassifierResults[nExperiments];
	ProgressLogger pl = new ProgressLogger(LOGGER, "experiments");
	pl.expectedUpdates = nExperiments;
	pl.start("Beginning experiments...");
	
	for (int iExperiment = 0; iExperiment < nExperiments; iExperiment++) {
		if (verbose) LOGGER.info("Starting experiment #" + (iExperiment+1) + "...");
		ClassifierResults experimentResult = computeOneExperiment(createTestingSet(nSamples));
		if (verbose) LOGGER.info("Results for experiment #" + (iExperiment+1) + ":\n\n" + experimentResult + "\n");
		allResults[iExperiment] = experimentResult;
		
		pl.update();
	}
	pl.done();
	
	return allResults;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:19,代码来源:TestMatrix.java

示例2: writeOffsets

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
/** Write the offset file to a given bit stream.
 * @param obs the output bit stream to which offsets will be written.
 * @param pl a progress logger, or <code>null</code>.  
 */
public void writeOffsets( final OutputBitStream obs, final ProgressLogger pl ) throws IOException {
	final BVGraphNodeIterator nodeIterator = (BVGraphNodeIterator) nodeIterator( 0 );
	int n = numNodes();
	long lastOffset = 0;
	while( n-- != 0 ) {
			// We fetch the current position of the underlying input bit stream, which is at the start of the next node.
			writeOffset( obs, nodeIterator.ibs.readBits() - lastOffset );
			lastOffset = nodeIterator.ibs.readBits();
			nodeIterator.nextInt();
			nodeIterator.outdegree();
			nodeIterator.successorArray();
			if ( pl != null ) pl.update();
	}
	writeOffset( obs, nodeIterator.ibs.readBits() - lastOffset );
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:20,代码来源:BVGraph.java

示例3: writeOffsets

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
@Override
public void writeOffsets( final OutputBitStream obs, final ProgressLogger pl ) throws IOException {
    final HdfsBVGraphNodeIterator nodeIterator = (HdfsBVGraphNodeIterator) nodeIterator( 0 );
    int n = numNodes();
    long lastOffset = 0;
    while( n-- != 0 ) {
        writeOffset( obs, nodeIterator.ibs.readBits() - lastOffset );
        lastOffset = nodeIterator.ibs.readBits();
        nodeIterator.nextInt();
        nodeIterator.outdegree();
        nodeIterator.successorArray();
        if ( pl != null ) pl.update();
    }
    writeOffset( obs, nodeIterator.ibs.readBits() - lastOffset );
}
 
开发者ID:helgeho,项目名称:HadoopWebGraph,代码行数:16,代码来源:HdfsBVGraph.java

示例4: writeRecords

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
@SuppressWarnings("resource")
public static int[] writeRecords(final String path, final int numRecords, final WarcRecord[] randomRecords, final int parallel) throws IOException, InterruptedException {
	final ProgressLogger pl = new ProgressLogger(LOGGER, "records");
	if (parallel <= 1) pl.expectedUpdates = numRecords;
	final ProgressLogger plb = new ProgressLogger(LOGGER, "KB");
	final CountingOutputStream cos = new CountingOutputStream(new FastBufferedOutputStream(new FileOutputStream (path)));
	final WarcWriter ww;
	if (parallel == 0) {
		ww = new UncompressedWarcWriter(cos);
		pl.start("Writing records…");
	} else if (parallel == 1) {
		ww = new CompressedWarcWriter(cos);
		pl.start("Writing records (compressed)…");
	} else {
		ww = null;
		pl.start("SHOULD NOT HAPPEN");
		throw new IllegalStateException();
	}
	plb.start();
	long written = 0;
	final int[] position = new int[numRecords];
	for (int i = 0; i < numRecords; i++) {
		final int pos = RandomTestMocks.RNG.nextInt(randomRecords.length);
		position[i] = pos;
		ww.write(randomRecords[pos]);
		if (parallel <= 0) {
			pl.lightUpdate();
			plb.update((cos.getCount() - written) / 1024);
		}
		written = cos.getCount();
	}
	ww.close();
	pl.done(numRecords);
	plb.done(cos.getCount());
	return position;
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:37,代码来源:RandomReadWritesTest.java

示例5: computeAll

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public SummaryStatistics[] computeAll() {
	SummaryStatistics[] results = new SummaryStatistics[retrievers.length];
	for (int i = 0; i < retrievers.length; i++)
		results[i] = new SummaryStatistics();
	
	IntSet queries = groundtruth.queriesWithRelevantDocs();
	
	ProgressLogger pl = new ProgressLogger(LOGGER, "query retrievals");
	pl.expectedUpdates = queries.size() * retrievers.length;
	pl.start("Computing results for each of the " + queries.size() + 
			" queries and "+retrievers.length+ " retrieving algorithms..."  );
	
	for (int query : queries) {
		for (int i = 0; i < retrievers.length; i++) {
			double value = computeForQuery(query, retrievers[i]);
			if (Double.isNaN(value))
				continue;
			results[i].addValue(value);
			pl.update();
		}
	}
	
	pl.done();
	
	long nItems = results[0].getN();
	for (SummaryStatistics s : results)
		if (s.getN() != nItems)
			throw new IllegalStateException("The measure returned NaN differently for different algorithms.");
	
	print(retrievers, results);
	
	return results;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:34,代码来源:AbstractMeasure.java

示例6: checkAll

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public void checkAll() {
	ProgressLogger pl = new ProgressLogger(LOGGER, "queries");
	pl.expectedUpdates = evaluations.queries().size();
	pl.start("Checking every query in dataset...");
	
	for (int node : evaluations.queries()) {
		check(node);
		pl.update();
	}
	pl.done();
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:12,代码来源:PooledDatasetChecker.java

示例7: computeExact

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
/** Computes and returns the neighbourhood function of the specified graph by multiple breadth-first visits.
 * 
 * <p>This method returns an array of longs. When some values of the function are near 2<sup>63</sup>, it
 * provides an exact value, as opposed to {@link #compute(ImmutableGraph, int, ProgressLogger)}.
 * 
 * @param g a graph.
 * @param threads the requested number of threads (0 for {@link Runtime#availableProcessors()}).
 * @param pl a progress logger, or <code>null</code>.
 * @return the neighbourhood function of the specified graph as an array of longs.
 */
public static long[] computeExact( final ImmutableGraph g, final int threads, final ProgressLogger pl ) {
	final int n = g.numNodes();
	long count[] = LongArrays.EMPTY_ARRAY;
	
	ParallelBreadthFirstVisit visit = new ParallelBreadthFirstVisit( g, threads, true, null );

	if ( pl != null ) {
		pl.itemsName = "nodes";
		pl.expectedUpdates = n;
		pl.start();
	}

	for( int i = 0; i < n; i++ ) {
		visit.clear();
		visit.visit( i );
		final int maxDistance = visit.maxDistance();
		if ( count.length <= maxDistance ) count = LongArrays.grow( count, maxDistance + 1 );
		for( int d = maxDistance + 1; d-- != 0; ) count[ d ] += visit.cutPoints.getInt( d + 1 ) - visit.cutPoints.getInt( d ); 
		if ( pl != null ) pl.update();
	}

	if ( pl != null ) pl.done();
	
	int last;
	for( last = count.length; last-- != 0 && count[ last ] == 0; );
	last++;
	final long[] result = new long[ last ];
	result[ 0 ] = count[ 0 ];
	for( int i = 1; i < last; i++ ) result[ i ] = result[ i - 1 ] + count[ i ];
	return result;
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:42,代码来源:NeighbourhoodFunction.java

示例8: extractAllData

import it.unimi.dsi.logging.ProgressLogger; //导入方法依赖的package包/类
public void extractAllData() throws IOException {
	DocumentIterator wikiPagesIterator = wikipediaDocumentSequence.iterator();
	Document wikiPage;
	String title;
	
	ProgressLogger pl = new ProgressLogger(LOGGER, "pages");
	pl.expectedUpdates = ESITMATED_NUM_OF_PAGES; 
	pl.info = new Object() {
		public String toString() {return catName2Id.size() + " categories found.";}
	};
	pl.start("Starting to iterate all the pages in the XML file...");
	
	// iterating pages
	while ((wikiPage = wikiPagesIterator.nextDocument()) != null) {
		switch (getNamespace(title = wikiPage.title().toString())) {
			case CATEGORY:
				cat2cat.put(
						getCategoryId(title.substring(CATEGORY_NAME_INDEX)),
						parseCategories(wikiPage)
						);
				break;
			case ARTICLE:
				int pageId = nextPageId++;
				pageId2Name.put(pageId, title);
				page2cat.put(pageId, 
						parseCategories(wikiPage)
						);
				plainUrisFile.println(wikiPage.uri());
				
				break;
			default:
				break;
		}
		
		wikiPage.close();
		pl.update();
		
	}
	pl.done();
	
	wikipediaDocumentSequence.close();
	wikiPagesIterator.close();
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:44,代码来源:WikipediaCategoryProducer.java


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