Package com.martiansoftware.jsap

Examples of com.martiansoftware.jsap.FlaggedOption


                                         final ICommandLineOptions option,
                                         final boolean required ) throws JSAPException
   {
      final String optionName = option.toString();

      jsap.registerParameter( new FlaggedOption( optionName ).setStringParser( JSAP.STRING_PARSER )
                                                             .setRequired( required )
                                                             .setShortFlag( optionName.charAt( 0 ) )
                                                             .setLongFlag( optionName ) );
   }
View Full Code Here


   * @throws SAXException
   */
  public static void main(String[] args) throws JSAPException {
    SimpleJSAP jsap = new SimpleJSAP("InfinispanFluDemo", "Parse the Influenze data and store in cache ",
        new Parameter[] {
            new FlaggedOption("InfinispanCfg", JSAP.STRING_PARSER, null, JSAP.NOT_REQUIRED, 'c',
                JSAP.NO_LONGFLAG, "Location of Infinispan config file"),
            new FlaggedOption("ifile", JSAP.STRING_PARSER, null, JSAP.NOT_REQUIRED, 'i', JSAP.NO_LONGFLAG,
                "Location of influenza.dat"),
            new FlaggedOption("pfile", JSAP.STRING_PARSER, null, JSAP.NOT_REQUIRED, 'p', JSAP.NO_LONGFLAG,
                "location of influenza_aa.dat."),
            new FlaggedOption("count", JSAP.INTEGER_PARSER, "-1", JSAP.NOT_REQUIRED, 'l', JSAP.NO_LONGFLAG,
                "Number of records to load from file"),
            new Switch("query", 'q', "true", "Enable query cli"),
            new Switch("randomquery", 'r', "randomquery",
                "Randomly query the influenza to test that the cache is fully populated"),
            new FlaggedOption("nfile", JSAP.STRING_PARSER, null, JSAP.NOT_REQUIRED, 'n', JSAP.NO_LONGFLAG,
                "Location of influenza_na.dat") });
    if (jsap.messagePrinted())
      System.exit(1);

    JSAPResult config = jsap.parse(args);
View Full Code Here

      args = new String[0];
    }

    // Initialize the argument parser
    SimpleJSAP jsap = new SimpleJSAP("java -jar Mockey.jar", "Starts a Jetty server running Mockey");
    jsap.registerParameter(new FlaggedOption(ARG_PORT, JSAP.INTEGER_PARSER, "8080", JSAP.NOT_REQUIRED, 'p',
        ARG_PORT, "port to run Jetty on"));
    jsap.registerParameter(new FlaggedOption(BSC.FILE, JSAP.STRING_PARSER,
        MockeyXmlFileManager.MOCK_SERVICE_DEFINITION, JSAP.NOT_REQUIRED, 'f', BSC.FILE,
        "Relative path to a mockey-definitions file to initialize Mockey, relative to where you're starting Mockey"));

    jsap.registerParameter(new FlaggedOption(BSC.URL, JSAP.STRING_PARSER, "", JSAP.NOT_REQUIRED, 'u', BSC.URL,
        "URL to a mockey-definitions file to initialize Mockey"));

    jsap.registerParameter(new FlaggedOption(BSC.TRANSIENT, JSAP.BOOLEAN_PARSER, "true", JSAP.NOT_REQUIRED, 't',
        BSC.TRANSIENT, "Read only mode if set to true, no updates are made to the file system."));

    jsap.registerParameter(new FlaggedOption(
        BSC.DEFINITION_LOCATION,
        JSAP.STRING_PARSER,
        "",
        JSAP.NOT_REQUIRED,
        'l',
        BSC.DEFINITION_LOCATION,
        "Absolute or relative path/location for Mockey to save it's definitions and configuration. By default, relative to where Mockey is started. "));

    jsap.registerParameter(new FlaggedOption(BSC.FILTERTAG, JSAP.STRING_PARSER, "", JSAP.NOT_REQUIRED, 'F',
        BSC.FILTERTAG,
        "Filter tag for services and scenarios, useful for 'only use information with this tag'. "));

    jsap.registerParameter(new FlaggedOption(BSC.HEADLESS, JSAP.BOOLEAN_PARSER, "false", JSAP.NOT_REQUIRED, 'H',
        BSC.HEADLESS,
        "Headless flag. Default is 'false'. Set to 'true' if you do not want Mockey to spawn a browser thread upon startup."));

    jsap.registerParameter(new Switch(BSC.VERSION, 'v', BSC.VERSION,
        "Prints out Mockey's version (semantic versioning http://semver.org/)"));
