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


Java CmdLineParser类代码示例

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


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

示例1: parseCmd

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
public void parseCmd(String[] args){
//System.out.println("*** running ArduinoClient standalone WparseCmd");

      CmdLineParser parser = new CmdLineParser();
      CmdLineParser.Option debugOption = parser.addBooleanOption('X', "debug");
      CmdLineParser.Option arduinoServerOption = parser.addStringOption('s', "arduinoServer");
      
      try {
          parser.parse(args);
      }
      catch ( CmdLineParser.OptionException e ) {
          System.err.println(e.getMessage());
          System.out.println("parseCmd had an error\n"+ usage );
          System.exit(2);
      }	        
      
      //	        String portname = args[0];  // e.g. "/dev/cu.KeySerial1", or "COM5" or "192.168.1.1:5002"
      arduinoServer = (((String)parser.getOptionValue(arduinoServerOption)));
      Boolean debugBool = (Boolean)parser.getOptionValue(debugOption,new Boolean(false));
      setDebug(debugBool.booleanValue());
      //System.out.println("debug is ("+isDebug()+")");
      //System.out.println("*** end of parseCmd");
  }
 
开发者ID:dprg,项目名称:roomba,代码行数:24,代码来源:ArduinoClient.java

示例2: parseCountFlags

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
private int parseCountFlags(CmdLineParser parser) {

        int countFlags = 0;
        countFlags += (Boolean) parser.getOptionValue(separateBasesOption, false) ? CoverageCounter.BASES : 0;
        countFlags += (Boolean) parser.getOptionValue(includeDupsOpt, false) ? CoverageCounter.INCLUDE_DUPS : 0;
        countFlags += (Boolean) parser.getOptionValue(pairedCoverageOpt, false) ? CoverageCounter.PAIRED_COVERAGE : 0;
        String strandopt = (String) parser.getOptionValue(strandOption, "");
        if (strandopt.equals("read")) {
            countFlags += CoverageCounter.STRANDS_BY_READ;
        } else if (strandopt.equals("first")) {
            countFlags += CoverageCounter.STRANDS_BY_FIRST_IN_PAIR;
        } else if (strandopt.equals("second")) {
            log.warn("Warning: 'second' Option undocumented and may be removed in the future. BE WARNED!");
            countFlags += CoverageCounter.STRANDS_BY_SECOND_IN_PAIR;
        }
        return countFlags;
    }
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:18,代码来源:IgvTools.java

示例3: buildParser

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
/**
 * Create a new command line parser.
 * 
 * @return command line parser
 */
