|
|
|||||||||||||||||||||
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.AbstractParameterizable
de.lmu.ifi.dbs.elki.application.AbstractApplication
public abstract class AbstractApplication
AbstractApplication sets the values for flags verbose and help.
Any Wrapper class that makes use of these flags may extend this class. Beware to make correct use of parameter settings via optionHandler as commented with constructor and methods.
Field Summary | |
---|---|
private ClassParameter<Parameterizable> |
DESCRIPTION_PARAM
Optional Parameter to specify a class to obtain a description for, must extend Parameterizable
. |
private Flag |
HELP_FLAG
Flag to obtain help-message. |
private Flag |
HELP_LONG_FLAG
Flag to obtain help-message. |
static String |
INFORMATION
Information for citation and version. |
private static String |
NEWLINE
The newline string according to system. |
private List<String> |
remainingParameters
The remaining parameters after the option handler grabbed the options for this application. |
private boolean |
verbose
Value of verbose flag. |
private Flag |
VERBOSE_FLAG
Flag to allow verbose messages while running the application. |
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable |
---|
optionHandler |
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
---|
debug, logger |
Constructor Summary | |
---|---|
protected |
AbstractApplication()
Adds the flags VERBOSE_FLAG and HELP_FLAG to the option
handler. |
Method Summary | |
---|---|
List<String> |
getRemainingParameters()
Returns a copy of the remaining parameters after the option handler grabbed the options for this application. |
boolean |
isVerbose()
Returns whether verbose messages should be printed while executing the application. |
private void |
printDescription()
Print the description for the given parameter |
private void |
printErrorMessage(Exception e)
Print an error message for the given error. |
private void |
printHelp()
Print the help message. |
abstract void |
run()
Runs the application. |
void |
runCLIApplication(String[] args)
Generic command line invocation. |
List<String> |
setParameters(List<String> args)
Grabs all specified options from the option handler. |
String |
usage()
Returns a usage message, explaining all known options |
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable |
---|
addOption, addParameterizable, addParameterizable, checkGlobalParameterConstraints, collectOptions, getAttributeSettings, getParameters, rememberParametersExcept, removeOption, removeParameterizable, shortDescription |
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 |
---|
private static final String NEWLINE
public static final String INFORMATION
private final Flag HELP_FLAG
Key: -h
private final Flag HELP_LONG_FLAG
Key: -help
private final ClassParameter<Parameterizable> DESCRIPTION_PARAM
Parameterizable
.
Key: -description
private final Flag VERBOSE_FLAG
Key: -verbose
private boolean verbose
private List<String> remainingParameters
Constructor Detail |
---|
protected AbstractApplication()
VERBOSE_FLAG
and HELP_FLAG
to the option
handler. Any extending class should call this constructor, then add further
parameters.
Method Detail |
---|
public List<String> setParameters(List<String> args) throws ParameterException
AbstractParameterizable
{ ListremainingParameters = super.setParameters(args); // set parameters for your class // for example like this: if(isSet(MY_PARAM_VALUE_PARAM)) { myParamValue = getParameterValue(MY_PARAM_VALUE_PARAM); } . . . return remainingParameters; // or in case of attributes requesting parameters themselves // return parameterizableAttribbute.setParameters(remainingParameters); }
setParameters
in interface Parameterizable
setParameters
in class AbstractParameterizable
args
- parameters to set the attributes accordingly to
ParameterException
- in case of wrong parameter-settingpublic final boolean isVerbose()
public final List<String> getRemainingParameters()
public String usage()
public void runCLIApplication(String[] args)
args
- the arguments to run this applicationprivate void printErrorMessage(Exception e)
e
- Error Exception.private void printHelp()
private void printDescription()
public abstract void run() throws UnableToComplyException
UnableToComplyException
- if an error
occurs during running the application
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |