public class Option extends Object
Constructor and Description |
---|
Option()
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
int |
add(String name)
Adds an option definition to the list of known options.
|
int |
add(String name,
int id)
Adds an option definition to the list of known options.
|
static String |
find(String[] options,
String name)
Searches a list contain options specified in a KEYWORD=VALUE
format and locates the option with a given keyword.
|
static String |
find(String[] options,
String name,
String defaultValue)
Searches a list contain options specified in a KEYWORD=VALUE
format and locates the option with a given keyword.
|
static String |
find(String[] options,
String name,
String defaultValue,
int start)
Searches a list contain options specified in a KEYWORD=VALUE
format and locates the option with a given keyword.
|
int |
token(String name)
Searches the list of options and returns the ID of the first match found.
|
public int add(String name, int id)
name
- the name of the option.id
- the integer ID of the option.public int add(String name)
name
- the name of the option.public int token(String name)
name
- the name of the option.-1
is returned.public static String find(String[] options, String name)
options
- the array of options. Each options must be specified in
the form KEYWORD=VALUE. If an option is specified as just
KEYWORD, then a value of 1 is assumed.name
- the keyword to locate within the list of options.
Partial matches are permitted.public static String find(String[] options, String name, String defaultValue)
options
- the array of options. Each options must be specified in
the form KEYWORD=VALUE. If an option is specified as just
KEYWORD, then a value of 1 is assumed.name
- the keyword to locate within the list of options.
Partial matches are permitted.defaultValue
- the default value to return if an options with the
the given keyword is not found.public static String find(String[] options, String name, String defaultValue, int start)
options
- the array of options. Each options must be specified in
the form KEYWORD=VALUE. If an option is specified as just
KEYWORD, then a value of 1 is assumed.name
- the keyword to locate within the list of options.
Partial matches are permitted.defaultValue
- the default value to return if an options with the
the given keyword is not found.start
- the index of the element within options to begin the search.Copyright © 2008-2016 Regents University of California. All Rights Reserved.