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


Java OptionGroup类代码示例

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


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

示例1: checkRequiredOptions

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
public static void checkRequiredOptions() throws MissingOptionException {
    OptionGroup[] groups = {contentGroup};
    for(OptionGroup group : groups) {
        ArrayList<Option> groupOptions = new ArrayList<Option>(group.getOptions());
        boolean groupIsGiven = false;
        for (Option option : groupOptions){
            if (commandLine.hasOption(option.getOpt())) {
                groupIsGiven = true;
                break;
            }
        }
        if (!groupIsGiven){
            throw new MissingOptionException(groupOptions);
        }
    }
}
 
开发者ID:Ericsson,项目名称:eiffel-remrem-publish,代码行数:17,代码来源:CliOptions.java

示例2: MixtureOptionPack

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
public MixtureOptionPack() {
  super();
  alg = new OptionGroup();
  alg.addOption(reuse = new Option("Reuse","Use the reuse algorithm"))
     .addOption(neal8 = new Option("Neal8","Use Neal's algorithm 8"))
     .addOption(slice = new Option("Slice","Use the slice algorithm"));
  alg.setRequired(true);
     
  marg = new OptionGroup();
  marg.addOption(marginalized = new Option("Marginalized","Marginalize out cluster parameters"))
      .addOption(sampled = new Option("Sampled","Sample cluster parameters"));
  marg.setRequired(true);
  addOptionGroup(alg);
  addOptionGroup(marg);
  addOption("NumEmptyClusters", true, "Number of empty clusters to maintain (reuse,neal8)");
  //options.addOption("MaxEmptyClusters", true, "Maximum number of empty clusters to introduce (slice)");
}
 
开发者ID:BigBayes,项目名称:BNPMix.java,代码行数:18,代码来源:MixtureOptionPack.java

