public class Option
extends java.lang.Object
Constructor and Description |
---|
Option()
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
int |
add(java.lang.String name)
Adds an option definition to the list of known options.
|
int |
add(java.lang.String name,
int id)
Adds an option definition to the list of known options.
|
static java.lang.String |
find(java.lang.String[] options,
java.lang.String name)
Searches a list contain options specified in a KEYWORD=VALUE
format and locates the option with a given keyword.
|
static java.lang.String |
find(java.lang.String[] options,
java.lang.String name,
java.lang.String defaultValue)
Searches a list contain options specified in a KEYWORD=VALUE
format and locates the option with a given keyword.
|
static java.lang.String |
find(java.lang.String[] options,
java.lang.String name,
java.lang.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(java.lang.String name)
Searches the list of options and returns the ID of the first match found.
|
public int add(java.lang.String name, int id)
name
- the name of the option.id
- the integer ID of the option.public int add(java.lang.String name)
name
- the name of the option.public int token(java.lang.String name)
name
- the name of the option.-1
is returned.public static java.lang.String find(java.lang.String[] options, java.lang.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 java.lang.String find(java.lang.String[] options, java.lang.String name, java.lang.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 java.lang.String find(java.lang.String[] options, java.lang.String name, java.lang.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-2018 Regents University of California. All Rights Reserved.