/** * Parses command line arguments into a Map. Arguments of the form * <p/> * {@code -flag1 arg1a arg1b ... arg1m -flag2 -flag3 arg3a ... arg3n} * <p/> * will be parsed so that the flag is a key in the Map (including * the hyphen) and its value will be a {@link String}[] containing * the optional arguments (if present). The non-flag values not * captured as flag arguments are collected into a String[] array * and returned as the value of {@code null} in the Map. In * this invocation, flags cannot take arguments, so all the {@link * String} array values other than the value for {@code null} * will be zero-length. * * @param args A command-line arguments array * @return a {@link Map} of flag names to flag argument {@link * String} arrays. */ public static Map<String, String[]> argsToMap(String[] args) { return argsToMap(args, Collections.emptyMap()); }
private static boolean validateCommandLine(String[] args) { Map<String, String[]> argsMap = StringUtils.argsToMap(args,optionArgDefs); for(Map.Entry<String, String[]> opt : argsMap.entrySet()) { String key = opt.getKey(); if (key == null) { // continue; } else switch(key) { case "-d": MAKE_DISTRIB = true; distribName = opt.getValue()[0]; break; case "-v" : VERBOSE = true; break; case "-p" : outputPath = opt.getValue()[0]; break; default : return false; } } //Regular arguments String[] rest = argsMap.get(null); if(rest == null || rest.length != MIN_ARGS) { return false; } else { configFile = rest[0]; } return true; }
private static boolean validateCommandLine(String[] args) { Map<String, String[]> argsMap = StringUtils.argsToMap(args,optionArgDefs); for(Map.Entry<String, String[]> opt : argsMap.entrySet()) { String key = opt.getKey(); if (key != null) { switch (key) { case "-y": MAX_GOLD_YIELD = Integer.parseInt(opt.getValue()[0]); break; case "-l": LANGUAGE = Language.valueOf(opt.getValue()[0]); break; case "-v": VERBOSE = true; break; default: return false; } } } //Regular arguments String[] rest = argsMap.get(null); if(rest == null || rest.length != MIN_ARGS) { return false; } else { goldFile = new File(rest[0]); guessFile = new File(rest[1]); } return true; }
flagMap.put("-inputDicts", 1); flagMap.put("-output", 1); Map<String,String[]> argsMap = StringUtils.argsToMap(args,flagMap);
flagsToNumArgs.put("-encoding", 1); flagsToNumArgs.put("-rebuild", 1); Map<String, String[]> argMap = StringUtils.argsToMap(args, flagsToNumArgs);
flagsToNumArgs.put("-dictPath" , 1); flagsToNumArgs.put("-encoding" , 1); Map<String, String[]> argMap = StringUtils.argsToMap(args, flagsToNumArgs); String[] otherArgs = argMap.get(null); if (otherArgs.length < 1) {
String goldFile = null; Map<String, String[]> argsMap = StringUtils.argsToMap(args, optionArgDefs);
String goldFile = null; Map<String, String[]> argsMap = StringUtils.argsToMap(args, optionArgDefs);
flagMap.put("-tLP", 1); flagMap.put("-hf", 1); Map<String,String[]> argsMap = StringUtils.argsToMap(args,flagMap); args = argsMap.get(null); if(argsMap.keySet().contains("-format")) {
flagMap.put(oneLine, 0); flagMap.put(uniqueTrees, 0); Map<String, String[]> argsMap = StringUtils.argsToMap(args, flagMap); args = argsMap.get(null);
Map<String, String[]> argsMap = StringUtils.argsToMap(args, flagMap);
flagMap.put(headFinderOption,1); flagMap.put(macroOption, 1); Map<String,String[]> argsMap = StringUtils.argsToMap(args,flagMap); args = argsMap.get(null);
flagsToNumArgs.put("-stats", Integer.valueOf(2)); Map<String,String[]> argMap = StringUtils.argsToMap(args, flagsToNumArgs);
/** * Parses command line arguments into a Map. Arguments of the form * <p/> * {@code -flag1 arg1a arg1b ... arg1m -flag2 -flag3 arg3a ... arg3n} * <p/> * will be parsed so that the flag is a key in the Map (including * the hyphen) and its value will be a {@link String}[] containing * the optional arguments (if present). The non-flag values not * captured as flag arguments are collected into a String[] array * and returned as the value of {@code null} in the Map. In * this invocation, flags cannot take arguments, so all the {@link * String} array values other than the value for {@code null} * will be zero-length. * * @param args A command-line arguments array * @return a {@link Map} of flag names to flag argument {@link * String} arrays. */ public static Map<String, String[]> argsToMap(String[] args) { return argsToMap(args, Collections.emptyMap()); }
/** * Parses command line arguments into a Map. Arguments of the form * <p/> * {@code -flag1 arg1a arg1b ... arg1m -flag2 -flag3 arg3a ... arg3n} * <p/> * will be parsed so that the flag is a key in the Map (including * the hyphen) and its value will be a {@link String}[] containing * the optional arguments (if present). The non-flag values not * captured as flag arguments are collected into a String[] array * and returned as the value of {@code null} in the Map. In * this invocation, flags cannot take arguments, so all the {@link * String} array values other than the value for {@code null} * will be zero-length. * * @param args A command-line arguments array * @return a {@link Map} of flag names to flag argument {@link * String} arrays. */ public static Map<String, String[]> argsToMap(String[] args) { return argsToMap(args, Collections.emptyMap()); }
/** * Parses command line arguments into a Map. Arguments of the form * <p/> * -flag1 arg1a arg1b ... arg1m -flag2 -flag3 arg3a ... arg3n * <p/> * will be parsed so that the flag is a key in the Map (including * the hyphen) and its value will be a {@link String}[] containing * the optional arguments (if present). The non-flag values not * captured as flag arguments are collected into a String[] array * and returned as the value of <code>null</code> in the Map. In * this invocation, flags cannot take arguments, so all the {@link * String} array values other than the value for <code>null</code> * will be zero-length. * * @param args A command-line arguments array * @return a {@link Map} of flag names to flag argument {@link * String} arrays. */ public static Map<String, String[]> argsToMap(String[] args) { return argsToMap(args, Collections.<String,Integer>emptyMap()); }
/** * Parses command line arguments into a Map. Arguments of the form * <p/> * -flag1 arg1a arg1b ... arg1m -flag2 -flag3 arg3a ... arg3n * <p/> * will be parsed so that the flag is a key in the Map (including * the hyphen) and its value will be a {@link String}[] containing * the optional arguments (if present). The non-flag values not * captured as flag arguments are collected into a String[] array * and returned as the value of <code>null</code> in the Map. In * this invocation, flags cannot take arguments, so all the {@link * String} array values other than the value for <code>null</code> * will be zero-length. * * @param args A command-line arguments array * @return a {@link Map} of flag names to flag argument {@link * String} arrays. */ public static Map<String, String[]> argsToMap(String[] args) { return argsToMap(args, new HashMap<String, Integer>()); }
private static boolean validateCommandLine(String[] args) { Map<String, String[]> argsMap = StringUtils.argsToMap(args,optionArgDefs); for(Map.Entry<String, String[]> opt : argsMap.entrySet()) { String key = opt.getKey(); if (key == null) { // continue; } else switch(key) { case "-d": MAKE_DISTRIB = true; distribName = opt.getValue()[0]; break; case "-v" : VERBOSE = true; break; case "-p" : outputPath = opt.getValue()[0]; break; default : return false; } } //Regular arguments String[] rest = argsMap.get(null); if(rest == null || rest.length != MIN_ARGS) { return false; } else { configFile = rest[0]; } return true; }
private static boolean validateCommandLine(String[] args) { Map<String, String[]> argsMap = StringUtils.argsToMap(args,optionArgDefs);
private static boolean validateCommandLine(String[] args) { Map<String, String[]> argsMap = StringUtils.argsToMap(args,optionArgDefs); for(Map.Entry<String, String[]> opt : argsMap.entrySet()) { String key = opt.getKey(); if (key != null) { switch (key) { case "-y": MAX_GOLD_YIELD = Integer.parseInt(opt.getValue()[0]); break; case "-l": LANGUAGE = Language.valueOf(opt.getValue()[0]); break; case "-v": VERBOSE = true; break; default: return false; } } } //Regular arguments String[] rest = argsMap.get(null); if(rest == null || rest.length != MIN_ARGS) { return false; } else { goldFile = new File(rest[0]); guessFile = new File(rest[1]); } return true; }