View Full Code Here

    // build the jsap object
    SimpleJSAP jsap = new SimpleJSAP(
              "spectralHMM",
              "Analyze temporal data using a spectral HMM method.",
              new Parameter[] {
          new FlaggedOption( "inputFile", myFileParser, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'f', "inputFile", "Specify an input file. See documentation for formatting." ),
          new Switch ("mutSelBalance", 'j', "mutSelBalance", "Set the initial condition to be selection-drift balance."),
          new Switch ("mutDriftBalance", 'd', "mutDriftBalance", "Set the initial condition to be mutation-drift balance."),
          new FlaggedOption( "initFrequency", JSAP.BIGDECIMAL_PARSER, "-0.5", JSAP.NOT_REQUIRED, 'i', "initFrequency", "Set the initial frequency." ),
          new FlaggedOption( "initTime", JSAP.BIGDECIMAL_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 't', "initTime", "The initial time. If not given, the initial time is expected to be in the file with each dataset. Also, this only works with multiplexing." ),
          new FlaggedOption( "mutToBenef", JSAP.BIGDECIMAL_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'a', "mutToBenef", "The mutation rate from the wild type allele to the selected allele." ),
          new FlaggedOption( "mutFromBenef", JSAP.BIGDECIMAL_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'b', "mutFromBenef", "The mutation rate from the selected allele to the wild-type allele." ),
          new FlaggedOption( "selection", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 's', "selection", "Selection coefficient s (can be a range: [start:step:stop])." ),
          new FlaggedOption( "dominance", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'h', "dominance", "Dominance parameter h (can be a range: [start:step:stop])." ),
          new FlaggedOption( "hetF", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'w', "hetF", "Fitness of the heterozygote (can be a range: [start:step:stop])." ),
          new FlaggedOption( "homF", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'v', "homF", "Fitness of the homozygote (can be a range: [start:step:stop])." ),
          new FlaggedOption( "effPopSize", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'e', "effPopSize", "The effective population size (diploid)." ),
          new FlaggedOption( "yearsPerGen", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'y', "yearsPerGen", "Specify how many years a generation takes." ),
          new FlaggedOption( "matrixCutoff", JSAP.INTEGER_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'c', "matrixCutoff", "The cutoff for the matrix whose eigenvectors yield the coefficients for the eigenfunctions." ),
          new FlaggedOption( "maxM", JSAP.INTEGER_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'm', "maxM", "Specify how many summands to use in the infinite sum for each eigenfunction." ),
          new FlaggedOption( "maxN", JSAP.INTEGER_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'n', "maxN", "Specify how many eigenfunctions/-values to use in the computations." ),
          new FlaggedOption( "precision", JSAP.INTEGER_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'p', "precision", "Specify a precision to be used for the computations. This gives the number of significant digits used." ),
          new Switch ("ignoreBinomials", 'z', "ignoreBinomials", "If set, the likelihood is calculated without the binomial coefficients required to make it a probability."),
          new Switch ("multiplex", JSAP.NO_SHORTFLAG, "multiplex", "Analyze each of the multiple datasests given in the input file using all the selection parameters specified."),
          new Switch ("condOnLastSegregating", JSAP.NO_SHORTFLAG, "condOnLastSegregating", "When set, condition on the last sample being segregating."),
              }
          );
View Full Code Here

   @Override
   protected SimpleJSAP buildCommandLineOptions() throws JSAPException {
      return new SimpleJSAP("PiApproximationDemo",
                            "Approximate Pi using Infinispan DistributedExecutorService ", new Parameter[]{
                  new FlaggedOption("configFile", JSAP.STRING_PARSER, "config-samples/distributed-udp.xml",
                                    JSAP.NOT_REQUIRED, 'c', "configFile",
                                    "Infinispan config file"),
                  new FlaggedOption("nodeType", JSAP.STRING_PARSER, "slave", JSAP.REQUIRED,
                                    't', "nodeType", "Node type as either master or slave"),
                  new FlaggedOption("numPoints", JSAP.INTEGER_PARSER,
                                    String.valueOf(DEFAULT_NUM_POINTS), JSAP.REQUIRED, 'n',
                                    "numPoints", "Total number of darts to shoot"),
            });
   }
View Full Code Here

   protected SimpleJSAP buildCommandLineOptions() throws JSAPException {
      return new SimpleJSAP(
            "WordCountDemo",
            "Count words in Infinispan cache usin MapReduceTask ",
            new Parameter[]{
                  new FlaggedOption("configFile", JSAP.STRING_PARSER, "config-samples/distributed-udp.xml",
                                    JSAP.NOT_REQUIRED, 'c', "configFile",
                                    "Infinispan transport config file"),
                  new FlaggedOption("nodeType", JSAP.STRING_PARSER, "slave", JSAP.REQUIRED,
                                    't', "nodeType", "Node type as either master or slave"),
                  new FlaggedOption("textFile", JSAP.STRING_PARSER, null, JSAP.NOT_REQUIRED,
                                    'f', "textFile", "Input text file to distribute onto grid"),
                  new FlaggedOption("mostPopularWords", JSAP.INTEGER_PARSER, "15",
                                    JSAP.NOT_REQUIRED, 'n', "mostPopularWords", "Number of most popular words to find")});
   }
