@Override protected void parseArgs(CommandLine cli, String[] args) throws ParseException, ArrayIndexOutOfBoundsException, HelpException { super.parseArgs(cli, args); long tau = Long.parseLong(args[1]); long delay = Long.parseLong(args[2]); String lower_prefix = cli.hasOption(lowerPrefixOption) ? cli.getOptionValue(lowerPrefixOption) : LinkTrace.defaultName; lower_name = ReachabilityTrace.defaultName(lower_prefix, tau, delay); String upper_prefix = cli.hasOption(upperPrefixOption) ? cli.getOptionValue(upperPrefixOption) : lower_prefix + "_upper"; upper_name = ReachabilityTrace.defaultName(upper_prefix, tau, delay); }
@Override protected void parseArgs(CommandLine cli, String[] args) throws ParseException, ArrayIndexOutOfBoundsException, HelpException { if (args.length == 5) { super.parseArgs(cli, args); orig_trace_name = args[1]; dest_trace_name = args[2]; minTime = Long.parseLong(args[3]); maxTime = Long.parseLong(args[4]); } else { orig_store_file = new File(args[0]); dest_store_file = new File(args[1]); minTime = Long.parseLong(args[2]); maxTime = Long.parseLong(args[3]); force = cli.hasOption(forceOption); } }
public void process(String[] params) { CommandLine cmd; try { cmd = parser.parse(options, params); } catch (org.apache.commons.cli.ParseException ex) { throw new RuntimeException(ex); } if (cmd.hasOption(LIST)) { list(); } if (cmd.hasOption(DELETE)) { delete(cmd.getOptionValue(DELETE)); } if (cmd.hasOption(START)) { long timeout = 10000; long wait = 120000; if (cmd.hasOption(WAIT)) { wait = Long.parseLong(cmd.getOptionValue(WAIT)); } if (cmd.hasOption(TIMEOUT)) { timeout = Long.parseLong(cmd.getOptionValue(TIMEOUT)); } pollService.start(wait, timeout); } if (cmd.hasOption(ALARMS)) { Long threshold = 20L; Integer minutes = 20; if (cmd.hasOption(THRESHOLD)) { threshold = Long.parseLong(cmd.getOptionValue(THRESHOLD)); } if (cmd.hasOption(PERIOD)) { minutes = Integer.parseInt(cmd.getOptionValue(PERIOD)); } showAlarms(threshold, minutes); } }
private long parseLong(final String longValue) throws ParseException { long value; try { value = Long.parseLong(longValue); } catch (final NumberFormatException ex) { throw new ParseException("Could not parse '" + longValue + "' as a long value."); } return value; }
@Override protected void parseArgs(CommandLine cli, String[] args) throws ParseException, HelpException { super.parseArgs(cli, args); graph_options.parse(cli); ext_fmt.parse(cli); if (cli.hasOption(maxTimeOption)) maxTime = Long.parseLong(cli.getOptionValue(maxTimeOption)); dtps = getTicsPerSecond(cli.getOptionValue(destTimeUnitOption, "s")); if (dtps == null) throw new HelpException(); d_interval = Double.parseDouble(cli.getOptionValue(intervalOption, "1")); }