|
|
|||||||||||||||||||||
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.Option<T>
de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameter<T,C>
T
- the type of a possible value (i.e., the type of the option)C
- the type of a possible parameter constraintpublic abstract class Parameter<T,C>
Abstract class for specifying a parameter.
A parameter is defined as an option having a specific value.
Field Summary | |
---|---|
protected List<ParameterConstraint<C>> |
constraints
Holds parameter constraints for this parameter. |
protected T |
defaultValue
The default value of the parameter (may be null). |
private boolean |
defaultValueTaken
Specifies if the default value of this parameter was taken as parameter value. |
protected boolean |
optionalParameter
Specifies if this parameter is an optional parameter. |
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Option |
---|
name, shortDescription, value |
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable |
---|
debug |
Constructor Summary | |
---|---|
Parameter(OptionID optionID)
Constructs a parameter with the given optionID. |
|
Parameter(String name,
String description)
Deprecated. |
Method Summary | |
---|---|
protected void |
addConstraint(ParameterConstraint<C> constraint)
Adds a parameter constraint to the list of parameter constraints. |
protected void |
addConstraintList(List<ParameterConstraint<C>> constraints)
Adds a list of parameter constraints to the current list of parameter constraints. |
T |
getDefaultValue()
Returns the default value of the parameter. |
String |
getDescription()
Returns the extended description of the option which includes the option's type, the short description and the default value (if specified). |
protected abstract String |
getParameterType()
Returns a string representation of the parameter's type (e.g. an IntParameter should
return <int> ). |
T |
getValue()
Returns the value of the option. |
boolean |
hasDefaultValue()
Checks if this parameter has a default value. |
boolean |
isOptional()
Checks if this parameter is an optional parameter. |
boolean |
isSet()
Returns true if the value of the option is set, false otherwise. |
void |
reset()
Resets the value of the parameter to null. |
void |
setDefaultValue(T defaultValue)
Sets the default value of this parameter. |
void |
setDefaultValueToValue()
Sets the default value of this parameter as the actual value of this parameter. |
void |
setOptional(boolean opt)
Specifies if this parameter is an optional parameter. |
boolean |
tookDefaultValue()
Checks if the default value of this parameter was taken as the actual parameter value. |
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.Option |
---|
getName, getShortDescription, isValid, setShortDescription, setValue |
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 |
---|
protected T defaultValue
private boolean defaultValueTaken
protected boolean optionalParameter
protected List<ParameterConstraint<C>> constraints
Constructor Detail |
---|
public Parameter(OptionID optionID)
optionID
- the unique id of the option@Deprecated public Parameter(String name, String description)
name
- the parameter namedescription
- the parameter descriptionMethod Detail |
---|
protected void addConstraint(ParameterConstraint<C> constraint)
constraint
- the parameter constraint to be addedprotected void addConstraintList(List<ParameterConstraint<C>> constraints)
constraints
- list of parameter constraints to be addedpublic void setDefaultValue(T defaultValue)
defaultValue
- default value of this parameterpublic boolean hasDefaultValue()
public void setDefaultValueToValue()
public void setOptional(boolean opt)
opt
- true if this parameter is optional,false otherwisepublic boolean isOptional()
public boolean tookDefaultValue()
public boolean isSet()
Option
isSet
in class Option<T>
Option.isSet()
public T getValue() throws UnusedParameterException
Option
getValue
in class Option<T>
UnusedParameterException
- is not thrown actually in this class
but subclasses may require allowance to throw this ExceptionOption.getValue()
public T getDefaultValue()
public void reset()
public final String getDescription()
Option
getDescription
in class Option<T>
Option.getDescription()
protected abstract String getParameterType()
IntParameter
should
return <int>
).
|
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |