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


Java DefaultOptionBuilder类代码示例

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


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

示例1: buildOption

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
protected static Option buildOption(String name,
                                    String shortName,
                                    String description,
                                    boolean hasArg, int min, int max,
                                    boolean required,
                                    String defaultValue) {

  DefaultOptionBuilder optBuilder = new DefaultOptionBuilder().withLongName(name).withDescription(description)
      .withRequired(required);

  if (shortName != null) {
    optBuilder.withShortName(shortName);
  }

  if (hasArg) {
    ArgumentBuilder argBuilder = new ArgumentBuilder().withName(name).withMinimum(min).withMaximum(max);

    if (defaultValue != null) {
      argBuilder = argBuilder.withDefault(defaultValue);
    }

    optBuilder.withArgument(argBuilder.create());
  }

  return optBuilder.create();
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:27,代码来源:AbstractJob.java

示例2: main

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
  DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
  ArgumentBuilder abuilder = new ArgumentBuilder();
  GroupBuilder gbuilder = new GroupBuilder();
  
  Option inputOpt = DefaultOptionCreator.inputOption().withRequired(false).create();
  Option outputOpt = DefaultOptionCreator.outputOption().withRequired(false).create();
  Option vectorOpt = obuilder.withLongName("vector").withRequired(false).withArgument(
    abuilder.withName("v").withMinimum(1).withMaximum(1).create()).withDescription(
    "The vector implementation to use.").withShortName("v").create();
  
  Option helpOpt = DefaultOptionCreator.helpOption();
  
  Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(outputOpt).withOption(
    vectorOpt).withOption(helpOpt).create();
	 
  try {
    Parser parser = new Parser();
    parser.setGroup(group);
    CommandLine cmdLine = parser.parse(args);
    if (cmdLine.hasOption(helpOpt)) {
      CommandLineUtil.printHelp(group);
      return;
    }
    
    Path input = new Path(cmdLine.getValue(inputOpt, "testdata").toString());
    Path output = new Path(cmdLine.getValue(outputOpt, "output").toString());
    String vectorClassName = cmdLine.getValue(vectorOpt,
       "org.apache.mahout.math.RandomAccessSparseVector").toString();
    //runJob(input, output, vectorClassName);
  } catch (OptionException e) {
    InputDriver.log.error("Exception parsing command line: ", e);
    CommandLineUtil.printHelp(group);
  }
}
 
开发者ID:PacktPublishing,项目名称:HBase-High-Performance-Cookbook,代码行数:36,代码来源:InputDriver.java

示例3: inputOption

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * Returns a default command line option for input directory specification.
 * Used by all clustering jobs plus others
 */
