|
|
|||||||||||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||||||||||
java.lang.Objectde.lmu.ifi.dbs.elki.logging.AbstractLoggable
de.lmu.ifi.dbs.elki.utilities.optionhandling.OptionHandler
public class OptionHandler
Provides an OptionHandler for holding the given options.
The options specified are stored in a <String,Option>-Map (Map) with the names of the options being the keys. New
options can be added by using the method put(Option).
| Field Summary | |
|---|---|
private List<GlobalParameterConstraint> |
globalParameterConstraints
Contains constraints addressing several parameters |
static String |
NEWLINE
The newline-String dependent on the system. |
static String |
OPTION_PREFIX
Prefix of option markers on the command line. |
private Map<String,Option<?>> |
parameters
Contains the optionHandler's options, the option names are used as the map's keys |
| Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
|---|
debug, logger |
| Constructor Summary | |
|---|---|
OptionHandler()
Provides an OptionHandler. |
|
| Method Summary | |
|---|---|
protected void |
checkGlobalParameterConstraints()
|
private void |
checkNonOptionalParameters()
|
List<GlobalParameterConstraint> |
getGlobalParameterConstraints()
|
Option<?>[] |
getOptions()
Get the available options of this handler. |
List<String> |
grabOptions(List<String> currentOptions)
Reads the options out of a given String-array (usually the args of any main-method). |
void |
put(Option<?> option)
Adds the given option to the OptionHandler's current parameter map. |
void |
remove(String optionName)
Removes the given option from the OptionHandler's parameter map. |
private void |
setDefaultValues()
Checks all parameters not specified in currentParameters for default values and sets them, if existing |
void |
setGlobalParameterConstraint(GlobalParameterConstraint gpc)
Add a global parameter constraint. |
| Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
|---|
debugFine, debugFiner, debugFinest, exception, progress, verbose, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String NEWLINE
public static final String OPTION_PREFIX
private Map<String,Option<?>> parameters
private List<GlobalParameterConstraint> globalParameterConstraints
| Constructor Detail |
|---|
public OptionHandler()
| Method Detail |
|---|
public List<String> grabOptions(List<String> currentOptions)
throws ParameterException
currentOptions - an array of given options, flags without values. E.g.
the args of some main-method. In this array every option should have
a leading "-".
ParameterException - if a parameter, for which a value is
required, has none (e.g. because the next value is itself some
option)public void put(Option<?> option)
option - Option to be added.public void setGlobalParameterConstraint(GlobalParameterConstraint gpc)
gpc - constraint
public void remove(String optionName)
throws UnusedParameterException
optionName - Option to be removed.
UnusedParameterException - If there is no such option.public Option<?>[] getOptions()
private void setDefaultValues()
private void checkNonOptionalParameters()
throws ParameterException
ParameterException
protected void checkGlobalParameterConstraints()
throws ParameterException
ParameterExceptionpublic List<GlobalParameterConstraint> getGlobalParameterConstraints()
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||