public static CmdLineParser buildParser() {
    CmdLineParser parser = new CmdLineParser();

    HELP_ARG = parser.addBooleanOption(HELP);
    SIGN_ARG = parser.addBooleanOption(SIGN);
    VALIDATE_ARG = parser.addBooleanOption(VALIDATE);
    INPUT_FILE_ARG = parser.addStringOption(INPUT_FILE);
    KEYSTORE_ARG = parser.addStringOption(KEYSTORE);
    KEYSTORE_TYPE_ARG = parser.addStringOption(KEYSTORE_TYPE);
    KEYSTORE_PASS_ARG = parser.addStringOption(KEYSTORE_PASS);
    ALIAS_ARG = parser.addStringOption(ALIAS);
    KEY_PASS_ARG = parser.addStringOption(KEY_PASS);
    OUTPUT_FILE_ARG = parser.addStringOption(OUTPUT_FILE);

    return parser;
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:22,代码来源:MetadataTool.java

示例4: testStandardOptions

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
public void testStandardOptions() throws Exception {
	CmdLineParser parser = new CmdLineParser();
	CmdLineParser.Option verbose = parser.addBooleanOption('v', "verbose");
	CmdLineParser.Option size = parser.addIntegerOption('s', "size");
	CmdLineParser.Option name = parser.addStringOption('n', "name");
	CmdLineParser.Option fraction = parser.addDoubleOption('f', "fraction");
	CmdLineParser.Option missing = parser.addBooleanOption('m', "missing");
	CmdLineParser.Option careful = parser.addBooleanOption("careful");
	CmdLineParser.Option bignum = parser.addLongOption('b', "bignum");
	assertEquals(null, parser.getOptionValue(size));
	Long longValue = new Long(new Long(Integer.MAX_VALUE).longValue() + 1);
	parser.parse(new String[] { "-v", "--size=100", "-b",
			longValue.toString(), "-n", "foo", "-f", "0.1", "rest" },
			Locale.US);
	assertEquals(null, parser.getOptionValue(missing));
	assertEquals(Boolean.TRUE, parser.getOptionValue(verbose));
	assertEquals(100, ((Integer) parser.getOptionValue(size)).intValue());
	assertEquals("foo", parser.getOptionValue(name));
	assertEquals(longValue, parser.getOptionValue(bignum));
	assertEquals(0.1, ((Double) parser.getOptionValue(fraction))
			.doubleValue(), 0.1e-6);
	assertArrayEquals(new String[]{"rest"}, parser.getRemainingArgs());
}
 
开发者ID:ghofferek,项目名称:Suraq,代码行数:24,代码来源:CmdLineParserTestCase.java

示例5: testExplictlyTerminatedOptions

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
public void testExplictlyTerminatedOptions() throws Exception {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option alt = parser.addBooleanOption('a', "alt");
CmdLineParser.Option debug = parser.addBooleanOption('d', "debug");
CmdLineParser.Option verbose = parser.addBooleanOption('v', "verbose");
CmdLineParser.Option fraction = parser.addDoubleOption('f', "fraction");
parser.parse(new String[] {
        "-a", "hello", "-d", "-f", "10", "--", "goodbye", "-v", "welcome",
        "-f", "-10"
      });

      assertEquals(Boolean.TRUE,   parser.getOptionValue(alt));
      assertEquals(Boolean.TRUE,   parser.getOptionValue(debug));
      assertEquals(null,           parser.getOptionValue(verbose));
      assertEquals(new Double(10), parser.getOptionValue(fraction));

assertArrayEquals(
        new String[]{"hello", "goodbye", "-v", "welcome", "-f", "-10"},
        parser.getRemainingArgs());
  }
 
开发者ID:ghofferek,项目名称:Suraq,代码行数:21,代码来源:CmdLineParserTestCase.java

示例6: testCustomOption

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
public void testCustomOption() throws Exception {
    Calendar calendar = Calendar.getInstance();
    CmdLineParser parser = new CmdLineParser();
    CmdLineParser.Option date =
        parser.addOption(new ShortDateOption('d', "date"));

    parser.parse(new String[]{"-d", "11/03/2003"}, Locale.UK);
    Date d = (Date)parser.getOptionValue(date);
    calendar.setTime(d);
    assertEquals(11,             calendar.get(Calendar.DAY_OF_MONTH));
    assertEquals(Calendar.MARCH, calendar.get(Calendar.MONTH));
    assertEquals(2003,           calendar.get(Calendar.YEAR));

    parser.parse(new String[]{"-d", "11/03/2003"}, Locale.US);
    d = (Date)parser.getOptionValue(date);
    calendar.setTime(d);
    assertEquals(3,                 calendar.get(Calendar.DAY_OF_MONTH));
    assertEquals(Calendar.NOVEMBER, calendar.get(Calendar.MONTH));
    assertEquals(2003,              calendar.get(Calendar.YEAR));
}
 
开发者ID:ghofferek,项目名称:Suraq,代码行数:21,代码来源:CustomOptionTestCase.java

示例7: readArguments

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
@Override
public void readArguments(String[] argv, CmdLineParser parser)   {
    Globals.setHeadless(true);


    if (argv.length != 3) {
        printUsageAndExit();
    }

    dump = new Dump();

    // dump will read in the index of the .hic file and output the observed matrix with no normalization
    // change "NONE" to "KR" or "VC" for different normalizations
    // change outputfile if needed
    // the other values are dummy and will be reset
    String[] args = {"dump", "observed", argv[2], argv[1], "X", "X", "BP", "1000000", "/Users/nchernia/Downloads/output2.txt"};
    dump.readArguments(args, parser);

}
 
开发者ID:theaidenlab,项目名称:Juicebox,代码行数:20,代码来源:Benchmark.java

示例8: readArguments

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
@Override
public void readArguments(String[] args, CmdLineParser parser) {
    //setUsage("juicebox bigWig <bigWig path or URL> <window size in bp> [chr] [start base] [end base]");
    if (!(args.length == 3 || args.length == 4 || args.length == 6)) {
        printUsageAndExit();
    }
    path = args[1];
    windowSize = Integer.parseInt(args[2]);

    if (args.length == 3) {
        version = 0;
    } else {
        chr = args[3];
        if (args.length == 4) {
            version = 1;
        } else {
            start = Integer.parseInt(args[4]) - 1;  // Convert to "zero" based coords
            end = Integer.parseInt(args[5]);
            version = 2;
        }
    }
}
 
开发者ID:theaidenlab,项目名称:Juicebox,代码行数:23,代码来源:BigWig.java

示例9: readArguments

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
@Override
public void readArguments(String[] args, CmdLineParser parser) {
    CommandLineParser parser1 = (CommandLineParser) parser;
    if (parser1.getHelpOption()) {
        printUsageAndExit();
    }

    //setUsage("juicebox addNorm hicFile");
    if (args.length != 2) {
        printUsageAndExit();
    }
    noFragNorm = parser1.getNoFragNormOption();
    genomeWideResolution = parser1.getGenomeWideOption();
    file = args[1];

}
 
开发者ID:theaidenlab,项目名称:Juicebox,代码行数:17,代码来源:AddNorm.java

示例10: process_cmdline_args

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
private static void process_cmdline_args(String[] args) {
    CmdLineParser parser = new CmdLineParser();
    CmdLineParser.Option optionCodons = parser.addStringOption('c', "codons");
    CmdLineParser.Option optionMatrixFile = parser.addStringOption('m', "matrix-file");
    CmdLineParser.Option optionServerIPname = parser.addStringOption('s', "server");
    CmdLineParser.Option optionAuto = parser.addBooleanOption('a', "autogen");
    CmdLineParser.Option optionCodonLength = parser.addIntegerOption('n', "protein-length");
    CmdLineParser.Option optionIterCount = parser.addIntegerOption('r', "iteration");

    try {
        parser.parse(args);
    } catch (CmdLineParser.OptionException e) {
        System.err.println(e.getMessage());
        printUsage();
        System.exit(2);
    }

    clientCodons = (String) parser.getOptionValue(optionCodons, new String("A"));
    matrixFile = (String) parser.getOptionValue(optionMatrixFile, new String("matrices/Simple"));
    autogen = (Boolean) parser.getOptionValue(optionAuto, false);
    n = ((Integer) parser.getOptionValue(optionCodonLength, new Integer(100))).intValue();
    ProgClient.serverIPname = (String) parser.getOptionValue(optionServerIPname, new String("localhost"));
    Program.iterCount = ((Integer) parser.getOptionValue(optionIterCount, new Integer(1))).intValue();
}
 
开发者ID:XieConnect,项目名称:CircuitService,代码行数:25,代码来源:TestSWClient.java

示例11: process_cmdline_args

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
private static void process_cmdline_args(String[] args) {
    CmdLineParser parser = new CmdLineParser();
    CmdLineParser.Option optionAuto = parser.addBooleanOption('a', "autogen");
    CmdLineParser.Option optionDNALength = parser.addIntegerOption('n', "DNALength");
    CmdLineParser.Option optionSigma = parser.addIntegerOption('g', "sigma");

    try {
        parser.parse(args);
    } catch (CmdLineParser.OptionException e) {
        System.err.println(e.getMessage());
        printUsage();
        System.exit(2);
    }

    // dna = (String) parser.getOptionValue(optionDNA, new String("AGCT"));
    // EditDistanceServer.L = ((Integer) parser.getOptionValue(optionL, 5)).intValue();
    autogen = (Boolean) parser.getOptionValue(optionAuto, false);
    n = ((Integer) parser.getOptionValue(optionDNALength, new Integer(100))).intValue();
    EditDistanceCommon.sigma = ((Integer) parser.getOptionValue(optionSigma, new Integer(2))).intValue();
}
 
开发者ID:XieConnect,项目名称:CircuitService,代码行数:21,代码来源:TestEDServer.java

示例12: process_cmdline_args

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
private static void process_cmdline_args(String[] args) {
    CmdLineParser parser = new CmdLineParser();
    CmdLineParser.Option optionCodons = parser.addStringOption('c', "codons");
    CmdLineParser.Option optionMatrixFile = parser.addStringOption('m', "matrix-file");
    CmdLineParser.Option optionAuto = parser.addBooleanOption('a', "autogen");
    CmdLineParser.Option optionCodonLength = parser.addIntegerOption('n', "protein-length");

    try {
        parser.parse(args);
    } catch (CmdLineParser.OptionException e) {
        System.err.println(e.getMessage());
        printUsage();
        System.exit(2);
    }

    serverCodons = (String) parser.getOptionValue(optionCodons, new String("A"));
    matrixFile = (String) parser.getOptionValue(optionMatrixFile, new String("matrices/blosum20x20"));
    autogen = (Boolean) parser.getOptionValue(optionAuto, false);
    n = ((Integer) parser.getOptionValue(optionCodonLength, new Integer(100))).intValue();
}
 
开发者ID:XieConnect,项目名称:CircuitService,代码行数:21,代码来源:TestSWServer.java

示例13: process_cmdline_args

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
private static void process_cmdline_args(String[] args) {
    CmdLineParser parser = new CmdLineParser();
    CmdLineParser.Option optionServerIPname = parser.addStringOption('s', "server");
    CmdLineParser.Option optionAuto = parser.addBooleanOption('a', "autogen");
    CmdLineParser.Option optionDNALength = parser.addIntegerOption('n', "DNALength");
    CmdLineParser.Option optionIterCount = parser.addIntegerOption('r', "iteration");
    CmdLineParser.Option optionSigma = parser.addIntegerOption('g', "sigma");

    try {
        parser.parse(args);
    } catch (CmdLineParser.OptionException e) {
        System.err.println(e.getMessage());
        printUsage();
        System.exit(2);
    }

    autogen = (Boolean) parser.getOptionValue(optionAuto, false);
    n = ((Integer) parser.getOptionValue(optionDNALength, new Integer(100))).intValue();
    ProgClient.serverIPname = (String) parser.getOptionValue(optionServerIPname, new String("localhost"));
    Program.iterCount = ((Integer) parser.getOptionValue(optionIterCount, new Integer(10))).intValue();
    EditDistanceCommon.sigma = ((Integer) parser.getOptionValue(optionSigma, new Integer(2))).intValue();
}
 
开发者ID:XieConnect,项目名称:CircuitService,代码行数:23,代码来源:TestEDClient.java

示例14: process_cmdline_args

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
private static void process_cmdline_args(String[] args) {
    CmdLineParser parser = new CmdLineParser();
    CmdLineParser.Option optionKeyFile = parser.addStringOption('k', "key-file");
    CmdLineParser.Option optionAuto = parser.addBooleanOption('a', "autogen");

    try {
        parser.parse(args);
    } catch (CmdLineParser.OptionException e) {
        System.err.println(e.getMessage());
        printUsage();
        System.exit(2);
    }

    keyFile = (String) parser.getOptionValue(optionKeyFile, new String("key"));
    autogen = (Boolean) parser.getOptionValue(optionAuto, false);
}
 
开发者ID:XieConnect,项目名称:CircuitService,代码行数:17,代码来源:TestAESEncryptServer.java

示例15: process_cmdline_args

import jargs.gnu.CmdLineParser; //导入依赖的package包/类
private static void process_cmdline_args(String[] args) {
    CmdLineParser parser = new CmdLineParser();
    CmdLineParser.Option optionServerIPname = parser.addStringOption('s', "server");
    CmdLineParser.Option optionAuto = parser.addBooleanOption('a', "autogen");
    CmdLineParser.Option optionIterCount = parser.addIntegerOption('r', "iteration");

    try {
        parser.parse(args);
    } catch (CmdLineParser.OptionException e) {
        System.err.println(e.getMessage());
        printUsage();
        System.exit(2);
    }

    autogen = (Boolean) parser.getOptionValue(optionAuto, false);
    ProgClient.serverIPname = (String) parser.getOptionValue(optionServerIPname, new String("localhost"));
    Program.iterCount = ((Integer) parser.getOptionValue(optionIterCount, new Integer(1))).intValue();
}
 
开发者ID:XieConnect,项目名称:CircuitService,代码行数:19,代码来源:TestAESEncryptClient.java


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