Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities.optionhandling
Class Option<T>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.Option<T>
Type Parameters:
T - the type of a possible value for this option
All Implemented Interfaces:
Loggable
Direct Known Subclasses:
Flag, Parameter

public abstract class Option<T>
extends AbstractLoggable

Abstract superclass for specifying program arguments.

Author:
Steffi Wanka

Field Summary
protected  String name
          The option name.
protected  String shortDescription
          The short description of the optionn.
protected  T value
          The value of this option.
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug
 
Constructor Summary
Option(OptionID optionID)
          Creates an option which is guaranteed to be have an unique name.
Option(String name, String description)
          Deprecated. use Option(optionID) instead
 
Method Summary
abstract  String getDescription()
          Returns the extended description of the option which includes the option's type, the short description and the default value (if specified).
 String getName()
          Returns the name of the option.
protected  String getShortDescription()
          Returns the short description of the option.
 T getValue()
          Returns the value of the option.
abstract  boolean isSet()
          Returns true if the value of the option is set, false otherwise.
abstract  boolean isValid(String value)
          Checks if the given argument is valid for this option.
 void setShortDescription(String description)
          Sets the short description of the option.
abstract  void setValue(String value)
          Sets the value of the option.
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, verbose, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected final String name
The option name.


shortDescription

protected String shortDescription
The short description of the optionn. An extended description is provided by the method getDescription()


value

protected T value
The value of this option.

Constructor Detail

Option

public Option(OptionID optionID)
Creates an option which is guaranteed to be have an unique name.

Parameters:
optionID - the unique id of the option

Option

@Deprecated
public Option(String name,
                         String description)
Deprecated. use Option(optionID) instead

Sets the name and description of the option.

Parameters:
name - The name of the option.
description - The description of the option.
Method Detail

getName

public String getName()
Returns the name of the option.

Returns:
the option's name.

getShortDescription

protected String getShortDescription()
Returns the short description of the option.

Returns:
the option's short description.

setShortDescription

public void setShortDescription(String description)
Sets the short description of the option.

Parameters:
description - the short description to be set

getDescription

public abstract String getDescription()
Returns the extended description of the option which includes the option's type, the short description and the default value (if specified).

Returns:
the option's description.

isSet

public abstract boolean isSet()
Returns true if the value of the option is set, false otherwise.

Returns:
true if the value of the option is set, false otherwise.

setValue

public abstract void setValue(String value)
                       throws ParameterException
Sets the value of the option.

Parameters:
value - the option's value to be set
Throws:
ParameterException - if the given value is not a valid value for this option.

getValue

public T getValue()
           throws UnusedParameterException
Returns the value of the option.

Returns:
the option's value.
Throws:
UnusedParameterException - is not thrown actually in this class but subclasses may require allowance to throw this Exception

isValid

public abstract boolean isValid(String value)
                         throws ParameterException
Checks if the given argument is valid for this option.

Parameters:
value - option value to be checked
Returns:
true, if the given value is valid for this option
Throws:
ParameterException - if the given value is not a valid value for this option.

Release 0.1 (2008-07-10_1838)