本文整理汇总了Java中org.apache.commons.cli.OptionGroup.setRequired方法的典型用法代码示例。如果您正苦于以下问题:Java OptionGroup.setRequired方法的具体用法?Java OptionGroup.setRequired怎么用?Java OptionGroup.setRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.cli.OptionGroup
的用法示例。
在下文中一共展示了OptionGroup.setRequired方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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)");
}
示例2: 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());
}
示例3: 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;
}
示例4: 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);
}
示例5: createCommandLineOptions
import org.apache.commons.cli.OptionGroup; //导入方法依赖的package包/类
private Options createCommandLineOptions() {
Options options = new Options();
OptionGroup actionGroup = new OptionGroup();
actionGroup.addOption(new Option("h", HELP_OPT, false, "Shows the help message."));
actionGroup.addOption(new Option("d", DETAILS_OPT, false, "Show details about a job/task."));
actionGroup.addOption(new Option("l", LIST_OPT, false, "List jobs/tasks."));
actionGroup.addOption(new Option("p", PROPS_OPT, false, "Fetch properties with the query."));
actionGroup.setRequired(true);
options.addOptionGroup(actionGroup);
OptionGroup idGroup = new OptionGroup();
idGroup.addOption(new Option("j", NAME_OPT, true, "Find job(s) matching given job name."));
idGroup.addOption(new Option("i", ID_OPT, true, "Find the job/task with the given id."));
options.addOptionGroup(idGroup);
options.addOption("n", true, "Limit the number of results returned. (default:" + DEFAULT_RESULTS_LIMIT + ")");
options.addOption("r", RECENT_OPT, false, "List the most recent jobs (instead of a list of unique jobs)");
return options;
}
示例6: populate
import org.apache.commons.cli.OptionGroup; //导入方法依赖的package包/类
@Override
void populate(Options options) {
OptionGroup verbosityGroup = new OptionGroup();
verbosityGroup.setRequired(false);
verbosityGroup.addOption(new OptionBuilder("s", "silent").required(false).build());
verbosityGroup.addOption(new OptionBuilder("v", "verbose").required(false).build());
options.addOptionGroup(verbosityGroup);
}
示例7: buildOptionsGroup
import org.apache.commons.cli.OptionGroup; //导入方法依赖的package包/类
private void buildOptionsGroup(Options options) {
OptionGroup firstGroup = new OptionGroup();
OptionGroup secondGroup = new OptionGroup();
firstGroup.setRequired(true);
secondGroup.setRequired(true);
firstGroup.addOption(Option.builder("d")
.longOpt("db")
.hasArg()
.argName("table-name")
.build());
firstGroup.addOption(Option.builder("f")
.longOpt("flat-file")
.hasArg()
.argName("input.csv")
.build());
options.addOptionGroup(firstGroup);
secondGroup.addOption(Option.builder("x")
.hasArg()
.argName("arg1")
.build());
secondGroup.addOption(Option.builder("s")
.build());
secondGroup.addOption(Option.builder("p")
.hasArg()
.argName("arg1")
.build());
options.addOptionGroup(secondGroup);
}
示例8: createMarketDataSourceOptionGroup
import org.apache.commons.cli.OptionGroup; //导入方法依赖的package包/类
private OptionGroup createMarketDataSourceOptionGroup() {
final OptionGroup optionGroup = new OptionGroup();
optionGroup.addOption(createHistoricalOption());
optionGroup.addOption(s_mktDataSourceCli.getOption());
optionGroup.setRequired(true);
return optionGroup;
}
示例9: createViewOptionGroup
import org.apache.commons.cli.OptionGroup; //导入方法依赖的package包/类
private static OptionGroup createViewOptionGroup() {
final OptionGroup optionGroup = new OptionGroup();
optionGroup.addOption(createViewNameOption());
optionGroup.addOption(createViewProcessIdOption());
optionGroup.setRequired(true);
return optionGroup;
}
示例10: getOptions
import org.apache.commons.cli.OptionGroup; //导入方法依赖的package包/类
@SuppressWarnings("static-access")
@Override
public Options getOptions() {
Options options = super.getOptions();
OptionGroup group = new OptionGroup();
group.setRequired(true);
group.addOption(OptionBuilder
.withLongOpt("problem")
.hasArg()
.withArgName("name")
.create('b'));
group.addOption(OptionBuilder
.withLongOpt("dimension")
.hasArg()
.withArgName("number")
.create('d'));
options.addOptionGroup(group);
options.addOption(OptionBuilder
.withLongOpt("output")
.hasArg()
.withArgName("file")
.create('o'));
return options;
}
示例11: getOptions
import org.apache.commons.cli.OptionGroup; //导入方法依赖的package包/类
@SuppressWarnings("static-access")
@Override
public Options getOptions() {
Options options = super.getOptions();
OptionGroup group = new OptionGroup();
group.setRequired(true);
group.addOption(OptionBuilder
.withLongOpt("problem")
.hasArg()
.withArgName("name")
.create('b'));
group.addOption(OptionBuilder
.withLongOpt("dimension")
.hasArg()
.withArgName("number")
.create('d'));
options.addOptionGroup(group);
options.addOption(OptionBuilder
.withLongOpt("output")
.hasArg()
.withArgName("file")
.isRequired()
.create('o'));
options.addOption(OptionBuilder
.withLongOpt("epsilon")
.hasArg()
.withArgName("e1,e2,...")
.create('e'));
return options;
}
示例12: getOptions
import org.apache.commons.cli.OptionGroup; //导入方法依赖的package包/类
@SuppressWarnings("static-access")
@Override
public Options getOptions() {
Options options = super.getOptions();
OptionGroup group = new OptionGroup();
group.setRequired(true);
group.addOption(OptionBuilder
.withLongOpt("problem")
.hasArg()
.withArgName("name")
.create('b'));
group.addOption(OptionBuilder
.withLongOpt("dimension")
.hasArg()
.withArgName("number")
.create('d'));
options.addOptionGroup(group);
options.addOption(OptionBuilder
.withLongOpt("epsilon")
.hasArg()
.withArgName("e1,e2,...")
.create('e'));
options.addOption(OptionBuilder
.withLongOpt("output")
.hasArg()
.withArgName("file")
.isRequired()
.create('o'));
options.addOption(OptionBuilder
.withLongOpt("resultFile")
.create('r'));
return options;
}
示例13: HBaseUsageExtractor
import org.apache.commons.cli.OptionGroup; //导入方法依赖的package包/类
public HBaseUsageExtractor() {
super();
packageType = "hbase";
OptionGroup realizationOrProject = new OptionGroup();
realizationOrProject.addOption(OPTION_CUBE);
realizationOrProject.addOption(OPTION_PROJECT);
realizationOrProject.setRequired(true);
options.addOptionGroup(realizationOrProject);
conf = HBaseConfiguration.create();
}
示例14: constructCommandLineOptions
import org.apache.commons.cli.OptionGroup; //导入方法依赖的package包/类
@SuppressWarnings("static-access")
static Options constructCommandLineOptions() {
Option helpOption =
OptionBuilder.withLongOpt(help).withDescription("Prints command-line options information")
.create();
Option zkSvrOption =
OptionBuilder.hasArgs(1).isRequired(true).withArgName("zookeeperAddress")
.withLongOpt(zkSvr).withDescription("Provide zookeeper-address").create();
Option verifyExternalViewOption =
OptionBuilder.hasArgs().isRequired(false).withArgName("clusterName node1 node2..")
.withLongOpt(verifyExternalView).withDescription("Verify external-view").create();
Option verifyLiveNodesOption =
OptionBuilder.hasArg().isRequired(false).withArgName("clusterName node1, node2..")
.withLongOpt(verifyLiveNodes).withDescription("Verify live-nodes").create();
Option readZNodeOption =
OptionBuilder.hasArgs(1).isRequired(false).withArgName("zkPath").withLongOpt(readZNode)
.withDescription("Read znode").create();
Option readLeaderOption =
OptionBuilder.hasArgs(1).isRequired(false).withArgName("clusterName")
.withLongOpt(readLeader).withDescription("Read cluster controller").create();
OptionGroup optGroup = new OptionGroup();
optGroup.setRequired(true);
optGroup.addOption(verifyExternalViewOption);
optGroup.addOption(verifyLiveNodesOption);
optGroup.addOption(readZNodeOption);
optGroup.addOption(readLeaderOption);
Options options = new Options();
options.addOption(helpOption);
options.addOption(zkSvrOption);
options.addOptionGroup(optGroup);
return options;
}
示例15: constructCommandLineOptions
import org.apache.commons.cli.OptionGroup; //导入方法依赖的package包/类
@SuppressWarnings("static-access")
private static Options constructCommandLineOptions() {
Option zkCfgOption =
OptionBuilder.hasArgs(1).isRequired(false).withLongOpt(zkCfg).withArgName("zoo.cfg")
.withDescription("provide zoo.cfg").create();
Option patternOption =
OptionBuilder.hasArgs().isRequired(true).withLongOpt(pattern)
.withArgName("grep-patterns...").withDescription("provide patterns (required)")
.create();
Option betweenOption =
OptionBuilder.hasArgs(2).isRequired(false).withLongOpt(between)
.withArgName("t1 t2 (timestamp in ms or yyMMdd_hhmmss_SSS)")
.withDescription("grep between t1 and t2").create();
Option byOption =
OptionBuilder.hasArgs(1).isRequired(false).withLongOpt(by)
.withArgName("t (timestamp in ms or yyMMdd_hhmmss_SSS)").withDescription("grep by t")
.create();
OptionGroup group = new OptionGroup();
group.setRequired(true);
group.addOption(betweenOption);
group.addOption(byOption);
Options options = new Options();
options.addOption(zkCfgOption);
options.addOption(patternOption);
options.addOptionGroup(group);
return options;
}