|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object acm.util.OptionTable
public class OptionTable
This class implements a simple tool for parsing key/value pairs from a string.
Constructor Summary | |
---|---|
OptionTable(Map<String,String> map)
OptionTable from an existing map. |
|
OptionTable(String str)
OptionTable and initializes it
from the specified string. |
|
OptionTable(String str,
String[] keys)
OptionTable from the specified string,
checking to make sure that all keys exist in the string array
keys . |
Method Summary | |
---|---|
double |
getDoubleOption(String key)
double value associated with key
in the option table, or 0.0 if no such value exists. |
double |
getDoubleOption(String key,
double defValue)
double value associated with key
in the option table or the specified default value if no such binding
exists. |
int |
getIntOption(String key)
key in the option
table, or 0 if no such value exists. |
int |
getIntOption(String key,
int defValue)
key in the option
table or the specified default value if no such binding exists. |
String |
getOption(String key)
key in the option
table, or null if no such value exists. |
String |
getOption(String key,
String defValue)
key in the option
table or the specified default value if no such binding exists. |
boolean |
isSpecified(String key)
|
Constructor Detail |
---|
public OptionTable(Map<String,String> map)
OptionTable
from an existing map.
Most clients will not need to use this method.
Usage: | OptionTable options = new OptionTable(map); | ||
Parameter: |
|
public OptionTable(String str)
OptionTable
and initializes it
from the specified string. The options in str
are in two possible forms:
Usage: | OptionTable options = new OptionTable(str); | ||
Parameter: |
|
public OptionTable(String str,
String[] keys)
OptionTable
from the specified string,
checking to make sure that all keys exist in the string array
keys
. If keys
is null
,
checking is disabled.
Usage: | OptionTable options = new OptionTable(str, keys); | ||||
Parameters: |
|
Method Detail |
---|
public double getDoubleOption(String key)
double
value associated with key
in the option table, or 0.0 if no such value exists.
Usage: | double value = options.getDoubleOption(key); | ||
Parameter: |
| ||
Returns: | The corresponding option value parsed as a double
|
public double getDoubleOption(String key,
double defValue)
double
value associated with key
in the option table or the specified default value if no such binding
exists.
Usage: | double value = options.getDoubleOption(key, defValue); | ||||
Parameters: |
| ||||
Returns: | The corresponding option value |
public int getIntOption(String key)
key
in the option
table, or 0 if no such value exists.
Usage: | int value = options.getIntOption(key); | ||
Parameter: |
| ||
Returns: | The corresponding option value parsed as an integer |
public int getIntOption(String key,
int defValue)
key
in the option
table or the specified default value if no such binding exists.
Usage: | int value = options.getIntOption(key, defValue); | ||||
Parameters: |
| ||||
Returns: | The corresponding option value |
public String getOption(String key)
key
in the option
table, or null
if no such value exists.
Usage: | String value = options.getOption(key); | ||
Parameter: |
| ||
Returns: | The corresponding option value |
public String getOption(String key,
String defValue)
key
in the option
table or the specified default value if no such binding exists.
Usage: | String value = options.getOption(key, defValue); | ||||
Parameters: |
| ||||
Returns: | The corresponding option value |
public boolean isSpecified(String key)
Usage: | if (options.isSpecified(key)) . . . | ||
Parameter: |
| ||
Returns: | true if key was specified in the option string
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |