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


Java BinIO.loadInts方法代码示例

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


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

示例1: load

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
/** Creates a new immutable subgraph by loading the supergraph, delegating the 
 *  actual loading to the class specified in the <samp>supergraphclass</samp> property within the property
 *  file (named <samp><var>basename</var>.properties</samp>), and loading the subgraph array in memory.
 *  The exact load method to be used depends on the <code>method</code> argument.
 * 
 * @param method the method to be used to load the supergraph.
 * @param basename the basename of the graph.
 * @param pl the progress logger; it can be <code>null</code>.
 * @return an immutable subgraph containing the specified graph.
 */

protected static ImmutableGraph load( final LoadMethod method, final CharSequence basename, final ProgressLogger pl ) throws IOException {
	final FileInputStream propertyFile = new FileInputStream( basename + PROPERTIES_EXTENSION );
	final Properties properties = new Properties();
	properties.load( propertyFile );
	propertyFile.close();

	final String graphClassName = properties.getProperty( ImmutableGraph.GRAPHCLASS_PROPERTY_KEY );
	if ( ! graphClassName.equals( ImmutableSubgraph.class.getName() ) ) throw new IOException( "This class (" + ImmutableSubgraph.class.getName() + ") cannot load a graph stored using " + graphClassName );
	
	final String supergraphBasename = properties.getProperty( SUPERGRAPHBASENAME_PROPERTY_KEY );
	if ( supergraphBasename == null ) throw new IOException( "This property file does not specify the required property supergraphbasename" );
	
	final ImmutableGraph supergraph = ImmutableGraph.load( method, supergraphBasename, null, pl );
	
	if ( pl != null ) pl.start( "Reading nodes..." );
	final String nodes = properties.getProperty( SUBGRAPHNODES_PROPERTY_KEY );
	final ImmutableSubgraph isg = new ImmutableSubgraph( supergraph, BinIO.loadInts( nodes != null ? nodes : basename + ".nodes" ) );
	if ( pl != null ) {
		pl.count = isg.numNodes();
		pl.done();
	}
	isg.basename = new MutableString( basename );
	return isg;
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:36,代码来源:ImmutableSubgraph.java

示例2: NodeClassFilter

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
/** Creates a new instance.
 * 
 * @param classFile name of the class file.
 * @param keepOnlySame whether to keep nodes in the same class.
 */
public NodeClassFilter( final String classFile, final boolean keepOnlySame ) {
	try {
		nodeClass = BinIO.loadInts( classFile );
	}
	catch ( IOException e ) {
		throw new RuntimeException( e );
	}
	this.keepOnlySame = keepOnlySame;
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:15,代码来源:Transform.java

示例3: main

import it.unimi.dsi.fastutil.io.BinIO; //导入方法依赖的package包/类
static public void main( String arg[] ) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, JSAPException, IOException, ClassNotFoundException {
	SimpleJSAP jsap = new SimpleJSAP( Stats.class.getName(), "Computes statistical data of a given graph.",
			new Parameter[] {
					new FlaggedOption( "graphClass", GraphClassParser.getParser(), null, JSAP.NOT_REQUIRED, 'g', "graph-class", "Forces a Java class for the source graph." ),
					new FlaggedOption( "logInterval", JSAP.LONG_PARSER, Long.toString( ProgressLogger.DEFAULT_LOG_INTERVAL ), JSAP.NOT_REQUIRED, 'l', "log-interval", "The minimum time interval between activity logs in milliseconds." ),
					new Switch( "saveDegrees", 's', "save-degrees", "Save indegrees and outdegrees in text format." ),
					new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the graph." ),
					new UnflaggedOption( "resultsBasename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, JSAP.NOT_GREEDY, "The basename of the resulting files." ),
				}		
			);
	
	JSAPResult jsapResult = jsap.parse( arg );
	if ( jsap.messagePrinted() ) System.exit( 1 );

	final Class<?> graphClass = jsapResult.getClass( "graphClass" );
	final String basename = jsapResult.getString( "basename" );
	final String resultsBasename = jsapResult.userSpecified( "resultsBasename" ) ? jsapResult.getString( "resultsBasename" ) : basename;
	
	final ProgressLogger pl = new ProgressLogger();
	pl.logInterval = jsapResult.getLong( "logInterval" );
	
	final ImmutableGraph graph;

	if ( graphClass != null ) graph = (ImmutableGraph)graphClass.getMethod( "loadOffline", CharSequence.class ).invoke( null, basename );
	else graph = ImmutableGraph.loadOffline( basename, pl );

	final LongArrayBitVector buckets = (LongArrayBitVector)( new File( basename + ".buckets" ).exists() ? BinIO.loadObject( basename + ".buckets" ) : null );
	final int[] sccsize = new File( basename + ".sccsizes" ).exists() ? BinIO.loadInts( basename + ".sccsizes" ) : null;

	run( graph, buckets, sccsize, resultsBasename, jsapResult.getBoolean( "saveDegrees" ), pl );
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:32,代码来源:Stats.java


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