public class OptionUtils extends Object
| Constructor and Description |
|---|
OptionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
add(List<String> options,
char option,
boolean value)
Adds the boolean flag (if true) to the options.
|
static void |
add(List<String> options,
char option,
double value)
Adds the double value to the options.
|
static void |
add(List<String> options,
char option,
File value)
Adds the File value to the options.
|
static void |
add(List<String> options,
char option,
float value)
Adds the float value to the options.
|
static void |
add(List<String> options,
char option,
int value)
Adds the int value to the options.
|
static void |
add(List<String> options,
char option,
long value)
Adds the long value to the options.
|
static void |
add(List<String> options,
char option,
Object value)
Adds the array to the options.
|
static void |
add(List<String> options,
char option,
weka.core.OptionHandler value)
Adds the OptionHandler to the options.
|
static void |
add(List<String> options,
char option,
String value)
Adds the String value to the options.
|
static void |
add(List<String> options,
String[] superOptions)
Adds the "super" options to the current list.
|
static void |
add(List<String> options,
String option,
boolean value)
Adds the boolean flag (if true) to the options.
|
static void |
add(List<String> options,
String option,
double value)
Adds the double value to the options.
|
static void |
add(List<String> options,
String option,
File value)
Adds the File value to the options.
|
static void |
add(List<String> options,
String option,
float value)
Adds the float value to the options.
|
static void |
add(List<String> options,
String option,
int value)
Adds the int value to the options.
|
static void |
add(List<String> options,
String option,
long value)
Adds the long value to the options.
|
static void |
add(List<String> options,
String option,
Object value)
Adds the array to the options.
|
static void |
add(List<String> options,
String option,
weka.core.OptionHandler value)
Adds the OptionHandler to the options.
|
static void |
add(List<String> options,
String option,
String value)
Adds the String value to the options.
|
static void |
add(Vector current,
Enumeration superOptions)
Adds the option description of the super class.
|
static void |
addFlag(Vector options,
String text,
char flag)
Adds an Option for a flag to the list of options.
|
static void |
addFlag(Vector options,
String text,
String flag)
Adds an Option for a flag to the list of options.
|
static void |
addOption(Vector options,
String text,
String defValue,
char option)
Adds an Option for a flag to the list of options.
|
static void |
addOption(Vector options,
String text,
String defValue,
String option)
Adds an Option for a flag to the list of options.
|
static String |
backQuoteChars(String string)
Converts carriage returns and new lines in a string into \r and \n.
|
static String |
backQuoteChars(String string,
char[] find,
String[] replace)
Converts specified characters into the string equivalents.
|
static <T> T |
fromCommandLine(Class<T> cls,
String cmdline)
Turns a commandline into an object.
|
static String[] |
parse(String[] options,
char option)
Parses an array option, returns all the occurrences of the option as a string array.
|
static boolean |
parse(String[] options,
char option,
boolean defValue)
Parses a double option, uses default if option is missing.
|
static <T> T[] |
parse(String[] options,
char option,
Class<T> cls)
Parses an array option, returns all the occurrences of the option as a string array.
|
static double |
parse(String[] options,
char option,
double defValue)
Parses a double option, uses default if option is missing.
|
static File |
parse(String[] options,
char option,
File defValue)
Parses a File option, uses default if option is missing.
|
static float |
parse(String[] options,
char option,
float defValue)
Parses a float option, uses default if option is missing.
|
static int |
parse(String[] options,
char option,
int defValue)
Parses an int option, uses default if option is missing.
|
static long |
parse(String[] options,
char option,
long defValue)
Parses an long option, uses default if option is missing.
|
static weka.core.OptionHandler |
parse(String[] options,
char option,
weka.core.OptionHandler defValue)
Parses an OptionHandler option, uses default if option is missing.
|
static String |
parse(String[] options,
char option,
String defValue)
Parses a String option, uses default if option is missing.
|
static String[] |
parse(String[] options,
String option)
Parses an array option, returns all the occurrences of the option as a string array.
|
static boolean |
parse(String[] options,
String option,
boolean defValue)
Parses a double option, uses default if option is missing.
|
static <T> T[] |
parse(String[] options,
String option,
Class<T> cls)
Parses an array option, returns all the occurrences of the option as a string array.
|
static double |
parse(String[] options,
String option,
double defValue)
Parses a double option, uses default if option is missing.
|
static File |
parse(String[] options,
String option,
File defValue)
Parses a File option, uses default if option is missing.
|
static float |
parse(String[] options,
String option,
float defValue)
Parses a float option, uses default if option is missing.
|
static int |
parse(String[] options,
String option,
int defValue)
Parses an int option, uses default if option is missing.
|
static long |
parse(String[] options,
String option,
long defValue)
Parses a long option, uses default if option is missing.
|
static weka.core.OptionHandler |
parse(String[] options,
String option,
weka.core.OptionHandler defValue)
Parses an OptionHandler option, uses default if option is missing.
|
static String |
parse(String[] options,
String option,
String defValue)
Parses a String option, uses default if option is missing.
|
static weka.core.OptionHandler |
shallowCopy(weka.core.OptionHandler obj)
Creates a shallow copy of the option handler, just using its options.
|
static String[] |
toArray(List<String> options)
Turns the list of options into an array.
|
static String |
toCommandLine(Object obj)
Returns the commandline string for the object.
|
static Enumeration |
toEnumeration(Vector options)
Returns the option descriptions as an enumeration.
|
static String |
unbackQuoteChars(String string)
The inverse operation of backQuoteChars().
|
static String |
unbackQuoteChars(String string,
String[] find,
char[] replace)
The inverse operation of backQuoteChars().
|
public static int parse(String[] options, char option, int defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static int parse(String[] options, String option, int defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static long parse(String[] options, char option, long defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static long parse(String[] options, String option, long defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static float parse(String[] options, char option, float defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static float parse(String[] options, String option, float defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static double parse(String[] options, char option, double defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static double parse(String[] options, String option, double defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static String parse(String[] options, char option, String defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static String parse(String[] options, String option, String defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static File parse(String[] options, char option, File defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static File parse(String[] options, String option, File defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static weka.core.OptionHandler parse(String[] options, char option, weka.core.OptionHandler defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static weka.core.OptionHandler parse(String[] options, String option, weka.core.OptionHandler defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static String[] parse(String[] options, char option) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)Exception - if parsing of value failspublic static String[] parse(String[] options, String option) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)Exception - if parsing of value failspublic static <T> T[] parse(String[] options, char option, Class<T> cls) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)cls - the class type to use (requires a constructor that takes a string)Exception - if parsing of value failspublic static boolean parse(String[] options, char option, boolean defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static boolean parse(String[] options, String option, boolean defValue) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)defValue - the default valueException - if parsing of value failspublic static <T> T[] parse(String[] options, String option, Class<T> cls) throws Exception
options - the option array to useoption - the option to look for in the options array (no leading dash)cls - the class type to use (requires a constructor that takes a string)Exception - if parsing of value failspublic static void add(List<String> options, char option, int value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, String option, int value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, char option, long value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, String option, long value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, char option, float value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, String option, float value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, char option, double value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, String option, double value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, char option, String value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, String option, String value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, char option, boolean value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, String option, boolean value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, char option, File value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, String option, File value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, char option, weka.core.OptionHandler value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, String option, weka.core.OptionHandler value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, char option, Object value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, String option, Object value)
options - the current list of options to extendoption - the option (without the leading dash)value - the current valuepublic static void add(List<String> options, String[] superOptions)
options - the current optionssuperOptions - the "super" options to addpublic static void addFlag(Vector options, String text, char flag)
options - the options to extendtext - the descriptionflag - the flag (no dash)public static void addFlag(Vector options, String text, String flag)
options - the options to extendtext - the descriptionflag - the flag (no dash)public static void addOption(Vector options, String text, String defValue, char option)
options - the options to extendtext - the descriptionoption - the option (no dash)public static void addOption(Vector options, String text, String defValue, String option)
options - the options to extendtext - the descriptionoption - the option (no dash)public static void add(Vector current, Enumeration superOptions)
current - the current option descriptions to extendsuperOptions - the "super" descriptionspublic static String[] toArray(List<String> options)
options - the list of options to convertpublic static Enumeration toEnumeration(Vector options)
options - the descriptionspublic static <T> T fromCommandLine(Class<T> cls, String cmdline) throws Exception
cls - the class that the commandline is expected to becmdline - the commandline to parseException - if parsing failspublic static String toCommandLine(Object obj)
obj - the object to generate the commandline forUtils.toCommandLine(Object)public static String backQuoteChars(String string, char[] find, String[] replace)
string - the stringfind - the characters to replacereplace - the replacement strings for the charactersunbackQuoteChars(String, String[], char[])public static String backQuoteChars(String string)
string - the stringunbackQuoteChars(String)public static String unbackQuoteChars(String string, String[] find, char[] replace)
string - the stringfind - the string to findreplace - the character equivalents of the stringsbackQuoteChars(String, char[], String[])public static String unbackQuoteChars(String string)
string - the stringbackQuoteChars(String)public static weka.core.OptionHandler shallowCopy(weka.core.OptionHandler obj)
obj - the object to copyCopyright © 2017. All Rights Reserved.