@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); } }
@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); }
private void delete(String id) { System.out.println(); final Long i = Long.valueOf(id); if (monitorConfigService.delete(i)) { System.out.println("Deleted monitor " + id); } else { System.out.println("Could not delete monitor " + id); } }
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")); }
private static long getTermCount( SolrServer server, Map<String, Integer> singleCountMap, SearchTermAndList searchTermAndList, Map<String, String> filterGrayList, Map<String, String> keepGrayList) { List<String[]> searchTerms = searchTermAndList.asListArray(); Integer searchTermCountObject = searchTerms.size() != 1 ? null : singleCountMap.get(join(searchTerms.get(0), ",")); long searchTermCount = 0; if (searchTermCountObject == null) { // didn't find it in map, so need to go get count SolrQuery query = new SolrQuery(); query.setQuery("+text:(*:*)"); query.addFilterQuery("+pub_date_year:[1993 TO 2013]"); query.setParam("fl", "pmid"); for (int i = 0; i < searchTerms.size(); i++) { String term1 = ""; for (String aTermArray : searchTerms.get(i)) { if (filterGrayList.containsKey(aTermArray.toLowerCase())) { String filterTerms = filterGrayList.get(aTermArray.toLowerCase()); String[] splitFilterTerms = filterTerms.split(","); term1 = term1 + "(+\"" + aTermArray + "\" -("; for (String splitFilterTerm : splitFilterTerms) { term1 = term1 + "\"" + splitFilterTerm + "\" "; } term1 = term1 + ")) "; } else if (keepGrayList.containsKey(aTermArray.toLowerCase())) { String keepTerms = keepGrayList.get(aTermArray.toLowerCase()); String[] splitKeepTerms = keepTerms.split(","); term1 = term1 + "(+\"" + aTermArray + "\" +("; for (String splitKeepTerm : splitKeepTerms) { term1 = term1 + "\"" + splitKeepTerm + "\" "; } term1 = term1 + ")) "; } else { term1 = term1 + "\"" + aTermArray + "\" "; } } query.addFilterQuery("+text:(" + term1 + ")"); } try { QueryResponse rsp = server.query(query); searchTermCount = rsp.getResults().getNumFound(); singleCountMap.put( join(searchTerms.get(0), ","), Integer.parseInt(Long.toString(searchTermCount))); } catch (SolrServerException e) { // exit out if there is an error log.warning(e.getMessage()); System.exit(1); } } else { searchTermCount = searchTermCountObject; } return searchTermCount; }