public static DefaultOptionBuilder inputOption() {
  return new DefaultOptionBuilder()
      .withLongName(INPUT_OPTION)
      .withRequired(false)
      .withShortName("i")
      .withArgument(
          new ArgumentBuilder().withName(INPUT_OPTION).withMinimum(1)
              .withMaximum(1).create())
      .withDescription("Path to job input directory.");
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:15,代码来源:DefaultOptionCreator.java

示例4: clustersInOption

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * Returns a default command line option for clusters input directory
 * specification. Used by FuzzyKmeans, Kmeans
 */
public static DefaultOptionBuilder clustersInOption() {
  return new DefaultOptionBuilder()
      .withLongName(CLUSTERS_IN_OPTION)
      .withRequired(true)
      .withArgument(
          new ArgumentBuilder().withName(CLUSTERS_IN_OPTION).withMinimum(1)
              .withMaximum(1).create())
      .withDescription(
          "The path to the initial clusters directory. Must be a SequenceFile of some type of Cluster")
      .withShortName("c");
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:16,代码来源:DefaultOptionCreator.java

示例5: outputOption

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * Returns a default command line option for output directory specification.
 * Used by all clustering jobs plus others
 */
public static DefaultOptionBuilder outputOption() {
  return new DefaultOptionBuilder()
      .withLongName(OUTPUT_OPTION)
      .withRequired(false)
      .withShortName("o")
      .withArgument(
          new ArgumentBuilder().withName(OUTPUT_OPTION).withMinimum(1)
              .withMaximum(1).create())
      .withDescription("The directory pathname for output.");
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:15,代码来源:DefaultOptionCreator.java

示例6: overwriteOption

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * Returns a default command line option for output directory overwriting.
 * Used by all clustering jobs
 */
public static DefaultOptionBuilder overwriteOption() {
  return new DefaultOptionBuilder()
      .withLongName(OVERWRITE_OPTION)
      .withRequired(false)
      .withDescription(
          "If present, overwrite the output directory before running job")
      .withShortName("ow");
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:13,代码来源:DefaultOptionCreator.java

示例7: distanceMeasureOption

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * Returns a default command line option for specification of distance measure
 * class to use. Used by Canopy, FuzzyKmeans, Kmeans, MeanShift
 */
public static DefaultOptionBuilder distanceMeasureOption() {
  return new DefaultOptionBuilder()
      .withLongName(DISTANCE_MEASURE_OPTION)
      .withRequired(false)
      .withShortName("dm")
      .withArgument(
          new ArgumentBuilder().withName(DISTANCE_MEASURE_OPTION)
              .withDefault(SquaredEuclideanDistanceMeasure.class.getName())
              .withMinimum(1).withMaximum(1).create())
      .withDescription(
          "The classname of the DistanceMeasure. Default is SquaredEuclidean");
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:17,代码来源:DefaultOptionCreator.java

示例8: methodOption

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * Returns a default command line option for specification of sequential or
 * parallel operation. Used by Canopy, FuzzyKmeans, Kmeans, MeanShift,
 * Dirichlet
 */
public static DefaultOptionBuilder methodOption() {
  return new DefaultOptionBuilder()
      .withLongName(METHOD_OPTION)
      .withRequired(false)
      .withShortName("xm")
      .withArgument(
          new ArgumentBuilder().withName(METHOD_OPTION)
              .withDefault(MAPREDUCE_METHOD).withMinimum(1).withMaximum(1)
              .create())
      .withDescription(
          "The execution method to use: sequential or mapreduce. Default is mapreduce");
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:18,代码来源:DefaultOptionCreator.java

示例9: t1Option

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * Returns a default command line option for specification of T1. Used by
 * Canopy, MeanShift
 */
public static DefaultOptionBuilder t1Option() {
  return new DefaultOptionBuilder()
      .withLongName(T1_OPTION)
      .withRequired(true)
      .withArgument(
          new ArgumentBuilder().withName(T1_OPTION).withMinimum(1)
              .withMaximum(1).create()).withDescription("T1 threshold value")
      .withShortName(T1_OPTION);
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:14,代码来源:DefaultOptionCreator.java

示例10: t2Option

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * Returns a default command line option for specification of T2. Used by
 * Canopy, MeanShift
 */
public static DefaultOptionBuilder t2Option() {
  return new DefaultOptionBuilder()
      .withLongName(T2_OPTION)
      .withRequired(true)
      .withArgument(
          new ArgumentBuilder().withName(T2_OPTION).withMinimum(1)
              .withMaximum(1).create()).withDescription("T2 threshold value")
      .withShortName(T2_OPTION);
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:14,代码来源:DefaultOptionCreator.java

示例11: t3Option

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * Returns a default command line option for specification of T3 (Reducer T1).
 * Used by Canopy
 */
public static DefaultOptionBuilder t3Option() {
  return new DefaultOptionBuilder()
      .withLongName(T3_OPTION)
      .withRequired(false)
      .withArgument(
          new ArgumentBuilder().withName(T3_OPTION).withMinimum(1)
              .withMaximum(1).create())
      .withDescription("T3 (Reducer T1) threshold value")
      .withShortName(T3_OPTION);
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:15,代码来源:DefaultOptionCreator.java

示例12: t4Option

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * Returns a default command line option for specification of T4 (Reducer T2).
 * Used by Canopy
 */
public static DefaultOptionBuilder t4Option() {
  return new DefaultOptionBuilder()
      .withLongName(T4_OPTION)
      .withRequired(false)
      .withArgument(
          new ArgumentBuilder().withName(T4_OPTION).withMinimum(1)
              .withMaximum(1).create())
      .withDescription("T4 (Reducer T2) threshold value")
      .withShortName(T4_OPTION);
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:15,代码来源:DefaultOptionCreator.java

示例13: clusterFilterOption

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * @return a DefaultOptionBuilder for the clusterFilter option
 */
public static DefaultOptionBuilder clusterFilterOption() {
    return new DefaultOptionBuilder()
        .withLongName(CLUSTER_FILTER_OPTION)
        .withShortName("cf")
        .withRequired(false)
        .withArgument(
            new ArgumentBuilder().withName(CLUSTER_FILTER_OPTION).withMinimum(1)
                .withMaximum(1).create())
        .withDescription("Cluster filter suppresses small canopies from mapper")
        .withShortName(CLUSTER_FILTER_OPTION);
  }
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:15,代码来源:DefaultOptionCreator.java

示例14: maxIterationsOption

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * Returns a default command line option for specification of max number of
 * iterations. Used by Dirichlet, FuzzyKmeans, Kmeans, LDA
 */
public static DefaultOptionBuilder maxIterationsOption() {
  // default value used by LDA which overrides withRequired(false)
  return new DefaultOptionBuilder()
      .withLongName(MAX_ITERATIONS_OPTION)
      .withRequired(true)
      .withShortName("x")
      .withArgument(
          new ArgumentBuilder().withName(MAX_ITERATIONS_OPTION)
              .withDefault("-1").withMinimum(1).withMaximum(1).create())
      .withDescription("The maximum number of iterations.");
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:16,代码来源:DefaultOptionCreator.java

示例15: numClustersOption

import org.apache.commons.cli2.builder.DefaultOptionBuilder; //导入依赖的package包/类
/**
 * Returns a default command line option for specification of numbers of
 * clusters to create. Used by Dirichlet, FuzzyKmeans, Kmeans
 */
public static DefaultOptionBuilder numClustersOption() {
  return new DefaultOptionBuilder()
      .withLongName(NUM_CLUSTERS_OPTION)
      .withRequired(false)
      .withArgument(
          new ArgumentBuilder().withName("k").withMinimum(1).withMaximum(1)
              .create()).withDescription("The number of clusters to create")
      .withShortName("k");
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:14,代码来源:DefaultOptionCreator.java


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