本文整理汇总了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;
}
示例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;
}
示例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 );
}