Package weka.core
Class WekaOptionUtils
- java.lang.Object
-
- weka.core.WekaOptionUtils
-
public class WekaOptionUtils extends Object
Helper class for option parsing.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description WekaOptionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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, 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, adams.core.base.BaseObject value)
Adds the BaseObject to the options.static void
add(List<String> options, char option, adams.core.base.BaseObject[] value)
Adds the BaseObject to the options.static void
add(List<String> options, char option, adams.core.Index value)
Adds the Index to the options.static void
add(List<String> options, char option, adams.core.Index[] value)
Adds the Index to the options.static void
add(List<String> options, char option, adams.core.option.OptionHandler value)
Adds the adams.core.option.OptionHandler to the options.static void
add(List<String> options, char option, adams.core.Range value)
Adds the adams.core.Range to the options.static void
add(List<String> options, char option, adams.core.Range[] value)
Adds the adams.core.Range 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, Enum value)
Adds the enum 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, String value)
Adds the String value 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, 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, 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, adams.core.base.BaseObject value)
Adds the BaseObject to the options.static void
add(List<String> options, String option, adams.core.base.BaseObject[] value)
Adds the BaseObject to the options.static void
add(List<String> options, String option, adams.core.Index value)
Adds the Index to the options.static void
add(List<String> options, String option, adams.core.Index[] value)
Adds the Index to the options.static void
add(List<String> options, String option, adams.core.option.OptionHandler value)
Adds the adams.core.option.OptionHandler to the options.static void
add(List<String> options, String option, adams.core.Range value)
Adds the adams.core.Range to the options.static void
add(List<String> options, String option, adams.core.Range[] value)
Adds the adams.core.Range 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, Enum value)
Adds the enum 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, String value)
Adds the String value to the options.static void
add(List<String> options, String option, weka.core.OptionHandler value)
Adds the OptionHandler 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, adams.core.Index defValue, char option)
Adds an Option for a flag to the list of options.static void
addOption(Vector options, String text, adams.core.Index defValue, String option)
Adds an Option for a flag to the list of options.static void
addOption(Vector options, String text, adams.core.Range defValue, char option)
Adds an Option for a flag to the list of options.static void
addOption(Vector options, String text, adams.core.Range defValue, String option)
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 void
addOption(Vector options, String text, weka.core.OptionHandler defValue, char option)
Adds an Option for a flag to the list of options.static void
addOption(Vector options, String text, weka.core.OptionHandler defValue, String option)
Adds an Option for a flag to the list of options.static void
addOption(Vector options, String text, weka.core.Range defValue, char option)
Adds an Option for a flag to the list of options.static void
addOption(Vector options, String text, weka.core.Range defValue, String option)
Adds an Option for a flag to the list of options.static void
addOption(Vector options, String text, weka.core.SingleIndex defValue, char option)
Adds an Option for a flag to the list of options.static void
addOption(Vector options, String text, weka.core.SingleIndex defValue, String option)
Adds an Option for a flag to the list of options.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 double
parse(String[] options, char option, double defValue)
Parses a double 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 adams.core.base.BaseObject
parse(String[] options, char option, adams.core.base.BaseObject defValue)
Parses a BaseObject option, uses default if option is missing.static adams.core.base.BaseObject[]
parse(String[] options, char option, adams.core.base.BaseObject[] defValue)
Parses a BaseObject option, uses default if option is missing.static adams.core.Index
parse(String[] options, char option, adams.core.Index defValue)
Parses an Index option, uses default if option is missing.static adams.core.Index[]
parse(String[] options, char option, adams.core.Index[] defValue)
Parses an Index option, uses default if option is missing.static adams.core.option.OptionHandler
parse(String[] options, char option, adams.core.option.OptionHandler defValue)
Parses an adams.core.option.OptionHandler option, uses default if option is missing.static Object
parse(String[] options, char option, adams.core.option.OptionHandler[] defValue, Class cls)
Parses an adams.core.option.OptionHandler array option, uses default if option is missing.static adams.core.Range
parse(String[] options, char option, adams.core.Range defValue)
Parses a Range option, uses default if option is missing.static adams.core.Range[]
parse(String[] options, char option, adams.core.Range[] defValue)
Parses a Range 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 <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 Enum
parse(String[] options, char option, Enum defValue)
Parses an enum 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 weka.core.OptionHandler
parse(String[] options, char option, weka.core.OptionHandler defValue)
Parses an OptionHandler option, uses default if option is missing.static Object
parse(String[] options, char option, weka.core.OptionHandler[] defValue, Class cls)
Parses an OptionHandler array 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 double
parse(String[] options, String option, double defValue)
Parses a double 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 adams.core.base.BaseObject
parse(String[] options, String option, adams.core.base.BaseObject defValue)
Parses a BaseObject option, uses default if option is missing.static adams.core.base.BaseObject[]
parse(String[] options, String option, adams.core.base.BaseObject[] defValue)
Parses a BaseObject option, uses default if option is missing.static adams.core.Index
parse(String[] options, String option, adams.core.Index defValue)
Parses a Index option, uses default if option is missing.static adams.core.Index[]
parse(String[] options, String option, adams.core.Index[] defValue)
Parses a Index option, uses default if option is missing.static adams.core.io.PlaceholderDirectory
parse(String[] options, String option, adams.core.io.PlaceholderDirectory defValue)
Parses a PlaceholderDirectory option, uses default if option is missing.static adams.core.io.PlaceholderFile
parse(String[] options, String option, adams.core.io.PlaceholderFile defValue)
Parses a PlaceholderFile option, uses default if option is missing.static adams.core.option.OptionHandler
parse(String[] options, String option, adams.core.option.OptionHandler defValue)
Parses an adams.core.option.OptionHandler option, uses default if option is missing.static Object
parse(String[] options, String option, adams.core.option.OptionHandler[] defValue, Class cls)
Parses an adams.core.option.OptionHandler array option, uses default if option is missing.static adams.core.Range
parse(String[] options, String option, adams.core.Range defValue)
Parses a Range option, uses default if option is missing.static adams.core.Range[]
parse(String[] options, String option, adams.core.Range[] defValue)
Parses a Range 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 <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 Enum
parse(String[] options, String option, Enum defValue)
Parses an enum option, uses default if option is missing.static Object
parse(String[] options, String option, Object defValue, Class cls)
Parses an array 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
parse(String[] options, String option, weka.core.OptionHandler defValue)
Parses an OptionHandler option, uses default if option is missing.static Object
parse(String[] options, String option, weka.core.OptionHandler[] defValue, Class cls)
Parses an OptionHandler array option, uses default if option is missing.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.
-
-
-
Method Detail
-
parse
public static int parse(String[] options, char option, int defValue) throws Exception
Parses an int option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static int parse(String[] options, String option, int defValue) throws Exception
Parses an int option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static long parse(String[] options, char option, long defValue) throws Exception
Parses an long option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static long parse(String[] options, String option, long defValue) throws Exception
Parses a long option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static float parse(String[] options, char option, float defValue) throws Exception
Parses a float option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static float parse(String[] options, String option, float defValue) throws Exception
Parses a float option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static double parse(String[] options, char option, double defValue) throws Exception
Parses a double option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static double parse(String[] options, String option, double defValue) throws Exception
Parses a double option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static String parse(String[] options, char option, String defValue) throws Exception
Parses a String option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static String parse(String[] options, String option, String defValue) throws Exception
Parses a String option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static File parse(String[] options, char option, File defValue) throws Exception
Parses a File option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static File parse(String[] options, String option, File defValue) throws Exception
Parses a File option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.io.PlaceholderFile parse(String[] options, String option, adams.core.io.PlaceholderFile defValue) throws Exception
Parses a PlaceholderFile option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.io.PlaceholderDirectory parse(String[] options, String option, adams.core.io.PlaceholderDirectory defValue) throws Exception
Parses a PlaceholderDirectory option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static weka.core.OptionHandler parse(String[] options, char option, weka.core.OptionHandler defValue) throws Exception
Parses an OptionHandler option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static weka.core.OptionHandler parse(String[] options, String option, weka.core.OptionHandler defValue) throws Exception
Parses an OptionHandler option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static Object parse(String[] options, char option, weka.core.OptionHandler[] defValue, Class cls) throws Exception
Parses an OptionHandler array option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default valuecls
- the class to use for the array- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static Object parse(String[] options, String option, weka.core.OptionHandler[] defValue, Class cls) throws Exception
Parses an OptionHandler array option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default valuecls
- the class to use for the array- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static Object parse(String[] options, String option, Object defValue, Class cls) throws Exception
Parses an array option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default valuecls
- the class to use for the array- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.option.OptionHandler parse(String[] options, char option, adams.core.option.OptionHandler defValue) throws Exception
Parses an adams.core.option.OptionHandler option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.option.OptionHandler parse(String[] options, String option, adams.core.option.OptionHandler defValue) throws Exception
Parses an adams.core.option.OptionHandler option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static Object parse(String[] options, char option, adams.core.option.OptionHandler[] defValue, Class cls) throws Exception
Parses an adams.core.option.OptionHandler array option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default valuecls
- the class to use for the array- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static Object parse(String[] options, String option, adams.core.option.OptionHandler[] defValue, Class cls) throws Exception
Parses an adams.core.option.OptionHandler array option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default valuecls
- the class to use for the array- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static Enum parse(String[] options, char option, Enum defValue) throws Exception
Parses an enum option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static Enum parse(String[] options, String option, Enum defValue) throws Exception
Parses an enum option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.Index parse(String[] options, char option, adams.core.Index defValue) throws Exception
Parses an Index option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.Index parse(String[] options, String option, adams.core.Index defValue) throws Exception
Parses a Index option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.Index[] parse(String[] options, char option, adams.core.Index[] defValue) throws Exception
Parses an Index option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.Index[] parse(String[] options, String option, adams.core.Index[] defValue) throws Exception
Parses a Index option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.Range parse(String[] options, char option, adams.core.Range defValue) throws Exception
Parses a Range option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.Range parse(String[] options, String option, adams.core.Range defValue) throws Exception
Parses a Range option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.Range[] parse(String[] options, char option, adams.core.Range[] defValue) throws Exception
Parses a Range option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.Range[] parse(String[] options, String option, adams.core.Range[] defValue) throws Exception
Parses a Range option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.base.BaseObject parse(String[] options, char option, adams.core.base.BaseObject defValue) throws Exception
Parses a BaseObject option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.base.BaseObject parse(String[] options, String option, adams.core.base.BaseObject defValue) throws Exception
Parses a BaseObject option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.base.BaseObject[] parse(String[] options, char option, adams.core.base.BaseObject[] defValue) throws Exception
Parses a BaseObject option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static adams.core.base.BaseObject[] parse(String[] options, String option, adams.core.base.BaseObject[] defValue) throws Exception
Parses a BaseObject option, uses default if option is missing.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)defValue
- the default value- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static String[] parse(String[] options, char option) throws Exception
Parses an array option, returns all the occurrences of the option as a string array.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static String[] parse(String[] options, String option) throws Exception
Parses an array option, returns all the occurrences of the option as a string array.- Parameters:
options
- the option array to useoption
- the option to look for in the options array (no leading dash)- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static <T> T[] parse(String[] options, char option, Class<T> cls) throws Exception
Parses an array option, returns all the occurrences of the option as a string array.- Parameters:
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)- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
parse
public static <T> T[] parse(String[] options, String option, Class<T> cls) throws Exception
Parses an array option, returns all the occurrences of the option as a string array.- Parameters:
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)- Returns:
- the parsed value (or default value if option not present)
- Throws:
Exception
- if parsing of value fails
-
add
public static void add(List<String> options, char option, int value)
Adds the int value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, int value)
Adds the int value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, long value)
Adds the long value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, long value)
Adds the long value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, float value)
Adds the float value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, float value)
Adds the float value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, double value)
Adds the double value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, double value)
Adds the double value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, String value)
Adds the String value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, String value)
Adds the String value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, boolean value)
Adds the boolean flag (if true) to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, boolean value)
Adds the boolean flag (if true) to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, File value)
Adds the File value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, File value)
Adds the File value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, weka.core.OptionHandler value)
Adds the OptionHandler to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, weka.core.OptionHandler value)
Adds the OptionHandler to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, adams.core.option.OptionHandler value)
Adds the adams.core.option.OptionHandler to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, adams.core.option.OptionHandler value)
Adds the adams.core.option.OptionHandler to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, adams.core.Index value)
Adds the Index to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, adams.core.Index value)
Adds the Index to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, adams.core.Index[] value)
Adds the Index to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, adams.core.Index[] value)
Adds the Index to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, adams.core.Range value)
Adds the adams.core.Range to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, adams.core.Range value)
Adds the adams.core.Range to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, adams.core.Range[] value)
Adds the adams.core.Range to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, adams.core.Range[] value)
Adds the adams.core.Range to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, adams.core.base.BaseObject value)
Adds the BaseObject to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, adams.core.base.BaseObject value)
Adds the BaseObject to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, adams.core.base.BaseObject[] value)
Adds the BaseObject to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, adams.core.base.BaseObject[] value)
Adds the BaseObject to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, Object value)
Adds the array to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, Object value)
Adds the array to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, char option, Enum value)
Adds the enum value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String option, Enum value)
Adds the enum value to the options.- Parameters:
options
- the current list of options to extendoption
- the option (without the leading dash)value
- the current value
-
add
public static void add(List<String> options, String[] superOptions)
Adds the "super" options to the current list.- Parameters:
options
- the current optionssuperOptions
- the "super" options to add
-
addFlag
public static void addFlag(Vector options, String text, char flag)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionflag
- the flag (no dash)
-
addFlag
public static void addFlag(Vector options, String text, String flag)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionflag
- the flag (no dash)
-
addOption
public static void addOption(Vector options, String text, String defValue, char option)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionoption
- the option (no dash)
-
addOption
public static void addOption(Vector options, String text, String defValue, String option)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionoption
- the option (no dash)
-
addOption
public static void addOption(Vector options, String text, weka.core.OptionHandler defValue, char option)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionoption
- the option (no dash)
-
addOption
public static void addOption(Vector options, String text, weka.core.OptionHandler defValue, String option)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionoption
- the option (no dash)
-
addOption
public static void addOption(Vector options, String text, adams.core.Index defValue, char option)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionoption
- the option (no dash)
-
addOption
public static void addOption(Vector options, String text, adams.core.Index defValue, String option)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionoption
- the option (no dash)
-
addOption
public static void addOption(Vector options, String text, adams.core.Range defValue, char option)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionoption
- the option (no dash)
-
addOption
public static void addOption(Vector options, String text, adams.core.Range defValue, String option)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionoption
- the option (no dash)
-
addOption
public static void addOption(Vector options, String text, weka.core.SingleIndex defValue, char option)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionoption
- the option (no dash)
-
addOption
public static void addOption(Vector options, String text, weka.core.SingleIndex defValue, String option)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionoption
- the option (no dash)
-
addOption
public static void addOption(Vector options, String text, weka.core.Range defValue, char option)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionoption
- the option (no dash)
-
addOption
public static void addOption(Vector options, String text, weka.core.Range defValue, String option)
Adds an Option for a flag to the list of options.- Parameters:
options
- the options to extendtext
- the descriptionoption
- the option (no dash)
-
add
public static void add(Vector current, Enumeration superOptions)
Adds the option description of the super class.- Parameters:
current
- the current option descriptions to extendsuperOptions
- the "super" descriptions
-
toArray
public static String[] toArray(List<String> options)
Turns the list of options into an array.- Parameters:
options
- the list of options to convert- Returns:
- the generated array
-
toEnumeration
public static Enumeration toEnumeration(Vector options)
Returns the option descriptions as an enumeration.- Parameters:
options
- the descriptions- Returns:
- the enumeration
-
fromCommandLine
public static <T> T fromCommandLine(Class<T> cls, String cmdline) throws Exception
Turns a commandline into an object.- Parameters:
cls
- the class that the commandline is expected to becmdline
- the commandline to parse- Returns:
- the object, null if failed to instantiate
- Throws:
Exception
- if parsing fails
-
-