예제 #1
0
 @Override
 protected void configureArgsParser(JSAP argsParser) throws JSAPException {
   argsParser.registerParameter(
       new UnflaggedOption("dir")
           .setRequired(true)
           .setHelp("the directory from which to start looking for tests"));
   argsParser.registerParameter(
       new UnflaggedOption("testType")
           .setDefault("UTsAndATs")
           .setStringParser(EnumeratedStringParser.getParser("UTs;ATs;ITs;UTsAndATs;ALL;", true))
           .setHelp("(UTs|ATs|ITs|ALL)"));
   argsParser.registerParameter(
       new FlaggedOption("browsers")
           .setShortFlag('b')
           .setList(true)
           .setListSeparator(',')
           .setHelp("you can use ALL to specify that the tests should be run on all browsers"));
   argsParser.registerParameter(
       new Switch("report")
           .setLongFlag("report")
           .setDefault("false")
           .setHelp("if supplied, generate the HTML reports after running tests"));
   argsParser.registerParameter(
       new FlaggedOption("js-minifier")
           .setLongFlag("js-minifier")
           .setDefault("combined")
           .setHelp("set the minifier used for JS bundles"));
 }
예제 #2
0
  static {
    probeNameOptionF =
        new FlaggedOption(PROBENAME)
            .setStringParser(JSAP.STRING_PARSER)
            .setRequired(true)
            .setShortFlag('x')
            .setLongFlag(JSAP.NO_LONGFLAG)
            .setUsageName(PROBENAME);
    probeNameOptionF.setHelp("the name of the probe in the x-axis (required)");

    probeNameOptionUF =
        new UnflaggedOption(PROBENAME)
            .setStringParser(JSAP.STRING_PARSER)
            .setRequired(true)
            .setUsageName(PROBENAME);
    probeNameOptionUF.setHelp("the name of the probe (required)");

    valueOptionUF =
        new UnflaggedOption(VALUE)
            .setStringParser(JSAP.STRING_PARSER)
            .setRequired(false)
            .setUsageName(VALUE);

    optionsOptionF =
        new FlaggedOption(OPTIONS)
            .setStringParser(JSAP.STRING_PARSER)
            .setRequired(false)
            .setLongFlag(OPTIONS)
            .setUsageName(OPTIONS);

    currentTypeOptionF =
        new FlaggedOption(PROBE_TYPE)
            .setStringParser(
                EnumeratedStringParser.getParser(
                    StringUtilities.join(
                        ";",
                        new String[] {
                          VIRTPORT_TYPE.CURRENT_DYN.getTclOption(),
                          VIRTPORT_TYPE.CURRENT_LEAK.getTclOption(),
                          VIRTPORT_TYPE.CURRENT_TOT.getTclOption(),
                          VIRTPORT_TYPE.CURRENT_DYN_ALL.getTclOption(),
                          VIRTPORT_TYPE.CURRENT_LEAK_ALL.getTclOption(),
                          VIRTPORT_TYPE.CURRENT_TOT_ALL.getTclOption(),
                          VIRTPORT_TYPE.POWER_DYN.getTclOption(),
                          VIRTPORT_TYPE.POWER_LEAK.getTclOption(),
                          VIRTPORT_TYPE.POWER_TOT.getTclOption(),
                          VIRTPORT_TYPE.POWER_DYN_ALL.getTclOption(),
                          VIRTPORT_TYPE.POWER_LEAK_ALL.getTclOption(),
                          VIRTPORT_TYPE.POWER_TOT_ALL.getTclOption()
                        })))
            .setRequired(false)
            .setShortFlag('t')
            .setLongFlag(PROBE_TYPE)
            .setUsageName(PROBE_TYPE);

    orderOptionF =
        new FlaggedOption(ORDER_OPTION)
            .setStringParser(
                EnumeratedStringParser.getParser(
                    SLICE_ORDER.PARALLEL.getText() + ";" + SLICE_ORDER.SERIAL.getText()))
            .setRequired(false)
            .setShortFlag('o')
            .setLongFlag(ORDER_OPTION)
            .setUsageName(SLICE_ORDER.PARALLEL.getText() + "|" + SLICE_ORDER.SERIAL.getText());

    activityOptionF =
        new FlaggedOption(ACTIVTY)
            .setStringParser(JSAP.FLOAT_PARSER)
            .setRequired(false)
            .setShortFlag('a')
            .setLongFlag(ACTIVTY)
            .setUsageName("% of activity of the scenario");

    configOption_S = new Switch(CONFIG_OPTION).setLongFlag(CONFIG_OPTION);

    configOption_S.setHelp("specify a config state");

    defaultOption_S = new Switch(DEFAULT_OPTION).setLongFlag(DEFAULT_OPTION);

    defaultOption_S.setHelp("specify a default content");

    tilltime_F =
        new FlaggedOption(TILLTIME_OPTION)
            .setStringParser(JSAP.FLOAT_PARSER)
            .setRequired(false)
            .setLongFlag(TILLTIME_OPTION)
            .setUsageName(TILLTIME_OPTION);

    setOnlyS = new Switch(SETONLY_OPTION).setLongFlag(SETONLY_OPTION);
    setOnlyS.setHelp("force only the signal, and do to recompute the state of");

    bundleS = new Switch(BUNDLE_OPTION).setLongFlag(BUNDLE_OPTION);
    bundleS.setHelp("create a bundle");

    removeS = new Switch(REMOVE_OPTION).setLongFlag(REMOVE_OPTION);
    removeS.setHelp("remove the force command");

    addS = new Switch(ADD_OPTION).setLongFlag(ADD_OPTION).setShortFlag('a');
    addS.setHelp("add the probe to the table");

    datapoints_S = new Switch(DATAPOINTS_OPTION).setLongFlag(DATAPOINTS_OPTION).setShortFlag('d');
    datapoints_S.setHelp("return all data points");

    pathOptionF =
        new FlaggedOption(PATH_OPTION)
            .setStringParser(JSAP.STRING_PARSER)
            .setRequired(true)
            .setShortFlag('p')
            .setLongFlag(PATH_OPTION)
            .setUsageName("scenario|slice|activity path");
  }
