Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities.optionhandling
Class ClassListParameter<C>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.Option<T>
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameter<List<T>,List<T>>
          extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.ListParameter<String>
              extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.ClassListParameter<C>
Type Parameters:
C - Class type

public class ClassListParameter<C>
extends ListParameter<String>

Parameter class for a parameter specifying a list of class names.

Author:
Steffi Wanka

Field Summary
private  Class<C> restrictionClass
          The restriction class for the list of class names.
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.ListParameter
SPLIT, VECTOR_SPLIT
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameter
constraints, defaultValue, optionalParameter
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Option
optionid, shortDescription, value
 
Constructor Summary
ClassListParameter(OptionID optionID, Class<?> restrictionClass)
          Constructs a class list parameter with the given optionID and restriction class.
ClassListParameter(OptionID optionID, Class<?> restrictionClass, boolean optional)
          Constructs a class list parameter with the given optionID and restriction class.
 
Method Summary
 String[] getRestrictionClasses()
          Returns the class names allowed according to the restriction class of this parameter.
 String getSyntax()
          Returns a string representation of the parameter's type.
 List<C> instantiateClasses()
          Returns a list of new instances for the value (i.e., the class name) of this class list parameter.
 boolean isValid(String value)
          Checks if the given argument is valid for this option.
 void setValue(String value)
          Sets the value of the option.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.ListParameter
getListSize, toString
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameter
addConstraint, addConstraintList, getDefaultValue, getFullDescription, getValue, getValuesDescription, hasDefaultValue, hasValuesDescription, isOptional, isSet, reset, setDefaultValue, setDefaultValueToValue, setOptional, tookDefaultValue
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Option
getName, getOptionID, getShortDescription, setShortDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

restrictionClass

private Class<C> restrictionClass
The restriction class for the list of class names.

Constructor Detail

ClassListParameter

public ClassListParameter(OptionID optionID,
                          Class<?> restrictionClass)
Constructs a class list parameter with the given optionID and restriction class.

Parameters:
optionID - the unique id of this parameter
restrictionClass - the restriction class of the list of class names

ClassListParameter

public ClassListParameter(OptionID optionID,
                          Class<?> restrictionClass,
                          boolean optional)
Constructs a class list parameter with the given optionID and restriction class.

Parameters:
optionID - the unique id of this parameter
restrictionClass - the restriction class of the list of class names
optional - specifies if this parameter is an optional parameter
Method Detail

setValue

public void setValue(String value)
              throws ParameterException
Description copied from class: Option
Sets the value of the option.

Specified by:
setValue in class Option<List<String>>
Parameters:
value - the option's value to be set
Throws:
ParameterException - if the given value is not a valid value for this option.

getRestrictionClasses

public String[] getRestrictionClasses()
Returns the class names allowed according to the restriction class of this parameter.

Returns:
class names allowed according to the restriction class defined.

isValid

public boolean isValid(String value)
                throws ParameterException
Description copied from class: Option
Checks if the given argument is valid for this option.

Specified by:
isValid in class Option<List<String>>
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.

getSyntax

public String getSyntax()
Returns a string representation of the parameter's type.

Specified by:
getSyntax in class Option<List<String>>
Returns:
"<class_1,...,class_n>"

instantiateClasses

public List<C> instantiateClasses()
                           throws ParameterException
Returns a list of new instances for the value (i.e., the class name) of this class list parameter. The instances have the type of the restriction class of this class list parameter.

If the Class for the class names is not found, the instantiation is tried using the package of the restriction class as package of the class name.

Returns:
alist of new instances for the value of this class list parameter
Throws:
ParameterException - if the instantiation cannot be performed successfully or the value of this class list parameter is not set

Release 0.2 (2009-07-06_1820)