Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.application
Class AbstractApplication

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.application.AbstractApplication
All Implemented Interfaces:
Parameterizable
Direct Known Subclasses:
CacheDoubleDistanceInOnDiskMatrix, CacheFloatDistanceInOnDiskMatrix, ComputeSingleColorHistogram, KDDCLIApplication, KNNExplorer, StandAloneApplication

public abstract class AbstractApplication
extends AbstractLoggable
implements Parameterizable

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.

Author:
Elke Achtert, Erich Schubert

Field Summary
protected static TrackParameters config
          Tracks the parameters.
private static StringParameter DEBUG_PARAM
          Optional Parameter to specify a class to enable debugging for.
private static ClassParameter<Object> DESCRIPTION_PARAM
          Optional Parameter to specify a class to obtain a description for.
private static Flag HELP_FLAG
          Flag to obtain help-message.
private static 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.
protected static Logging STATIC_LOGGER
          We need a static logger in this class.
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.logging.AbstractLoggable
debug, logger
 
Constructor Summary
protected AbstractApplication(Parameterization config)
          Constructor, adhering to Parameterizable
 
Method Summary
 boolean isVerbose()
          Returns whether verbose messages should be printed while executing the application.
private static void printDescription(Class<?> descriptionClass)
          Print the description for the given parameter
protected static void printErrorMessage(Exception e)
          Print an error message for the given error.
abstract  void run()
          Runs the application.
static void runCLIApplication(Class<?> cls, String[] args)
          Generic command line invocation.
static String usage(Collection<Pair<Object,Parameter<?,?>>> options)
          Returns a usage message, explaining all known options
 
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

STATIC_LOGGER

protected static Logging STATIC_LOGGER
We need a static logger in this class.


NEWLINE

private static final String NEWLINE
The newline string according to system.


INFORMATION

public static final String INFORMATION
Information for citation and version.


HELP_FLAG

private static final Flag HELP_FLAG
Flag to obtain help-message.

Key: -h


HELP_LONG_FLAG

private static final Flag HELP_LONG_FLAG
Flag to obtain help-message.

Key: -help


DESCRIPTION_PARAM

private static final ClassParameter<Object> DESCRIPTION_PARAM
Optional Parameter to specify a class to obtain a description for.

Key: -description


DEBUG_PARAM

private static final StringParameter DEBUG_PARAM
Optional Parameter to specify a class to enable debugging for.

Key: -enableDebug


VERBOSE_FLAG

private final Flag VERBOSE_FLAG
Flag to allow verbose messages while running the application.

Key: -verbose


verbose

private boolean verbose
Value of verbose flag.


config

protected static TrackParameters config
Tracks the parameters.

Constructor Detail

AbstractApplication

protected AbstractApplication(Parameterization config)
Constructor, adhering to Parameterizable

Parameters:
config - Parameterization
Method Detail

isVerbose

public final boolean isVerbose()
Returns whether verbose messages should be printed while executing the application.

Returns:
whether verbose messages should be printed while executing the application

runCLIApplication

public static void runCLIApplication(Class<?> cls,
                                     String[] args)
Generic command line invocation. Refactored to have a central place for outermost exception handling.

Parameters:
cls - Application class to run.
args - the arguments to run this application with

usage

public static String usage(Collection<Pair<Object,Parameter<?,?>>> options)
Returns a usage message, explaining all known options

Parameters:
options - Options to show in usage.
Returns:
a usage message explaining all known options

printErrorMessage

protected static void printErrorMessage(Exception e)
Print an error message for the given error.

Parameters:
e - Error Exception.

printDescription

private static void printDescription(Class<?> descriptionClass)
Print the description for the given parameter


run

public abstract void run()
                  throws UnableToComplyException
Runs the application.

Throws:
UnableToComplyException - if an error occurs during running the application

Release 0.3 (2010-03-31_1612)