예제 #3
0
  public CommandLineInterface() throws JSAPException {
    super(
        APPLICATION_CALL,
        "Reads a list of General Game Playing XML match files from the given "
            + "input directory, executes the selected rating algorithms on "
            + "the matches and writes the resulting player ratings to files "
            + "in the output directory.",
        new Parameter[] {
          /* Input directory */
          // --input-dir, -i
          new FlaggedOption(
              OPTION_INPUT_DIR,
              FileStringParser.getParser().setMustBeDirectory(true).setMustExist(true),
              NO_DEFAULT,
              REQUIRED,
              'i',
              OPTION_INPUT_DIR,
              "The directory to read matches from. Must contain a file called "
                  + "match_index.csv as well as the match XML files."),
          // Checking readability of match_index.csv and XML files is done by
          // MatchReader, which is fine (they have to be readable by the
          // time MatchReader needs them; checking them now would not help
          // much).

          /* Output directory */
          // --output-dir, -o
          new FlaggedOption(
              OPTION_OUTPUT_DIR,
              FileStringParser.getParser().setMustBeDirectory(true).setMustExist(false),
              NO_DEFAULT,
              REQUIRED,
              'o',
              OPTION_OUTPUT_DIR,
              "The directory to write output files to."),

          /* Previous rating file */
          // --previous, -p
          new FlaggedOption(
              OPTION_PREVIOUS_RATINGS,
              FileStringParser.getParser().setMustBeFile(true).setMustExist(true),
              NO_DEFAULT,
              NOT_REQUIRED,
              'p',
              OPTION_PREVIOUS_RATINGS,
              "The CSV output file of the previous competition, if the previous ratings are to be used to initialize the new ratings."),

          /* Rating algorithm selection */
          // --dynamic-linear-regression-rating, -d
          new FlaggedOption(
              OPTION_DYNAMIC_LINEAR_REGRESSION,
              INTEGER_PARSER,
              NO_DEFAULT,
              NOT_REQUIRED,
              'd',
              OPTION_DYNAMIC_LINEAR_REGRESSION,
              "Enables the linear regression rating algorithm, using a dynamic learning rate. "
                  + "Expects an integer value that is bigger or equal to the maximum number of "
                  + "MatchSets that will be read."),

          // --constant-linear-regression-rating, -c
          new FlaggedOption(
              OPTION_CONSTANT_LINEAR_REGRESSION,
              DOUBLE_PARSER,
              NO_DEFAULT,
              NOT_REQUIRED,
              'c',
              OPTION_CONSTANT_LINEAR_REGRESSION,
              "Enables the linear regression rating algorithm, using a constant learning rate. "
                  + "Expects a double value specifying the learning rate to be used (e.g. 1.0)."),

          // --direct-scores-rating, -s
          new Switch(
              OPTION_DIRECT_SCORES,
              's',
              OPTION_DIRECT_SCORES,
              "Enables the direct scores rating algorithm. This is not really a rating algorithm, "
                  + "but rather sums up the scores received by the players."),

          /* ****************** ADD NEW RATING SYSTEMS HERE ****************** */

          /* Output selection */
          // --csv-output, -v
          new Switch(
              OPTION_CSV_OUTPUT,
              'v',
              OPTION_CSV_OUTPUT,
              "Enables CSV (comma separated values) output for all rating algorithms."),

          // --gnuplot-output, -g
          new Switch(
              OPTION_GNUPLOT_OUTPUT,
              'g',
              OPTION_GNUPLOT_OUTPUT,
              "Enables gnuplot (data file) output for all rating algorithms."),

          // --html-output, -t
          new Switch(
              OPTION_HTML_OUTPUT,
              't',
              OPTION_HTML_OUTPUT,
              "Enables HTML output for all rating algorithms."),

          /* ****************** ADD NEW OUTPUT METHODS HERE ****************** */

          /* Debug level */
          // --debug-level, -l
          new FlaggedOption(
              OPTION_DEBUG_LEVEL,
              EnumeratedStringParser.getParser(
                  "OFF; SEVERE; WARNING; INFO; CONFIG; FINE; FINER; FINEST; ALL", false, false),
              "INFO",
              NOT_REQUIRED,
              'l',
              OPTION_DEBUG_LEVEL,
              "Sets the level of debug output. One of the following (in order of "
                  + "increasing verbosity): "
                  + "OFF; SEVERE; WARNING; INFO; CONFIG; FINE; FINER; FINEST; ALL. "
                  + "If the debug level is at FINE or higher, detailed statistical "
                  + "information about the linear regression will be written to the "
                  + "output directory.")

          /* Help */
          // --help option is added by SimpleJSAP
        });
  }