View Full Code Here

    private static JSAP initArgsParser() throws JSAPException
    {
  JSAP jsap = new JSAP();

  FlaggedOption opt1 = new FlaggedOption(Config.DOCUMENT_PATH.toString()).setStringParser(FileStringParser.getParser())
                         .setRequired(true)
                         .setShortFlag('p')
                         .setLongFlag("peer");

  opt1.setHelp("The path to the peer summaries.");
  jsap.registerParameter(opt1);

  FlaggedOption opt2 = new FlaggedOption(Config.GOLD_STANDARD_PATH.toString()).setStringParser(FileStringParser.getParser())
                        .setRequired(true)
                        .setShortFlag('g')
                        .setLongFlag("goldstandard");

  opt2.setHelp("The path to the gold standard summaries.");
  jsap.registerParameter(opt2);

  FlaggedOption opt3 = new FlaggedOption(Config.GRAM_SIZE.toString()).setStringParser(JSAP.INTEGER_PARSER)
                     .setRequired(true)
                     .setShortFlag('n')
                     .setLongFlag(JSAP.NO_LONGFLAG);

  opt3.setHelp("The size of the gram to use.");
  jsap.registerParameter(opt3);

  FlaggedOption opt4 = new FlaggedOption(Config.WORD_LIMIT.toString()).setStringParser(JSAP.INTEGER_PARSER)
                      .setRequired(false)
                      .setDefault(Integer.MAX_VALUE + "")
                      .setShortFlag('l')
                      .setLongFlag(JSAP.NO_LONGFLAG);

  opt4.setHelp("The number of words to use from the texts.");
  jsap.registerParameter(opt4);

  FlaggedOption opt5 = new FlaggedOption(Config.BYTE_LIMIT.toString()).setStringParser(JSAP.INTEGER_PARSER)
                      .setRequired(false)
                      .setDefault(Integer.MAX_VALUE + "")
                      .setShortFlag('b')
                      .setLongFlag(JSAP.NO_LONGFLAG);

  opt5.setHelp("The number of bytes to use from each text.");
  jsap.registerParameter(opt5);

  FlaggedOption opt6 = new FlaggedOption(Config.ALPHA.toString()).setStringParser(JSAP.DOUBLE_PARSER)
                       .setRequired(false)
                       .setDefault("0.5")
                       .setShortFlag('a')
                       .setLongFlag(JSAP.NO_LONGFLAG);

  opt6.setHelp("The alpha value used to calculate F metric");
  jsap.registerParameter(opt6);

  FlaggedOption opt7 = new FlaggedOption(Config.METHOD.toString()).setStringParser(JSAP.CHARACTER_PARSER)
                  .setRequired(false)
                  .setDefault("A")
                  .setShortFlag('m')
                  .setLongFlag(JSAP.NO_LONGFLAG);

  opt7.setHelp("The method used to calculate the metrics. Use 'A' for average, use 'B' for best.");
  jsap.registerParameter(opt7);

  Switch opt8 = new Switch(Config.VERBOSE.toString()).setDefault("false")
                .setShortFlag('v')
                .setLongFlag(JSAP.NO_LONGFLAG);
View Full Code Here

    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Generic Parameters">
    public void registerParameter(String parameterName, String defaultValue, char shortFlag, StringParser s) throws JSAPException {
        FlaggedOption flag = new FlaggedOption(parameterName)
                .setStringParser(s)
                .setDefault(defaultValue)
                .setShortFlag(shortFlag)
                .setLongFlag(parameterName);
       
View Full Code Here

       
        registerParameter(flag);
    }

    public void registerParameter(String parameterName, String defaultValue, StringParser s) throws JSAPException {
        FlaggedOption flag = new FlaggedOption(parameterName)
                .setStringParser(s)
                .setDefault(defaultValue)
                .setLongFlag(parameterName);

        registerParameter(flag);
View Full Code Here

   
    UnflaggedOption opt2a = new UnflaggedOption("outLDAIndex").setStringParser(
        JSAP.STRING_PARSER).setRequired(true);
    opt2a.setHelp("The output directory for the resultant LDA index");

    FlaggedOption opt3 = new FlaggedOption("fileCodes")
        .setStringParser(JSAP.STRING_PARSER).setRequired(false)
        .setLongFlag("fileCodes");
    opt3.setHelp("A file containing a mapping between filenames and some key. "
        + "If specified, the query results will list the key instead of the filename.");

    Switch sw0 = new Switch("help").setDefault("false").setLongFlag("help");
    sw0.setHelp("Prints this message.");

    FlaggedOption opt4 = new FlaggedOption("ldaConfig")
        .setStringParser(JSAP.STRING_PARSER).setRequired(false)
        .setList(true).setListSeparator(',')
        .setAllowMultipleDeclarations(true).setLongFlag("ldaConfig");
    opt4.setHelp("Add an LDA configuration in pairs of \"K,dirName\". "
        + "E.g.: \"32,input/ldaOutput\" (without quotes). Can do this multiple times, one for each configuration.");

    jsap.registerParameter(sw0);
    jsap.registerParameter(opt1);
    jsap.registerParameter(opt2);
View Full Code Here

TOP

Related Classes of com.martiansoftware.jsap.FlaggedOption

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.