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.utilities.optionhandling.Option<T>
Type Parameters:
T - the type of a possible value for this option
Direct Known Subclasses:
Flag, Parameter

public abstract class Option<T>
extends Object

Abstract superclass for specifying program arguments.

Author:
Steffi Wanka

Field Summary
protected  OptionID optionid
          The option name.
protected  String shortDescription
          The short description of the option.
protected  T value
          The value of this option.
 
Constructor Summary
Option(OptionID optionID)
          Creates an option which is guaranteed to be have an unique name.
 
Method Summary
abstract  String getFullDescription()
          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.
 OptionID getOptionID()
          Return the OptionID of this option.
 String getShortDescription()
          Returns the short description of the option.
abstract  String getSyntax()
          Returns a string representation of the parameter's type (e.g. an IntParameter should return <int>).
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

optionid

protected final OptionID optionid
The option name.


shortDescription

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


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
Method Detail

getName

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

Returns:
the option's name.

getShortDescription

public 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

getFullDescription

public abstract String getFullDescription()
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.

getSyntax

public abstract String getSyntax()
Returns a string representation of the parameter's type (e.g. an IntParameter should return <int>).

Returns:
a string representation of the parameter's type

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.

getOptionID

public OptionID getOptionID()
Return the OptionID of this option.

Returns:
Option ID

Release 0.2.1 (2009-07-13_1605)