|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Dictionary | +--java.util.Hashtable | +--java.util.Properties | +--jj2000.j2k.util.ParameterList
This class serves to store parameters for the different modules of the coder or decoder. Each parameter has a name and its associated value is stored as a string.
This class builds up on the standard Java Properties class and thus there are facilities to load and write parameters from/to a file. Also a parameter list can have a default parameter list provided for default values.
Each parameter can be retrieved as a string or as an specific primitive type (int, float, etc).
For more details see the Properties class.
Note that this class does not support multiple occurrences of parameters (for a parameter name, only one value is possible). Also there is no particular order of the parameters.
Properties
, Serialized FormFields inherited from class java.util.Properties |
defaults,
hexDigit,
keyValueSeparators,
serialVersionUID,
specialSaveChars,
strictKeyValueSeparators,
whiteSpaceChars |
Fields inherited from class java.util.Hashtable |
count,
ENTRIES,
entrySet,
KEYS,
keySet,
loadFactor,
modCount,
serialVersionUID,
table,
threshold,
values,
VALUES |
Constructor Summary | |
ParameterList()
Constructs an empty parameter list. |
|
ParameterList(ParameterList def)
Constructs an empty parameter list with the provided parameter list for defaulst. |
Method Summary | |
void |
checkList(char[] prfxs,
java.lang.String[] plist)
Checks if the parameters which names do not start with any of the prefixes in 'prfxs' in this ParameterList are all in the list of valid parameter names 'plist'. |
void |
checkList(char prfx,
java.lang.String[] plist)
Checks if the parameters which name starts with the prefix 'prfx' in the parameter list are all in the list of valid parameter names 'plist'. |
boolean |
getBooleanParameter(java.lang.String pname)
Returns the value of the named parameter as a boolean. |
ParameterList |
getDefaultParameterList()
Returns the default ParameterList. |
float |
getFloatParameter(java.lang.String pname)
Returns the value of the named parameter as a float. |
int |
getIntParameter(java.lang.String pname)
Returns the value of the named parameter as an int. |
java.lang.String |
getParameter(java.lang.String pname)
Returns the value of the named parameter, as a string. |
void |
parseArgs(java.lang.String[] argv)
Parses the parameters from an argument list, such as as the one in the command line, and integrates them in this parameter list. |
static java.lang.String[] |
toNameArray(java.lang.String[][] pinfo)
Converts the usage information to a list of parameter names in a single array. |
Methods inherited from class java.util.Properties |
|
Methods inherited from class java.util.Hashtable |
clear,
clone,
contains,
containsKey,
containsValue,
elements,
entrySet,
equals,
get,
hashCode,
isEmpty,
keys,
keySet,
put,
putAll,
readObject,
rehash,
remove,
size,
toString,
values,
writeObject |
Methods inherited from class java.lang.Object |
finalize,
getClass,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
Constructor Detail |
public ParameterList()
public ParameterList(ParameterList def)
def
- The defaults parametersMethod Detail |
public ParameterList getDefaultParameterList()
public void parseArgs(java.lang.String[] argv)
All options must be preceded by '-' and then followed by one or more words, which constitues the values. The name of the options constitute the name of the parameters. The only exception is for boolean options, in which case if they are preceded by '-' they will be turned on, and if preceded by '+' they will be turned off. The string value of a boolean option is "on" or "off". Note that the '-' and '+' characters can not precede any word which would be a value for an option unless they are numeric values (otherwise it would be considered as a boolean option). Note also that the name of an option can not start with a number.
No option can appear more than once. If so happens an exception is thrown.
For instance the string:
"-Ffilters w5x3 -Wlev 5 -Qtype reversible
will create the following parameter list:
Ffilers w5x3 Wlev 5 Qtype reversible
argv
- The argument list.public java.lang.String getParameter(java.lang.String pname)
pname
- The parameter name.public boolean getBooleanParameter(java.lang.String pname)
pname
- The parameter name.public int getIntParameter(java.lang.String pname)
pname
- The parameter name.public float getFloatParameter(java.lang.String pname)
pname
- The parameter name.public void checkList(char prfx, java.lang.String[] plist)
prfx
- The prefix of parameters to check.plist
- The list of valid parameter names for the 'prfx'
prefix. If null it is considered that no names are valid.public void checkList(char[] prfxs, java.lang.String[] plist)
prfxs
- The prefixes of parameters to ignore.plist
- The list of valid parameter names. If null it is
considered that no names are valid.public static java.lang.String[] toNameArray(java.lang.String[][] pinfo)
pinfo
- The list of options and their usage info (see above).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |