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


Java FlaggedOption类代码示例

本文整理汇总了Java中com.martiansoftware.jsap.FlaggedOption的典型用法代码示例。如果您正苦于以下问题:Java FlaggedOption类的具体用法?Java FlaggedOption怎么用?Java FlaggedOption使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: main

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
public static void main(final String[] arguments)
{
   try
   {
      final SimpleJSAP jsap = new SimpleJSAP(
         "Main Application",
         "Demonstrate JSAP",
         new Parameter[]
            {new FlaggedOption("file", STRING_PARSER, NO_DEFAULT, REQUIRED, 'f', "file", "File path/name."),
             new Switch("verbose", 'v', "verbose", "Requests verbose output." )});
      final JSAPResult parsedResult = jsap.parse(arguments);
      if (jsap.messagePrinted())
      {
         out.println(jsap.getHelp());
         System.exit( -1 );
      }

      out.println("File path/name is '" + parsedResult.getString("file") + "'.");
      out.println("Verbosity level is " + parsedResult.getBoolean("verbose"));
   }
   catch (JSAPException jsapException)
   {
      out.println("Exception encountered during parsing command line arguments - " + jsapException);
   }
}
 
开发者ID:dustinmarx,项目名称:java-cli-demos,代码行数:26,代码来源:Main.java

示例2: main

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
public static void main( String[] args ) throws Exception {
    SimpleJSAP jsap = new SimpleJSAP( FormatReader.class.getName(), "Tests the reading format", new Parameter[]{ new FlaggedOption( "input", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'i', "input", "Input file" ), } );
    JSAPResult jsapResult = jsap.parse( args );
    if( jsap.messagePrinted() ) return;
    final Iterable<StringAndCandidate> stringAndCandidates = FormatReader.stringAndCandidates( jsapResult.getString( "input" ), 0, 0 );
    int bogus = 0;
    int numberOfCandidates = 0;
    for( StringAndCandidate sc : stringAndCandidates ) {
        CandidatesInfo ci = sc.candidatesInfo;
        if( ci.QAF == 0 && ci.LAF == 0 && ci.LAT == 0 && ci.QAC == 0 && ci.QAT == 0 ) bogus++;
        numberOfCandidates++;
        if( sc.surfaceForm.contains( "brad pitt" ) ) System.out.println( sc.surfaceForm + "\n" + ci );
    }

    LOGGER.info( "Candidates with all zeros : " + bogus );
    LOGGER.info( "Number of candidates:" + numberOfCandidates );
}
 
开发者ID:yahoo,项目名称:FEL,代码行数:18,代码来源:FormatReader.java

示例3: register

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
/**
 * Registers the arguments.
 *
 * @throws JSAPException
 *              The exception.
 */
private void register() throws JSAPException {
    logger.info("register method");
    jsap = new JSAP();
    FlaggedOption wOpt = new FlaggedOption("wsdl")
            .setStringParser(JSAP.STRING_PARSER)
            .setShortFlag('w')
            .setRequired(true);
    jsap.registerParameter(wOpt);
    FlaggedOption genOpt = new FlaggedOption("generatedFolder")
            .setStringParser(JSAP.STRING_PARSER)
            .setShortFlag('g')
            .setRequired(false)
            .setDefault(DEFAULT_FOLDER);
    jsap.registerParameter(genOpt);
}
 
开发者ID:SpectroFinance,项目名称:ksoap2-generator,代码行数:22,代码来源:Wsdl2J2me.java

示例4: main

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
public static void main( String args[] ) throws IllegalArgumentException, SecurityException, JSAPException, UnsupportedEncodingException, FileNotFoundException {

		final SimpleJSAP jsap = new SimpleJSAP( ImmutableSubgraph.class.getName(), "Writes the property file of an immutable subgraph.",
				new Parameter[] {
						new UnflaggedOption( "supergraphBasename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the supergraph." ),
						new FlaggedOption( "subgraphNodes", JSAP.STRING_PARSER, null, JSAP.NOT_REQUIRED, 's', "subgraph-nodes", "Sets a subgraph node file (a list integers in DataInput format). If not specified, the name will be stemmed from the basename." ),
						new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of resulting immutable subgraph." ),
					}		
				);
		
		final JSAPResult jsapResult = jsap.parse( args );
		if ( jsap.messagePrinted() ) System.exit( 1 );

		final PrintWriter pw = new PrintWriter( new OutputStreamWriter( new FileOutputStream( jsapResult.getString( "basename" ) + ImmutableGraph.PROPERTIES_EXTENSION ), "UTF-8" ) );
		pw.println( ImmutableGraph.GRAPHCLASS_PROPERTY_KEY + " = " + ImmutableSubgraph.class.getName() );
		pw.println( "supergraphbasename = " + jsapResult.getString( "supergraphBasename" ) );
		if ( jsapResult.userSpecified( "subgraphNodes" )  ) pw.println( "subgraphnodes = " + jsapResult.getString( "subgraphNodes" ) );	
		pw.close();
	}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:20,代码来源:ImmutableSubgraph.java

示例5: main

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
public static void main( String arg[] ) throws IOException, JSAPException, IllegalArgumentException, ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException {
	SimpleJSAP jsap = new SimpleJSAP( SequentialHyperBall.class.getName(), "Prints an approximation of the neighbourhood function.",
		new Parameter[] {
			new FlaggedOption( "log2m", JSAP.INTEGER_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'l', "log2m", "The logarithm of the number of registers." ),
			new FlaggedOption( "upperBound", JSAP.LONGSIZE_PARSER, Long.toString( Long.MAX_VALUE ), JSAP.NOT_REQUIRED, 'u', "upper-bound", "An upper bound to the number of iteration (default: the graph size)." ),
			new FlaggedOption( "threshold", JSAP.DOUBLE_PARSER, Double.toString( 1E-3 ), JSAP.NOT_REQUIRED, 't', "threshould", "A threshould that will be used to stop the computation by absolute or relative increment." ),
			new Switch( "spec", 's', "spec", "The source is not a basename but rather a specification of the form <ImmutableGraphImplementation>(arg,arg,...)." ),
			new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the graph." ),
		}		
	);

	JSAPResult jsapResult = jsap.parse( arg );
	if ( jsap.messagePrinted() ) System.exit( 1 );
	
	final boolean spec = jsapResult.getBoolean( "spec" );
	final String basename = jsapResult.getString( "basename" );
	final ProgressLogger pl = new ProgressLogger( LOGGER );
	final int log2m = jsapResult.getInt( "log2m" );
	
	final ImmutableGraph graph = spec ? ObjectParser.fromSpec( basename, ImmutableGraph.class, GraphClassParser.PACKAGE ) : ImmutableGraph.loadOffline( basename );
	
	SequentialHyperBall shb = new SequentialHyperBall( graph, log2m, pl, Util.randomSeed() );
	TextIO.storeDoubles( shb.approximateNeighbourhoodFunction( jsapResult.getLong( "upperBound" ), jsapResult.getDouble( "threshold" ) ), System.out );
	shb.close();
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:26,代码来源:SequentialHyperBall.java

示例6: ShellManager

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
protected ShellManager() throws JSAPException {
    this.reader = new BufferedReader(new InputStreamReader(System.in));
    this.jsap = new SimpleJSAP(
        "kuzoff",
        "",
        new Parameter[] {
            new FlaggedOption(DATABASE_FOLDER_OPTION)
                .setShortFlag('d').setLongFlag("database").setUsageName("database root folder").setRequired(true),
            new FlaggedOption(COMMAND_NAME_OPTION)
                .setShortFlag('c').setLongFlag("command").setUsageName("command to execute").setRequired(true),
            new FlaggedOption(PARAMETERS_OPTION)
                .setShortFlag('p')
                .setLongFlag("parameters")
                .setUsageName("command parameters (name_1=value_1;...name_k=value_k)")
                .setRequired(false)
        }
    );
    
    this.hasMoreCommands = true;
}
 
开发者ID:cyber-waste,项目名称:kuzoff,代码行数:21,代码来源:ShellManager.java

示例7: initJSAP

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
private static void initJSAP() throws JSAPException {
	jsap = new JSAP();
	    	
    FlaggedOption opt8 = new FlaggedOption(ARG_RESULT_DIR_LONG)
    	.setStringParser(JSAP.STRING_PARSER)
    	.setRequired(false) 
    	.setShortFlag(ARG_RESULT_DIR_SHORT)
    	.setLongFlag(ARG_RESULT_DIR_LONG)
    	.setDefault(".");
    opt8.setHelp("PATH/TO/directory where to search for results (output directory of DMTable).");
    
    jsap.registerParameter(opt8);	
    
    FlaggedOption opt9 = new FlaggedOption(ARG_OUTPUT_DIR_LONG)
    	.setStringParser(JSAP.STRING_PARSER)
    	.setRequired(false) 
    	.setShortFlag(ARG_OUTPUT_DIR_SHORT)
    	.setLongFlag(ARG_OUTPUT_DIR_LONG)
    	.setDefault(".");
    opt9.setHelp("PATH/TO/directory where to output results (does not need to exist).");
    
    jsap.registerParameter(opt9);	
    
    FlaggedOption opt1 = new FlaggedOption(ARG_OUTPUT_FILE_NAME_LONG)
    	.setStringParser(JSAP.STRING_PARSER)
    	.setRequired(false) 
    	.setShortFlag(ARG_OUTPUT_FILE_NAME_SHORT)
    	.setLongFlag(ARG_OUTPUT_FILE_NAME_LONG)
    	.setDefault("DMTable-Results.xls");
    opt1.setHelp("Name of the filename to produce. If it won't end with .xls, it will be extended with this suffix.");

    jsap.registerParameter(opt1);	    	   
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:34,代码来源:MainExcelReport.java

示例8: main

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
public static void main(final String arg[]) throws Exception {
	final SimpleJSAP jsap = new SimpleJSAP(Agent.class.getName(), "Starts a BUbiNG agent (note that you must enable JMX by means of the standard Java system properties).",
			new Parameter[] {
				new FlaggedOption("weight", JSAP.INTEGER_PARSER, "1", JSAP.NOT_REQUIRED, 'w', "weight", "The agent weight."),
				new FlaggedOption("group", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'g', "group", "The JGroups group identifier (must be the same for all cooperating agents)."),
				new FlaggedOption("jmxHost", JSAP.STRING_PARSER, InetAddress.getLocalHost().getHostAddress(), JSAP.REQUIRED, 'h', "jmx-host", "The IP address (possibly specified by a host name) that will be used to expose the JMX RMI connector to other agents."),
				new FlaggedOption("rootDir", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'r', "root-dir", "The root directory."),
				new Switch("new", 'n', "new", "Start a new crawl"),
				new FlaggedOption("properties", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'P', "properties", "The properties used to configure the agent."),
				new UnflaggedOption("name", JSAP.STRING_PARSER, JSAP.REQUIRED, "The agent name (an identifier that must be unique across the group).")
		});

		final JSAPResult jsapResult = jsap.parse(arg);
		if (jsap.messagePrinted()) System.exit(1);

		// JMX *must* be set up.
		final String portProperty = System.getProperty(JMX_REMOTE_PORT_SYSTEM_PROPERTY);
		if (portProperty == null) throw new IllegalArgumentException("You must specify a JMX service port using the property " + JMX_REMOTE_PORT_SYSTEM_PROPERTY);

		final String name = jsapResult.getString("name");
		final int weight = jsapResult.getInt("weight");
		final String group = jsapResult.getString("group");
		final String host = jsapResult.getString("jmxHost");
		final int port = Integer.parseInt(portProperty);

		final BaseConfiguration additional = new BaseConfiguration();
		additional.addProperty("name", name);
		additional.addProperty("group", group);
		additional.addProperty("weight", Integer.toString(weight));
		additional.addProperty("crawlIsNew", Boolean.valueOf(jsapResult.getBoolean("new")));
		if (jsapResult.userSpecified("rootDir")) additional.addProperty("rootDir", jsapResult.getString("rootDir"));

		new Agent(host, port, new RuntimeConfiguration(new StartupConfiguration(jsapResult.getString("properties"), additional)));
		System.exit(0); // Kills remaining FetchingThread instances, if any.
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:36,代码来源:Agent.java

示例9: main

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
public static void main(String[] args) throws JSAPException, IOException, InterruptedException {
	final SimpleJSAP jsap = new SimpleJSAP(RandomReadWritesTest.class.getName(), "Writes some random records on disk.",
		new Parameter[] {
			new FlaggedOption("random", JSAP.INTEGER_PARSER, "100", JSAP.NOT_REQUIRED, 'r', "random", "The number of random record to sample from."),
			new FlaggedOption("body", JSAP.INTSIZE_PARSER, "4K", JSAP.NOT_REQUIRED, 'b', "body", "The maximum size of the random generated body (in bytes)."),
			new Switch("fully", 'f', "fully", "Whether to read fully the record (and do a minimal sequential cosnsistency check)."),
			new Switch("writeonly", 'w', "writeonly", "Whether to skip the read part (if present, 'fully' will be ignored."),
			new UnflaggedOption("path", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The path to write to."),
			new UnflaggedOption("records", JSAP.INTSIZE_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The numer of records to write."),
	});

	final JSAPResult jsapResult = jsap.parse(args);
	if (jsap.messagePrinted()) System.exit(1);

	final String path = jsapResult.getString("path");
	final boolean compress = path.endsWith(".gz");
	final boolean fully = jsapResult.getBoolean("fully");
	final int parallel = compress ? 1 : 0;

	final int body = jsapResult.getInt("body");

	final WarcRecord[] rnd = prepareRndRecords(jsapResult.getInt("random"), RESPONSE_PROBABILITY, MAX_NUMBER_OF_HEADERS, MAX_LENGTH_OF_HEADER, body);
	final int[] sequence = writeRecords(path, jsapResult.getInt("records"), rnd, parallel);
	if (! jsapResult.getBoolean("writeonly"))
		readRecords(path, sequence, body, fully, compress);

}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:28,代码来源:RandomReadWritesTest.java

示例10: main

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
public static void main( String args[] ) throws JSAPException, IOException {
    SimpleJSAP jsap = new SimpleJSAP( UncompressedWordVectors.class.getName(), "Creates a Word Vector representation from a string file", new Parameter[]{ new FlaggedOption( "input", JSAP.STRING_PARSER, JSAP
            .NO_DEFAULT, JSAP.REQUIRED, 'i', "input", "Vector file" ), new FlaggedOption( "output", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'o', "output", "Output file name" ) } );
    JSAPResult jsapResult = jsap.parse( args );
    if( jsap.messagePrinted() ) return;
    UncompressedWordVectors vec = UncompressedWordVectors.read( jsapResult.getString( "input" ) );
    vec.N = vec.vectors.get( vec.vectors.keySet().iterator().next() ).length;
    BinIO.storeObject( vec, jsapResult.getString( "output" ) );
}
 
开发者ID:yahoo,项目名称:FEL,代码行数:10,代码来源:UncompressedWordVectors.java

示例11: addParametersFromClass

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
public static void addParametersFromClass(JSAP jsap, Class<?> clazz, Object objectWithDefaults, String[] excluded) throws JSAPException, ReflectiveOperationException {
	
	boolean allRequired = (objectWithDefaults == Default.NO_DEFAULT);
	
	for (Field field : clazz.getFields() ) {
			if (Modifier.isPublic(field.getModifiers())) {
				
				String defaultValue = JSAP.NO_DEFAULT;

				if (!allRequired) {
					Object defaultValueObj = field.get(objectWithDefaults);
					if (defaultValueObj == null)
						defaultValue = JSAP.NO_DEFAULT;
					else
						defaultValue = defaultValueObj.toString();
				}
				
				String id = field.getName().toLowerCase();
				boolean isToExclude = false;
				for (String exclude : excluded)
					if (exclude.equalsIgnoreCase(id)) {
						isToExclude = true;
						break;
					}
				
				if (!isToExclude)
					jsap.registerParameter(new FlaggedOption(
							id, //id
							getParserFor(field.getType()), // string parser
							defaultValue,
							allRequired,
							JSAP.NO_SHORTFLAG,
							id
							//, getHelpFor(field)
					));
				
				
			}
	}
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:41,代码来源:JsapUtils.java

示例12: main

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T extends AbstractMeasure> void main(String[] args, Class<T> concreteMeasure) throws Exception {
	JsapResultsWithObject<T> jsapObj = JsapUtils
			.constructObject(concreteMeasure, args, "Compute " + concreteMeasure.getSimpleName(),
					new Parameter[] {
					
					new FlaggedOption("names",
							JSAP.STRING_PARSER, JSAP.NO_DEFAULT,
							JSAP.NOT_REQUIRED, 'n', "names",
							"if supplied, output will use names for each query instead of query id"),
					new FlaggedOption( "output", 
							JSAP.STRING_PARSER, null, JSAP.NOT_REQUIRED, 
							'o', "output", 
							"Output file path to save query-specific data." ),
			
			});

	T measurer = jsapObj.getObject();
	JSAPResult jsap = jsapObj.getJsapResult();
	if (jsap.contains("names"))
		measurer.setQueryNames((Int2ObjectMap<String>) SerializationUtils
				.read(jsap.getString("names")));
	
	if (jsap.contains("output"))
		measurer.setOutputPathTo(jsap.getString("output"));

	measurer.computeAll();
	measurer.close();
	
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:31,代码来源:AbstractMeasure.java

示例13: Actuary

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
public Actuary() {
	try {
		jsap = new SimpleJSAP(
					"actuary",
				    "Reads in LOAN ontologies and performs inferences upon them.",
				    new Parameter[] {
							//new Switch("displayhelp", 'h', "help", "Display this help message."),
					    new FlaggedOption("verbosity", JSAP.INTEGER_PARSER, "0", true, 'v',"verbosity", "The higher the verbosity, the more the system will output"),
							new UnflaggedOption("files", JSAP.STRING_PARSER, null, true, true, "The files to load.")
					}
				);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:automenta,项目名称:opennars,代码行数:16,代码来源:Actuary.java

示例14: main

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
public static void main( String arg[] ) throws IOException, JSAPException {		
	SimpleJSAP jsap = new SimpleJSAP( ErdosRenyiGraph.class.getName(), "Generates an Erd\u0151s-R\u00E9nyi random graph and stores it as a BVGraph.",
			new Parameter[] {
		new Switch( "loops", 'l', "loops", "Whether the graph should include self-loops." ), 
		new FlaggedOption( "p", JSAP.DOUBLE_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'p', "The probability of generating an arc." ),
		new FlaggedOption( "m", JSAP.LONGSIZE_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'm', "The expected number of arcs." ),
		new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.REQUIRED, "The basename of the output graph file." ),
		new UnflaggedOption( "n", JSAP.INTEGER_PARSER, JSAP.REQUIRED, "The number of nodes." ),
	});
	JSAPResult jsapResult = jsap.parse( arg );
	if ( jsap.messagePrinted() ) System.exit( 1 );

	final String baseName = jsapResult.getString( "basename" );
	final int n = jsapResult.getInt( "n" );
	final boolean loops = jsapResult.getBoolean( "loops" );
	
	if ( jsapResult.userSpecified( "p" ) && jsapResult.userSpecified( "m" ) ) {
		System.err.println( "Options p and m cannot be specified together" );
		System.exit( 1 );
	}
	if ( ! jsapResult.userSpecified( "p" ) && ! jsapResult.userSpecified( "m" ) ) {
		System.err.println( "Exactly one of the options p and m must be specified" );
		System.exit( 1 );
	}
	
	BVGraph.store( ( jsapResult.userSpecified( "p" ) ? new ErdosRenyiGraph( n, jsapResult.getDouble( "p" ), loops ) : new ErdosRenyiGraph( n, jsapResult.getLong( "m" ), loops ) ), baseName, new ProgressLogger() );
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:28,代码来源:ErdosRenyiGraph.java

示例15: main

import com.martiansoftware.jsap.FlaggedOption; //导入依赖的package包/类
public static void main( String args[] ) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, IOException, JSAPException  {
	String sourceBasename, destBasename;
	Class<?> graphClass;
	
	SimpleJSAP jsap = new SimpleJSAP( ArcListASCIIGraph.class.getName(), "Reads a graph with a given basename and writes it out in ASCII format with another basename",
			new Parameter[] {
					new FlaggedOption( "graphClass", GraphClassParser.getParser(), null, JSAP.NOT_REQUIRED, 'g', "graph-class", "Forces a Java class for the source graph" ),
					new FlaggedOption( "shift", JSAP.INTEGER_PARSER, null, JSAP.NOT_REQUIRED, 'S', "shift", "A shift that will be added to each node index." ),
					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 UnflaggedOption( "sourceBasename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the source graph" ),
					new UnflaggedOption( "destBasename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the destination graph" ),
				}		
			);
			
	JSAPResult jsapResult = jsap.parse( args );
	if ( jsap.messagePrinted() ) System.exit( 1 );
	
	graphClass = jsapResult.getClass( "graphClass" );
	sourceBasename = jsapResult.getString( "sourceBasename" );
	destBasename = jsapResult.getString( "destBasename" );

	final ProgressLogger pl = new ProgressLogger( LOGGER, jsapResult.getLong( "logInterval" ), TimeUnit.MILLISECONDS );

	final ImmutableGraph graph = graphClass != null 
		? (ImmutableGraph)graphClass.getMethod( "loadOffline", CharSequence.class, ProgressLogger.class ).invoke( null, sourceBasename, pl )
		: ImmutableGraph.loadOffline( sourceBasename, pl );
	if ( jsapResult.userSpecified( "shift" ) ) ArcListASCIIGraph.store( graph, destBasename, jsapResult.getInt( "shift" ) );
	else ArcListASCIIGraph.store( graph, destBasename );
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:30,代码来源:ArcListASCIIGraph.java


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