예제 #1
0
  protected static JSAP getOptions() throws JSAPException {
    JSAP jsap = new JSAP();

    FlaggedOption inetAddress =
        new FlaggedOption(CMD_INET_ADDRESS)
            .setStringParser(new InetAddressStringParser())
            .setDefault("255.255.255.255")
            .setRequired(false)
            .setShortFlag('i')
            .setLongFlag("inet-address");

    inetAddress.setHelp(Messages.CMD_MESSAGES.getString("cmdline.description.inet-address"));
    jsap.registerParameter(inetAddress);

    FlaggedOption port =
        new FlaggedOption(CMD_PORT)
            .setStringParser(new IntegerStringParser())
            .setDefault("9")
            .setRequired(false)
            .setShortFlag('p')
            .setLongFlag("port");

    port.setHelp(Messages.CMD_MESSAGES.getString("cmdline.description.port"));
    jsap.registerParameter(port);

    FlaggedOption config =
        new FlaggedOption(CMD_CONFIG_FILE)
            .setStringParser(new StringStringParser())
            .setRequired(false)
            .setDefault(getConfigFilePath())
            .setShortFlag('c')
            .setLongFlag("config");

    config.setHelp(Messages.CMD_MESSAGES.getString("cmdline.description.config"));
    jsap.registerParameter(config);

    Switch version = new Switch(CMD_VERSION).setShortFlag('v').setLongFlag("version");

    version.setHelp(Messages.CMD_MESSAGES.getString("cmdline.description.version"));
    jsap.registerParameter(version);

    Switch help = new Switch(CMD_HELP).setShortFlag('h').setLongFlag("help");

    help.setHelp(Messages.CMD_MESSAGES.getString("cmdline.description.help"));
    jsap.registerParameter(help);

    Switch debug = new Switch(CMD_DEBUG).setShortFlag('d').setLongFlag("debug");

    debug.setHelp(Messages.CMD_MESSAGES.getString("cmdline.description.debug"));
    jsap.registerParameter(debug);

    UnflaggedOption addresses =
        new UnflaggedOption(CMD_ADDRESSES).setRequired(false).setGreedy(true);

    addresses.setHelp(Messages.CMD_MESSAGES.getString("cmdline.description.addresses"));
    jsap.registerParameter(addresses);

    return jsap;
  }
예제 #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");
  }