示例3: getOptions

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
private static Options getOptions() {
  Options options = new Options();
  options.addOption("b", "bind", true,
      "Address to bind the Thrift server to. [default: 0.0.0.0]");
  options.addOption("p", "port", true, "Port to bind to [default: " + DEFAULT_LISTEN_PORT + "]");
  options.addOption("f", "framed", false, "Use framed transport");
  options.addOption("c", "compact", false, "Use the compact protocol");
  options.addOption("w", "workers", true, "How many worker threads to use.");
  options.addOption("h", "help", false, "Print help information");
  options.addOption(null, "infoport", true, "Port for web UI");
  options.addOption("t", READ_TIMEOUT_OPTION, true,
    "Amount of time in milliseconds before a server thread will timeout " +
    "waiting for client to send data on a connected socket. Currently, " +
    "only applies to TBoundedThreadPoolServer");
  OptionGroup servers = new OptionGroup();
  servers.addOption(
      new Option("nonblocking", false, "Use the TNonblockingServer. This implies the framed transport."));
  servers.addOption(new Option("hsha", false, "Use the THsHaServer. This implies the framed transport."));
  servers.addOption(new Option("threadpool", false, "Use the TThreadPoolServer. This is the default."));
  options.addOptionGroup(servers);
  return options;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:23,代码来源:ThriftServer.java

示例4: init

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
private void init() {
  options.addOption("v", "verbose", false,
      "Verbose output; emits file and meta data delimiters");
  options.addOption("p", "printkv", false, "Print key/value pairs");
  options.addOption("e", "printkey", false, "Print keys");
  options.addOption("m", "printmeta", false, "Print meta data of file");
  options.addOption("b", "printblocks", false, "Print block index meta data");
  options.addOption("h", "printblockheaders", false, "Print block headers for each block.");
  options.addOption("k", "checkrow", false,
      "Enable row order check; looks for out-of-order keys");
  options.addOption("a", "checkfamily", false, "Enable family check");
  options.addOption("w", "seekToRow", true,
    "Seek to this row and print all the kvs for this row only");
  options.addOption("s", "stats", false, "Print statistics");

  OptionGroup files = new OptionGroup();
  files.addOption(new Option("f", "file", true,
    "File to scan. Pass full-path; e.g. hdfs://a:9000/hbase/hbase:meta/12/34"));
  files.addOption(new Option("r", "region", true,
    "Region to scan. Pass region name; e.g. 'hbase:meta,,1'"));
  options.addOptionGroup(files);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:23,代码来源:HFilePrettyPrinter.java

示例5: getCommandLineOptions

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
private static Options getCommandLineOptions() {
    // create the Options
    final Options options = new Options();

    final OptionGroup startup = new OptionGroup();
    final Option port = Option.builder("p")
            .longOpt("port")
            .desc("the port that the server will listen on.")
            .type(Integer.class)
            .numberOfArgs(1)
            .build();
    startup.addOption(port);
    options.addOptionGroup(startup);
    options.addOption("h", "help", false, "print these usage instructions and exit.");
    options.addOption("?", "help", false, "print these usage instructions and exit.");
    options.addOption("v", "version", false, "print product version and exit.");

    return options;
}
 
开发者ID:CloudRacer,项目名称:MockTCPServer,代码行数:20,代码来源:MockTCPServer.java

示例6: appendOptionGroup

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
/**
 * Appends the usage clause for an OptionGroup to a StringBuilder. The clause
 * is wrapped in square brackets if the group is not required. The display of
 * the options is handled by appendOption
 * 
 * @param buff
 *          the StringBuilder to append to
 * @param group
 *          the group to append
 * @see #appendOption(StringBuffer,Option,boolean)
 */
protected void appendOptionGroup(final StringBuilder buff,
    final OptionGroup group) {
  if (!group.isRequired()) {
    buff.append('[');
  }

  ArrayList<Object> optList = new ArrayList<Object>(group.getOptions());
  Collections.sort(optList, getOptionComparator());
  // for each option in the OptionGroup
  for (Iterator<?> i = optList.iterator(); i.hasNext();) {
    // whether the option is required or not is handled at group level
    appendOption(buff, (Option)i.next(), true);

    if (i.hasNext()) {
      buff.append(" | ");
    }
  }

  if (!group.isRequired()) {
    buff.append(']');
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:34,代码来源:GfxdHelpFormatter.java

示例7: createCLIOptions

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
/**
 * Creates the options needed by command line interface
 * 
 * @return the options this CLI can handle
 */
public static Options createCLIOptions() {
    options = new Options();
    typeGroup = new OptionGroup();
    Option msgTypeOpt = new Option("t", "message_type", true, "message type");
    typeGroup.addOption(msgTypeOpt);        
    options.addOptionGroup(typeGroup);
           
    options.addOption("h", "help", false, "show help.");
    options.addOption("r", "response_file", true, "file to store the response in, optional");
    options.addOption("d", "debug", false, "enable debug traces");
    options.addOption("mp", "messaging_protocol", true,
            "name of messaging protocol to be used, e.g. eiffel3, semantics");
    contentGroup = new OptionGroup();
    contentGroup.addOption(new Option("f", "content_file", true, "message content file"));
    contentGroup.addOption(new Option("json", "json_content", true, "json content"));              
    options.addOptionGroup(contentGroup);

    options.addOption("v", "list_versions", false, "lists the versions of generate and all loaded protocols");
    return options;
}
 
开发者ID:Ericsson,项目名称:eiffel-remrem-generate,代码行数:26,代码来源:CLIOptions.java

示例8: checkRequiredOptions

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
public static void checkRequiredOptions() throws MissingOptionException {
	OptionGroup[] groups = {typeGroup, contentGroup};
	for(OptionGroup group : groups) {
		ArrayList<Option> groupOptions = new ArrayList<Option>(group.getOptions());
		boolean groupIsGiven = false;
		for (Option option : groupOptions){
			if (commandLine.hasOption(option.getOpt())) {
				groupIsGiven = true;
				break;
			}
		}
		if (!groupIsGiven){
			throw new MissingOptionException(groupOptions);
		}
	}
}
 
开发者ID:Ericsson,项目名称:eiffel-remrem-generate,代码行数:17,代码来源:CLIOptions.java

示例9: getOptions

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
private static Options getOptions() {
  Options options = new Options();
  options.addOption("b", "bind", true,
      "Address to bind the Thrift server to. Not supported by the Nonblocking and HsHa server [default: 0.0.0.0]");
  options.addOption("p", "port", true, "Port to bind to [default: " + DEFAULT_LISTEN_PORT + "]");
  options.addOption("f", "framed", false, "Use framed transport");
  options.addOption("c", "compact", false, "Use the compact protocol");
  options.addOption("h", "help", false, "Print help information");
  options.addOption(null, "infoport", true, "Port for web UI");

  OptionGroup servers = new OptionGroup();
  servers.addOption(
      new Option("nonblocking", false, "Use the TNonblockingServer. This implies the framed transport."));
  servers.addOption(new Option("hsha", false, "Use the THsHaServer. This implies the framed transport."));
  servers.addOption(new Option("threadpool", false, "Use the TThreadPoolServer. This is the default."));
  options.addOptionGroup(servers);
  return options;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:19,代码来源:ThriftServer.java

示例10: parseDefaultCommandLineArguments

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
/**
 * Populates the default command line arguments that are common to all analyses.
 * 
 * @param options The command line options object that should be modified.
 */
private void parseDefaultCommandLineArguments(Options options) {
  OptionGroup modelGroup = new OptionGroup();
  modelGroup.addOption(Option.builder("model").desc("Path to the model directory.").hasArg()
      .argName("model directory").build());
  modelGroup.addOption(Option.builder("cmodel").desc("Path to the compiled model.").hasArg()
      .argName("compiled model").build());
  modelGroup.setRequired(false);

  options.addOptionGroup(modelGroup);

  options.addOption(Option.builder("cp").desc("The classpath for the analysis.").hasArg()
      .argName("classpath").required().longOpt("classpath").build());
  options.addOption(Option.builder("in").desc("The input code for the analysis.").hasArg()
      .argName("input").required().longOpt("input").build());
  options.addOption(Option.builder("out").desc("The output directory or file.").hasArg()
      .argName("output").longOpt("output").build());
  options.addOption(Option.builder("traversemodeled").desc("Propagate through modeled classes.")
      .hasArg(false).build());
  options.addOption("modeledtypesonly", false, "Only infer modeled types.");
  options.addOption(Option.builder("threadcount")
      .desc("The maximum number of threads that should be used.").hasArg()
      .argName("thread count").type(Number.class).build());
}
 
开发者ID:serval-snt-uni-lu,项目名称:DroidRA,代码行数:29,代码来源:CommandLineParser.java

示例11: getOptions

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
private static Options getOptions() {
  Options options = new Options();
  options.addOption("b", "bind", true,
      "Address to bind the Thrift server to. [default: 0.0.0.0]");
  options.addOption("p", "port", true, "Port to bind to [default: " + DEFAULT_LISTEN_PORT + "]");
  options.addOption("f", "framed", false, "Use framed transport");
  options.addOption("c", "compact", false, "Use the compact protocol");
  options.addOption("h", "help", false, "Print help information");
  options.addOption(null, "infoport", true, "Port for web UI");

  OptionGroup servers = new OptionGroup();
  servers.addOption(
      new Option("nonblocking", false, "Use the TNonblockingServer. This implies the framed transport."));
  servers.addOption(new Option("hsha", false, "Use the THsHaServer. This implies the framed transport."));
  servers.addOption(new Option("threadpool", false, "Use the TThreadPoolServer. This is the default."));
  options.addOptionGroup(servers);
  return options;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:19,代码来源:ThriftServer.java

示例12: createOptions

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
private static Options createOptions()
{

	final Options options = new Options();

	final OptionGroup group = new OptionGroup();
	group.addOption(new Option("h", "help", false, "Print this help message"));
	group.addOption(new Option("i", "input-file", true, "Input file path"));
	group.setRequired(true);

	options.addOptionGroup(group);

	options.addOption("b", "database-file", true, "File to read database from");
	options.addOption("e", "epoch-size", true, "Range for epoch size (default " + Parameters.DEFAULT_EPOCH_SIZE
			+ ")");
	options.addOption("t", "train-threshold", true, "Range for training threshold (default "
			+ Parameters.DEFAULT_TRAIN_THRESHOLD + ")");
	options.addOption("d", "detection-threshold", true, "Range for detection threshold (default "
			+ Parameters.DEFAULT_TEST_THRESHOLD + ")");
	options.addOption("v", "verbose", true, "Verbose level (default 0)");
	options.addOption("o", "output-file", true, "Output file path");

	return options;
}
 
开发者ID:amrabed,项目名称:rhids,代码行数:25,代码来源:RHIDS.java

示例13: CubeMetaExtractor

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
public CubeMetaExtractor() {
    super();
    OptionGroup realizationOrProject = new OptionGroup();
    realizationOrProject.addOption(OPTION_CUBE);
    realizationOrProject.addOption(OPTION_PROJECT);
    realizationOrProject.addOption(OPTION_HYBRID);
    realizationOrProject.addOption(OPTION_All_PROJECT);
    realizationOrProject.setRequired(true);

    options.addOptionGroup(realizationOrProject);
    options.addOption(OPTION_INCLUDE_SEGMENTS);
    options.addOption(OPTION_INCLUDE_JOB);
    options.addOption(OPTION_INCLUDE_SEGMENT_DETAILS);
    options.addOption(OPTION_INCLUDE_ONLY_JOB_OUTPUT);
    options.addOption(OPTION_STORAGE_TYPE);
    options.addOption(OPTION_ENGINE_TYPE);

}
 
开发者ID:apache,项目名称:kylin,代码行数:19,代码来源:CubeMetaExtractor.java

示例14: buildPa11yOptions

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
public static Options buildPa11yOptions() {
    Options options = new Options();

    OptionGroup mutuallyExclusiveOptions = new OptionGroup();
    mutuallyExclusiveOptions.addOption(getCreateTaskOption());
    mutuallyExclusiveOptions.addOption(getListTasksOption());
    mutuallyExclusiveOptions.addOption(getRunOption());
    mutuallyExclusiveOptions.addOption(getRetrieveTaskOption());
    mutuallyExclusiveOptions.addOption(getDeleteTaskOption());

    options.addOptionGroup(mutuallyExclusiveOptions);
    options.addOption(getNameOption());
    options.addOption(getUrlOption());
    options.addOption(getStandardOption());
    options.addOption(getLastResultOption());
    options.addOption(getTaskIdOption());

    return options;
}
 
开发者ID:timtroup,项目名称:pa11y-java-client,代码行数:20,代码来源:OptionsBuilder.java

示例15: testBuildPa11yOptions

import org.apache.commons.cli.OptionGroup; //导入依赖的package包/类
@Test
public void testBuildPa11yOptions() throws Exception {
    Options options = OptionsBuilder.buildPa11yOptions();

    assertEquals(10, options.getOptions().size());

    assertPa11yOptions(options);

    OptionGroup optionGroup = options.getOptionGroup(options.getOption("c"));
    Collection<String> optionGroupNames = optionGroup.getNames();
    assertTrue(optionGroupNames.contains("c"));
    assertTrue(optionGroupNames.contains("l"));
    assertTrue(optionGroupNames.contains("r"));
    assertTrue(optionGroupNames.contains("g"));
    assertTrue(optionGroupNames.contains("d"));
}
 
开发者ID:timtroup,项目名称:pa11y-java-client,代码行数:17,代码来源:OptionsBuilderTest.java


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